Page MenuHomeWildfire Games

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

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

Details

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

(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

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
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: https://jenkins.wildfiregames.com/job/docker-differential/73/display/redirect

wraitii added inline comments.Jul 14 2019, 1:17 PM
source/simulation2/components/CCmpUnitMotion.cpp
634 ↗(On Diff #8891)

TODO: DistanceToPointSquared

697 ↗(On Diff #8891)

TODO: clarify that 'path' is short here.

wraitii updated this revision to Diff 9150.Sun, Jul 28, 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: https://jenkins.wildfiregames.com/job/docker-differential/255/display/redirect

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