Open askhati opened 3 years ago
This bug also happens when the target switches between mobile/deployed state, e.g. Tick Tank. It can thus be easily reproduced when playing as Nod: Make a Rocket Infantry fire at a Tick Tank and (un)deploy the tank before the missile hits.
To fix this, we need to figure out the algorithm of BulletClass::AI
for both ROT > 0
projectiles as well as ROT <= 0
projectiles. It's a rather complex function to reverse-engineer.
I'm attaching slightly cleaned up pseudocode for the function. @tomsons26 provided me with the original pseudo, but I cleaned it up a bit further. bulletclass__ai_ts.txt
I made a test where I made the game skip entirely calling the bullet explosion / disappearing code regardless of the projectile's state. It resulted in behaviour where ROT > 0
projectiles circle around their target infinitely, until the target dies. When the target dies, the ROT > 0
projectiles stop instantly. ROT = 0
projectiles, however, continue moving on their own for some time even after their target dies. Video of ROT > 0 projectile behaviour
This kinda points towards the game having no code for properly advancing the movement of ROT > 0
projectiles whose target is dead. This might not be the ultimate truth though.
Part of BulletClass::AI
, specifically the code that deals with ROT > 0
projectiles (from 0x00444814
on), re-written in C++ for Vinifera to some degree:
https://cdn.discordapp.com/attachments/741394749063430144/950888946953494538/bulletclass__ai_rot_over_zero.cpp
It's far from complete, but is likely a good base for further research. I took the BulletClass::AI
pseudocode posted above in my earlier comment, cleaned it up further and did more research until I was able to write this.
Description:
Homing projectiles (weapon projectile ROT>0) - noticeably missiles, and the CyCommando plasma cannon - will disappear mid-flight if their target becomes unavailable (is destroyed, or cloaks).
Conditions:
Weapon projectile must have ROT>0
Steps To Reproduce:
Expected Behaviour:
The homing projectiles should keep flying towards the last known position of the now-destroyed (or now-cloaked) unit.
Actual Behaviour:
Homing projectiles just disappear mid-air.