HomeWildfire Games

UnitMotion - reject paths that would not take the unit closer to the goal than…

Description

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

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).

This assumes that being as close as possible to the goal is the best behaviour when trying to move somewhere, even when it is unreachable.

Refs #3144

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