Skip to main content
1 of 3
KaareZ
  • 1.9k
  • 1
  • 19
  • 30

The simple answer is that you should not send key input, but rather their absolute position. This will make sure that the entities are always the exact same place on both your own client, other clients and the server.

To get smooth movement, you might want to consider adding additional client code that smooths it. A technique could be: If your game syncs every 50 ms(20 times a second), and the player moved 1 meter, estimate how much it should move, so that it's at the position at next sync.

KaareZ
  • 1.9k
  • 1
  • 19
  • 30