google / google/codeworld

Could use better time synchronization for game API

Aperta
#431 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Haskell
Stelle
1.3k
Fork
201
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Currently, game clients are synchronized relative to the moment they receive the "game started" message from the game server. If that one packet is delayed (by a TCP drop and retransmit, for example), a client will persistently remain behind the others in time. That means other clients will appear jerky, as they keep going back to add events in the more distant past, then replaying their own events from that point. In fairness terms, the lagged client gets an unfair advantage, as it receives other players' events in the future before they actually occur, but other clients don't see its own events until well after they occur.

To fix this, we should add some kind of NTP-like time management code to revise each client's current timestamp toward a consistent value regardless of any original discrepancy. (But keep in mind that it's critical for correctness that time is monotonic, so we can never decrease a client's timestamp; only slow its rate of increase to allow other clients to catch up.)

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.