1
\$\begingroup\$

I'm starting to create a multiplayer online game, with an authoritative server. As it is, the clients send inputs to the server which do the simulation and then send back to clients the updated state. The game is a top-down shooter, so it's fast-paced and input lags are not allowed here, so to avoid this I'm doing the simulation on the client too, and when the server update come back I compare the local simulation with the server response. If they are compatible everything is fine, otherwise, the client version is corrected.

I was expecting that the client simulation desync at some point, because of all of the variables on physics, floating points, network etc... But this happens much more than I thought.

Just by sending the inputs and simulating on the server, the results are very different, even on simple movements, like forwards and backwards on a clear space.

Green is local, red is server response

Green is local, red is server response

I need help on this step, a way of keeping, at least this kind of simple movement, consistent on the server and the clients.

\$\endgroup\$

closed as off-topic by DMGregory Feb 16 at 13:00

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about debugging a problem must provide a minimal, complete, verifiable example of the issue so that readers can diagnose it without needing to guess, read all of your code, or engage in extensive back-and-forth dialog. For more information, see this meta thread." – DMGregory
If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\begingroup\$ Can you show us your code for processing/transmitting player input and moving these objects? \$\endgroup\$ – DMGregory Feb 12 at 20:03
  • \$\begingroup\$ did you use transform photon view component? please add more detail as @DMGregory mentioned please share your code.any way this article will help you \$\endgroup\$ – Seyed Morteza Kamali Feb 14 at 15:52