NavMesh & Multiplayer

Hi, I’m working on making AI pathfinding with NavMesh works with Multiplayer dedicated server (based on topdown template).

To make it simple, I don’t use SimpleToMove function, but rather allow client side navigation, the client is finding a path locally and use the standard AddMouvementInput with a spline I’ve built based on the path found locally.

It is an acceptable solution in a multiplayer environment or should be avoided and if so is there a good way to handle so that if the player has 500 ms, he don’t has to wait 500 ms that the server find a path with its navmesh that it returns to the client.

Thanks

1 Like

This is what AutonomousProxy is for. You can have a client that makes its movement without waiting for confirmation from the server, while the server can re-run the same calculation from the original position and tell the client of any change it needs to make to suit the server’s calculations.

Commonly referred to as net corrections.

Thanks for you answer, that’s what I thought but got an issue when implementing it. Quite new to UE4, so it might be a solution, but here’s the issue

Base on 500ms lag

T = 0ms : Player ask to go on position A by clicking => Locally goes instantly on it, no issue
T = 200ms : Player ask to go on position B by clicking => Locally goes instantly on it, no issue
T = 500 ms : Server respond to player for his T=0 request, so my player goes from position B to position A to go on position B given the path returns by the server which is now not really valid for the player.

It is an elegant way to solve it ? Or maybe I get it wrong and shouldn’t rerun the path given by the server ?
Thanks

1 Like

If you are focused on client authoritative-ness, then at 500ms I don’t really know of any elegant solution to deal with net corrections.