TrueSync and pathfinding

For a RTS game the units use pathfinding to avoid obstacles and get to the destination which move their transform, now since their transform is made up of floats this isn't deterministic

So TrueSync uses its own TSTransform which is deterministic but how can you use that with pathfinding?..

At the moment i use unity pathfinding system, i think true sync is a great idea but can't figure out anyway i can make the path formed deterministic?

Comments

  • Unity's pathfinding is not deterministic at all, so it can't be used.


    We're evaluating the possibility of working with a 3rd-party vendor to develop a complete deterministic solution for 2D path finding, but we do not have an ETA for that yet.

    We suggest you implement an integer or FixedPoint-based solution for now.
  • Thanks for the info, its really helpful

    Sounds great if your team could do a path finding system that fits in with your true sync... something to look forward to

    thanks for the advice, I've read about a few that ill try.
  • Any path finding that is deterministic will fit with TrueSync, because it doesn't need to be synchronised. We just didn't find one in the asset store to recommend (all are float-based, and too coupled with Unity callbacks, which are not deterministic).

    If you build one yourself, we'd be happy to help you test and maybe promote it in the asset store (a lot of devs may need one).
  • I think building this myself might be a bit above my capabilities but maybe ill reconsider if all else fails.

    I read somewhere that you could make it deterministic if one device calculates the path and then sends the path over to the other players, is this possible with true sync to send a path as apposed to a players input in this case
  • This will not be a lockstep simulation anymore, and you'll loose all advantages of it (low bandwidth requirements, automatic replays, etc).

    In lockstep games the easiest way is to have a deterministic local path finder. If you use a grid and only integers as weights, it will be deterministic.
  • Yes i see what you're saying and agree with you!

    Because of floating point math i take it that ill need to use the 'tstransform' in the 'truesyncupdate' with my path finding solution to make it deterministic too?

    Also I've read that when calculating paths, different devices will calculate them at different speeds which will upset the sync, is their a way within true sync to calculate the path and send it over maybe in the truesyncinput and receive the path in the truesyncupdate so both players can execute it together?
  • Hi @Riskki,

    If you have the path you can use TrueSyncInput to send it over the network, you can check in OnSyncedUpdate if there is a specific key with TrueSyncInput.HasXYZ.