0ad/source/simulation2/components/tests
wraitii 592453c62f Add a simple 'pushing' logic to unit motion to improve movement.
This implements a form of crowd movement that I've generally called
'unit pushing' in the last few years.
Essentially, any two units will push each other away when they're too
close. This makes it possible to ignore unit-unit obstructions, and thus
makes movement much smoother in crowds.
This first iteration of this system only allows pushing between idle
units and between moving units (i.e. a moving unit does not affect an
idle one).
This is because the unitMotion logic to detect it is stuck & needs to
use the pathfinders starts breaking: units can fail to move because they
are pushed away from their intended movement, and the current logic
fails to handle this gracefully.
Thankfully, the most value of this patch in terms of player experience
is found in the improvements to group movements and shuttling.

Other impacts:
- As the short pathfinder is called less often, we can increase the
starting search range & reduce the # of max turns, both improving
collision recovery.
- The performance of idle units is slightly worsened, as they must be
checked for idle-idle collisions. If needed a 'sleeping' system, as used
in physics engine, could be implemented.
- In general, however, expect slight performance improvements, as fewer
short paths are computed.
- Gathering efficiency should increase slightly, since shuttling times
are likely reduced slightly.
- As a sanity change to improve some edge cases (units that say they're
moving, i.e. pushable, but don't actually move), the 'going straight'
logic is turned off if a short path has been computed. This requires a
few cascading changes to work correctly.

Technical notes:
- To reduce the cost of the n^2 comparisons that pushing requires, units
are only compared within a small square on a grid which is lazily
reconstructed each turn. The overhead seems rather small, and this is
much simpler than keeping an up-to-date grid.
- The design is intended to be parallelisable if needed someday.
- The pathfinder's CheckMovement ignores moving units in UnitMotion, as
that is now the spec. Idle units are not ignored, which is required for
the 'collision' detection to work correctly (see above).

Refs #3442 (not fixed - idle units are not pushed by moving units).
Fixes #5084 (the overlap can still happen, but units will push each
other away).

Differential Revision: https://code.wildfiregames.com/D1490
This was SVN commit r25182.
2021-04-02 16:30:59 +00:00
..
test_CinemaManager.h Rename ScriptRuntime to ScriptContext 2020-11-14 10:57:50 +00:00
test_CommandQueue.h Improve JS Exception handling. 2020-11-15 18:29:17 +00:00
test_HierPathfinder.h Fix most of the new vs2017 induced warnings. 2020-11-26 22:28:50 +00:00
test_ObstructionManager.h Add a simple 'pushing' logic to unit motion to improve movement. 2021-04-02 16:30:59 +00:00
test_Pathfinder.h Make real directory paths on the VFS predictable (retry) 2021-03-23 12:46:59 +00:00
test_Position.h Clean up header includes, add new forward declarations. 2020-11-21 11:20:29 +00:00
test_RangeManager.h Add a simple 'pushing' logic to unit motion to improve movement. 2021-04-02 16:30:59 +00:00
test_scripts.h Make real directory paths on the VFS predictable (retry) 2021-03-23 12:46:59 +00:00
test_TerritoryManager.h Pass some strings and a vector as const refs. 2017-02-24 17:02:10 +00:00