Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: More and Larger Asteroids + Debris Fields in Combat  (Read 1743 times)

Digganob

  • Lieutenant
  • **
  • Posts: 64
    • View Profile
More and Larger Asteroids + Debris Fields in Combat
« on: August 21, 2022, 12:52:29 PM »

I'm beginning to take my first steps into learning how to mod this game, and a couple of ideas I had in mind were to 1. Make asteroid fields more significant in combat, by first allowing bigger asteroids (for which there are already sprites, I have found), and second by increasing asteroid spawn rates in combat significantly. Like, enough to reduce the practical range of a gauss cannon, for instance.

My second idea, and one I'd imagine is much harder to implement, is causing ship wrecks to show up in combat when your fleets are in a debris field.

The asteroid idea I'd imagine wouldn't be too difficult, all I really need to know is where I can change variables for asteroid spawn rate, and where I can add additional asteroid types to allow them to also spawn in. If anyone would know where/how I could access such variables, that would be helpful.

For combat debris, I'd imagine I'd have to somehow use the combat asteroid mechanic to spawn in ship wrecks, but as far as I know wrecks can only be made through destroying a ship in combat, so I'd have to program something to make pre-destroyed ships in combat. That's the thing I would need more help and pointers for.

Also, tell me what you guys think about this idea! I saw another post made a long while ago, debating whether larger and more common asteroid would be too difficult for the AI to handle maneuvering around, as it already has trouble with ship wrecks, and making what is practically very similar to a capital-sized ship wreck much more common may cause some issues.
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4688
    • View Profile
    • GitHub profile
Re: More and Larger Asteroids + Debris Fields in Combat
« Reply #1 on: August 23, 2022, 07:21:53 PM »

I'm not sure bigger asteroids are possible without generating fake not-actually-asteroids. CombatEngineAPI.spawnAsteroid only provides three sizes.
(But as the existence of the method implies, you can generate an arbitrary number of asteroids with your own script)
Automated asteroid generation volume needs to be set before entering combat, in the game's BattleCreationPlugin.

For ship wrecks, you can add ships in combat with CombatEngineAPI.getFleetManager(side).spawnFleetMember, then call setHulk(true) on the resulting ShipAPI.
Not sure if there's a particular method to break them up into pieces, maybe just apply damage to the hulk? Or you might have to blow them up while they're still alive.
Logged

Serenitis

  • Admiral
  • *****
  • Posts: 1470
    • View Profile
Re: More and Larger Asteroids + Debris Fields in Combat
« Reply #2 on: August 24, 2022, 12:17:39 AM »

I might be mis-remembering but...
Wouldn't having a larger asteroid image make them also appear larger in-game? Like just upscale the image.
There was a "hi res" mod ages ago that had an issue like that I think.
Logged

Digganob

  • Lieutenant
  • **
  • Posts: 64
    • View Profile
Re: More and Larger Asteroids + Debris Fields in Combat
« Reply #3 on: August 30, 2022, 12:45:52 AM »

I'm not sure bigger asteroids are possible without generating fake not-actually-asteroids. CombatEngineAPI.spawnAsteroid only provides three sizes.
(But as the existence of the method implies, you can generate an arbitrary number of asteroids with your own script)
Automated asteroid generation volume needs to be set before entering combat, in the game's BattleCreationPlugin.

For ship wrecks, you can add ships in combat with CombatEngineAPI.getFleetManager(side).spawnFleetMember, then call setHulk(true) on the resulting ShipAPI.
Not sure if there's a particular method to break them up into pieces, maybe just apply damage to the hulk? Or you might have to blow them up while they're still alive.

Oh, thank you! As I am still learning how to use Javascript right now I have only a limited idea of what you mean, but I know enough to see that this information is very useful. I'll have to see if I could identify what ships are in a debris field, which would then determine what ship hulks spawn in combat. If I could, that would be very cool!
Logged

jeffg10

  • Ensign
  • *
  • Posts: 42
  • Cheesus Crust
    • View Profile
Re: More and Larger Asteroids + Debris Fields in Combat
« Reply #4 on: September 23, 2022, 02:46:13 AM »

Excited about this mod! I definitely think that more space battle hazards are a great idea. You could add destroyed or very low CR remnant to battles (left over from the AI wars) randomly or pirate ships floating around as debris, or even check what factions are in a system and randomly add their ships (whole or as chunks) as debris to those battles. I saw someone mentioning that they didn't know how to always make ships stay in one piece and to be honest I don't think you need to. The hulk of a once mighty battleship drifting across the battlefield or the now derelict frame of a station could make great cover or a top-tier annoyance for those trying to get a good shot.
Logged
"Someone else might have wept or screamed in frustration or even given up right there and perished. But I didn't have the right to do any of those things, not while my people were in danger. Like it or not, I would have to explore this harsh world on my own."

Digganob

  • Lieutenant
  • **
  • Posts: 64
    • View Profile
Re: More and Larger Asteroids + Debris Fields in Combat
« Reply #5 on: December 21, 2022, 11:37:33 PM »

The hulk of a once mighty battleship drifting across the battlefield or the now derelict frame of a station could make great cover or a top-tier annoyance for those trying to get a good shot.

Exactly the idea I had in mind! Sorry I haven't gotten to working on this yet. Life stuff gets in the way, and other interests take precedence. But, I am still planning on working on this! Simply making asteroids more common should by itself be any easy mod to implement, and as I learn more I do still hope to add in combat derelicts to one degree of complexity or another. Hopefully it's possible and practical to implement them in those ways you mentioned, with it being based on surroundings. I'm especially interested in debris fields being a factor in the number and type of debris that show up. It would be awesome to have been fighting several fleets of some faction, and a couple battles in, the battlefield is riddled with hulks from that faction! It would also really give a chance in those last-stand type battles where every tool at your disposal could make a difference, including derelict hulks.

Anyways, I should have a bit more free time in the coming weeks, so hopefully I'll summon the discipline to maintain some progress on working on this project.
Logged

NikoTheGuyDude

  • Commander
  • ***
  • Posts: 231
    • View Profile
Re: More and Larger Asteroids + Debris Fields in Combat
« Reply #6 on: December 22, 2022, 04:58:19 AM »

I'm not sure bigger asteroids are possible without generating fake not-actually-asteroids. CombatEngineAPI.spawnAsteroid only provides three sizes.
(But as the existence of the method implies, you can generate an arbitrary number of asteroids with your own script)
Automated asteroid generation volume needs to be set before entering combat, in the game's BattleCreationPlugin.

For ship wrecks, you can add ships in combat with CombatEngineAPI.getFleetManager(side).spawnFleetMember, then call setHulk(true) on the resulting ShipAPI.
Not sure if there's a particular method to break them up into pieces, maybe just apply damage to the hulk? Or you might have to blow them up while they're still alive.

Does setting hulk to true actually create a hulk without like, the death message? If so that's super useful for me.
The method for splitting ships is splitShip() fyi, just only use it on dead ships.
Logged