HomeWildfire Games

UnitMotion - Explicit handling of movement errors (such as target death) in…
AuditedrP22425

Description

UnitMotion - Explicit handling of movement errors (such as target death) in Combat.Approaching

In A23, units that are approaching an enemy (Combat.Approaching) will carry on moving to their last waypoint if the target dies, and then go idle.
As of rP22415, this no longer happens and units stop in their tracks, staying in attacking forever.

This lets Combat.Approaching explicitly handle the error, deciding what is best to do:

  • go to the next order (for hunting and queued orders)
  • find new targets nearby (in case the attack wasn't a forced order)
  • walk to the target's last known position and find units to attack there (in case it was). This is A23 behaviour.

Differential Revision: https://code.wildfiregames.com/D1992

Details

Event Timeline

Silier raised a concern with this commit.Jul 22 2019, 12:49 PM
Silier added a subscriber: Silier.
Silier added inline comments.
/ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
1973

This is not best solution, FINDINGNEWTARGET does not have Timer nor COMBAT itself, we are not changing state or leaving this one with return true, so this will trigger broken behaviour

This commit now has outstanding concerns.Jul 22 2019, 12:49 PM
Silier added inline comments.Jul 22 2019, 1:01 PM
/ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
1973

also msg is undefined here

wraitii added inline comments.Jul 22 2019, 1:32 PM
/ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
1973

ack, I thought I'd changed that but I must have forgotten for formations.

Silier added inline comments.Jul 24 2019, 10:54 AM
/ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
1951

at this point we cannot reach target nor we are going to chase it, so we should change state. FINDNEWTARGETS ?

wraitii added inline comments.Jul 24 2019, 11:01 AM
/ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
1951

We should indeed, I'm doing that fix right now.
I missed in this diff that this changed the control flow :/

wraitii requested verification of this commit.Jul 28 2019, 12:41 PM
This commit now requires verification by auditors.Jul 28 2019, 12:41 PM
Silier accepted this commit.Jul 28 2019, 2:08 PM
All concerns with this commit have now been addressed.Jul 28 2019, 2:08 PM

@rev 23951.

/ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
1792

Apparently lastPos can be undefined.

wraitii added inline comments.
/ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
1792

Probably can, yeah, other code checks for its existence and that code is messy at best.
See D2960