Settings

Theme

Ask HN: What is the best way to handle latency in a simple multiplayer game?

6 points by datafix 6 years ago · 2 comments · 1 min read

Reader

I'm making a multiplayer game. I'm just about done. I've got the mechanics worked out, I just need to handle latency in some way.

The game: tron lightcycles, but to turn, the user must solve a math problem.

What I've tried:

   1. Update game state for every player every time either player changes direction. Why didn'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'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't share the instance between the two
Stack: Python/Django, PostgreSQL, javscript/jquery

I need help. Can anyone help?

choma 6 years ago

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

uvw 6 years ago

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

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection