Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24)

Author Topic: [0.96a-RC8][bug?] Combining STRIKE & ANTI_FTR tags on missiles can cause crashes  (Read 534 times)

SpaceDrake

  • Captain
  • ****
  • Posts: 481
  • Piloting space mecha for fun and profit(?)
    • View Profile

So this one part bug? report and one part PSA, but: it appears that, thanks to the changes in how STRIKE missiles work (e.g., from the patch notes, "Already-launched guided missiles with the "STRIKE" tag no longer auto-target fighters if there is anything else nearby"), a missile that has both the STRIKE tag and ANTI_FTR tag can get deeply confused and null itself out in certain battle conditions.

This came up with testing to update the Arma Armatura mod to .96. A few of the mechs have "seeking swarm missile" systems that used both tags so that they could mostly fill an anti-fighter role but could be useful against larger targets if it came to that. In previous versions, this worked fine, but the AI change has made it so that in certain conditions (that appear to mostly involve new fighters entering the field at or near missile launch, but it's been a bit wicked trying to pin down the exact failure state) the MissileAI will simply null itself out, seemingly when trying to acquire a target. An example crash:

Code
382715 [Thread-3] ERROR com.fs.starfarer.combat.CombatMain  - java.lang.NullPointerException
java.lang.NullPointerException
at com.fs.starfarer.prototype.Utils.void(Unknown Source)
at com.fs.starfarer.combat.ai.Oo0O.o00000(Unknown Source)
at com.fs.starfarer.combat.ai.missile.MissileAI.acquireAndPrepare(Unknown Source)
at com.fs.starfarer.combat.ai.missile.MissileAI.seekTarget(Unknown Source)
at com.fs.starfarer.combat.ai.missile.MissileAI.advance(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advanceInner(Unknown Source)
at com.fs.starfarer.combat.CombatEngine.advance(Unknown Source)
at com.fs.starfarer.combat.CombatState.traverse(Unknown Source)
at com.fs.state.AppDriver.begin(Unknown Source)
at com.fs.starfarer.combat.CombatMain.main(Unknown Source)
at com.fs.starfarer.StarfarerLauncher.super(Unknown Source)
at com.fs.starfarer.StarfarerLauncher$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Now, the only vanilla missile system with a function even close to how these mod missiles behave at all is the Locust, and the only tags that has is "ANTI_FTR, DO_NOT_AIM, DO_NOT_CONSERVE", so this is a case that won't come up in vanilla at all and I can see these two tags not being intended for use together. But it's absolutely possible to apply these tags together in mods, and figuring out that this was the cause was an ordeal, because the crash case appears to be fairly specific in battlefield conditions.

Anyway, given the esoteric nature of the cause, I'm not even sure this is a bug to be addressed as such, but it's definitely something that modders need to be mindful of: if you are trying to combine STRIKE and ANTI_FTR tag behavior, this will eventually cause the MissileAI to crash, especially in longer or target-heavy combats. The precise, momentary case is difficult to pin down, but the crash is very repeatable and the tag combination turns that weapon into a ticking null-pointer time bomb.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23775
    • View Profile

Thank you, fixed! I think this may actually affect guided missiles with the STRIKE tags, without needing ANTI_FTR, though not 100% sure on that.
Logged