gschup / ggrs

GGRS is a reimagination of GGPO, enabling P2P rollback networking in Rust. Rollback to the future!
Other
520 stars 25 forks source link

decoding/encoding inputs leads to diverging gamestates #1

Closed gschup closed 3 years ago

gschup commented 3 years ago

When running the P2P BoxGame example, the clients eventually desync, with the spectator desyncing much easier than the two players. Since the BoxGame SyncTest is running absolutely rock-solid, I assume it has to to with the transmission of the inputs.

gschup commented 3 years ago

The spectator desyncs on it's own while the players only desync when abruptly changing windows. I suspect these might be two separate issues.

gschup commented 3 years ago

The solution:

There is a timewindow in which one client sent an input ack, but the other did not receive that ack yet. If more input is sent in that time frame, it will be encoded/decoded with different reference inputs.

The quick solution: such inputs will be dropped until we can ensure that the encoding/decoding is matching.

In the future, one could reduce network usage by keeping more reference inputs to decode with.