HomeWildfire Games

Fix formations reshaping incorrectly & related issues.


Fix formations reshaping incorrectly & related issues.

Formation were reshaping in cases where they should not (such as when the controller is waiting on members).
This made them look very odd for some orders.

This also cleans up held positions for formations somewhat.


  • rP23346 fixed units not facing correctly after a formation-walk. The fix is correct, but we can actually make it slightly more self-contained by moving everything in leave. Also clarify comments.
  • This fixes some very broken code in rP22447 in FORMATIONMEMBER.WALKING.MovementUpdate. It never errored because formation controllers weren't moved out of the world before.

Reviewed By: Angen

Fixes #5443

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

Event Timeline

Freagarach added a subscriber: Freagarach.EditedJul 9 2020, 4:23 PM

In the following replay on r23810 at around 2:20 the FPS drop hugely for me. Not before this revision, only after.

Freagarach raised a concern with this commit.Jul 9 2020, 4:25 PM
This commit now has outstanding concerns.Jul 9 2020, 4:25 PM
wraitii removed an auditor: Freagarach.

Thanks for reporting this... I'm removing the audit because the lag is a symptom of the code working and not the opposite, but I do have a mitigation (see D2871)

The lag comes from the short-pathfinder, and is rather logical -> units are trying to go somewhere unreachable, so they compute increasingly large short paths. In a semi-large formation, this can result in a lot of path computations.

However, pre rP23806 the ode was buggy and unit immediately aborted, so no lag
The lag is actually not that easy to trigger -> in your replay there are many trees nearby, which is a bad situation for the short pathfinder.

See this replay for me trying to reproduce the lag and having some trouble getting it to _really_ lag.:

This commit no longer requires audit.Jul 12 2020, 10:43 AM

I think this may come from here? Last entries of a trace:

#0  CCmpPosition::GetPosition2D (this=0x555584a25100) at ../../../source/simulation2/components/CCmpPosition.cpp:510
#1  0x00005555556eae8d in CCmpUnitMotion::HandleObstructedMove (this=this@entry=0x55558c7e80d0)
    at ../../../source/simulation2/components/CCmpUnitMotion.cpp:1041

Why I note this here is because in UnitAI a formation can be moved out of the world.

Freagarach added inline comments.