Deterministic for multiplayer rts?

Hi Aron,
I’ve used the free version of pathfinding for a single player game, and I like using it. I was wondering if a* was deterministic because I need calculations to be the same on all devices? I’m using a lockstep implementation in my project.
Thanks in advance.

Hi

Pathfinding itself is deterministic. However, since paths are calculated asynchronously and in multiple threads it may take a shorter or longer amount of time to calculate them on different computers. Use path.BlockUntilCalculated() to avoid this. See https://arongranberg.com/astar/docs/path.html#BlockUntilCalculated

Also note that floating point calculations are not necessarily completely deterministic on different architectures. Usually they are, but the C# spec leaves it open for different architectures to produce sliightly different values in some cases.
Due to this, games like SC2 only use integer math in their engine (at least the parts that need to be lockstep-safe) as far as I understand.
This package uses floating point math in quite a few places. Pathfinding itself is however mostly free from floating point math.

Thanks for the reply!