Page MenuHomeWildfire Games

UnitMotion addendum - reject paths that would not take the unit closer to the goal than it is now.

Authored by wraitii on Jul 14 2019, 1:05 PM.


Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
rP22566: UnitMotion - reject paths that would not take the unit closer to the goal than…
Trac Tickets

(This is an additional UM fix, not originally part of the rewrite)

This helps with #3144 and units not going idle when ordered to clump together.

By rejecting paths that would not take the unit closer to the goal than it is, we can avoid the case where a unit at A finds a short path to B, goes there, gets stuck, finds a new short path to A, etc. ad infinitum.

It doesn't completely fix the problem since two units moving might still occasionally become stuck against one another, but it makes it rarer (unit pushing would probably finish solving this).

Test Plan

Order a large groups of units to walk somewhere, order them to gather then return to a dropsite.

Diff Detail

rP 0 A.D. Public Repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

wraitii created this revision.Jul 14 2019, 1:05 PM

Build failure - The Moirai have given mortals hearts that can endure.

Link to build:

wraitii added inline comments.Jul 14 2019, 1:17 PM
634 ↗(On Diff #8891)

TODO: DistanceToPointSquared

697 ↗(On Diff #8891)

TODO: clarify that 'path' is short here.

wraitii updated this revision to Diff 9150.Jul 28 2019, 11:59 AM

Slight changes - make the function const, pass it a goal directly, explicit a few things.

PathGoal doesn't have DistanceToPointSquared, so scratch that for now.

Successful build - Chance fights ever on the side of the prudent.

Link to build:

This revision was not accepted when it landed; it landed in state Needs Review.Jul 28 2019, 12:29 PM
This revision was automatically updated to reflect the committed changes.