
Ask HN: What is the best way to handle latency in a simple multiplayer game? - datafix
I&#x27;m making a multiplayer game. I&#x27;m just about done. I&#x27;ve got the mechanics worked out, I just need to handle latency in some way.<p>The game: tron lightcycles, but to turn, the user must solve a math problem.<p>What I&#x27;ve tried:<p><pre><code>   1. Update game state for every player every time either player changes direction. Why didn&#x27;t it work? Not the best way to handle it (also got that math wrong somewhere, and the undraw function would leave gaps in player trails)
   2. Update game state for every player every 100ms. Why didn&#x27;t it work? Player 1 and player 2 are running different instances of the class that is supposed to update game state, and I can&#x27;t share the instance between the two
</code></pre>
Stack: Python&#x2F;Django, PostgreSQL, javscript&#x2F;jquery<p>I need help. Can anyone help?
======
choma
Here [1], Ricky "Infil" Pusch explains the two more used methods to workaround
lag in fighting games. I'm not sure if this will be useful in your case, but
it's a great read anyway. I'm not a gamer but really enjoyed reading it.

[1]:
[http://ki.infil.net/w02-netcode.html](http://ki.infil.net/w02-netcode.html)

------
uvw
I would first find out source of your latency problem. Unless you can diagnose
the problem first, you can't fix it.

