HomeWildfire Games

Thread the pathfinder computations using the task manager.

Description

Thread the pathfinder computations using the task manager.

The pathfinder computations are run asynchronously (and potentially on the main thread) in-between simulation turns, thus reducing pathfinder-related lag considerably in common cases.

To make this most efficient, the number of paths computed during a turn via MaxSameTurnMoves is reduced from 64 to 20.

This has a hard dependency on the obstruction manager (via the vertex pathfinder) not being modified in-between simulation turn (or to put it more generally on the simulation state not changing outside of turn computation), otherwise results will be non-deterministic and go OOS. This is currently entirely safe (as in, it indeed does not happen that the simulation state changes in-between turn), but future work towards improving simulation sandboxing would be good.

Thanks to Kuba386 for maintaining & improving the patch in 2020
Thanks to everyone who tested the various iterations of this patch.

Fixes #4324

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