HomeWildfire Games

Optimise FindWalkAndFightTargets.
AuditedrP25102

Description

Optimise FindWalkAndFightTargets.

FindWalkAndFightTargets is used during attack-walk (and a few other situations) to find new entities to attack. This function can be a bit slow, taking large chunks of time during battles.

This optimises it by assuming that one of the surrounding unit will match preferred criteria (which, for most soldiers, are 'Human'), thus returning the first attackable entity. In the worst case, it should still be slightly faster than the current code.

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

Event Timeline

Freagarach added inline comments.
/ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
999

Are these intended to be left in?

wraitii added inline comments.Mar 25 2021, 8:16 PM
/ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
999

Short answer "yes". Could be removed.

Freagarach raised a concern with this commit.Aug 3 2021, 11:45 AM
Freagarach added inline comments.
/ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
6071–6072
This commit now has outstanding concerns.Aug 3 2021, 11:45 AM
Freagarach added inline comments.Aug 3 2021, 12:06 PM
/ps/trunk/binaries/data/mods/public/simulation/components/UnitAI.js
6071–6072
Freagarach accepted this commit.Sep 10 2021, 8:34 AM

My concern has been fixed.

All concerns with this commit have now been addressed.Sep 10 2021, 8:34 AM