Syncing graph updates between client(s) and server

Hi,

I’m prototyping a turn-based multiplayer game with an authoritative server model.

Currently I’m leaning towards using a Recast graph where the enemies and the players would use a NavmeshCut component to set areas they occupy as unwalkable. The behaviour I’m looking for is similar to the SingleNodeBlocker example in the Grid graph, but in my case I would use NavmeshCut instead.

In my project, player will be able to preview their move path on client-side before committing to it (similarly like during the battle mode in Divinity: Original Sin).

When a player commits to a path and sends a “move command” message to the server, this path would then be validated on the server-side. So, it’s important for the Recast graph to be synced properly between the client(s) and the server (i.e. if the pathfinding on client-side confirms that the path is doable, the exact same path should be doable on the server as well). The server has the authority over the graph updates, which would then be synced to the client(s).

So, finally to the actual question :smile: : enabling and disabling NavmeshCut components on the server-side will modify the graph data, so how can I assure that the graph stays in sync between the client(s) and the server? (i.e. what should I sync over the network?) I would prefer to sync only the bare minimum data to reduce unnecessary network traffic.

Thanks!

Hi,bro. Im doing mult RTS now, and Im facing the same problem as you.I need to sync everything in different client,Im just thought about using lock frame to sync. So if you find the path sync solution, please leave the comment , really appreciate it

Hey guys, I’m also interested in this, have you guys found out anything yet? Is it possible to use NavmeshCut with Network?

Since it is turn-based and you want to do it server authoritative, I’m not sure (maybe I don’t see something), but I don’t see the need to have any pathfinding on any client.

Just perform all the calculations on the server side (even the preview stuff; use an RPC to get the data on the client side); you can call “preview path” and, after that, a second method, which is the actual movement).

There should be a good reason to do something on the client side (on a server authoritative approach), and normally, this is because you are time-bounded (fast real-time where a few “ms” matter) or you need a really fast preview, which I believe is not the case in a turn-based game.

Send the data to the server, use the pathfinding there, and reply with the data needed to the client.

This may increase the “data” over the network a bit, but it will be a small amount, and on the other hand, it will reduce the need for most of the syncs that may be forced by having “important” stuff synced (such as the navmesh).

PS: I don’t see it was a death post; sorry for reviving it (somehow, I think it was a new one). I leave the answer in case someone finds it useful.

1 Like

The reason to do the path calculation already on the client side is that you get immediate preview of the exact path your character is going to move on. Please see the Divinity OS video I linked in the original post of what I mean. The part where you can see the movement path updating as the player moves their cursor. I get your point, but to achieve what Divinity OS does you cannot rely on getting the path data from the server due to network latency. It would just feel bad.