1
0
forked from 0ad/0ad
0ad/source/simulation2/scripting
wraitii 32e8ed51aa UnitMotion - Send messages to UnitAI when obstructed, to allow stopping early when walking and avoiding pathfinding lag.
As reported by #5521, Ordering units to walk to a point in a forest can
lag terribly, as units will end up computing long short paths in the
forest, which can result in `ComputeShortPath` calls that individually
take upwards of 80ms.

This can be alleviated by allowing units to stop a bit earlier. A23
handled this in UnitMotion directly, but it's better to handle this in
UnitAI to avoid surprises and to make it customisable on a per-state
level.

This diff further speeds up using the short pathfinder by starting with
a smaller search range, limiting the max-range more and moving the range
slightly towards the goal.

This also refactors UM sending messages to UnitAI so that we may in the
future push more information (in particular, the entity_id that a unit
was obstructed by could be interesting for COMBAT).

This doesn't fix the possibility of lag, but it reduces its occurrence
to levels that should be similar to A23 and thus acceptable enough.

Tested By: Freagarach
Fixes #5521

Differential Revision: https://code.wildfiregames.com/D2105
This was SVN commit r22526.
2019-07-22 18:07:24 +00:00
..
EngineScriptConversions.cpp Fix missing return in previous (65b02395b3), use underscore as recommended by Vladislav. 2019-07-17 00:00:05 +00:00
JSInterface_Simulation.cpp Add missing ScriptInterface includes to 2018-04-27 16:48:44 +00:00
JSInterface_Simulation.h Add missing ScriptInterface includes to 2018-04-27 16:48:44 +00:00
MessageTypeConversions.cpp UnitMotion - Send messages to UnitAI when obstructed, to allow stopping early when walking and avoiding pathfinding lag. 2019-07-22 18:07:24 +00:00
ScriptComponent.cpp Pass ScriptInterface as a const ref where possible. 2017-08-24 00:32:42 +00:00
ScriptComponent.h Pass ScriptInterface as a const ref where possible. 2017-08-24 00:32:42 +00:00