gschup / ggrs

GGRS is a reimagination of GGPO, enabling P2P rollback networking in Rust. Rollback to the future!

Home Page:https://gschup.github.io/ggrs_demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

decoding/encoding inputs leads to diverging gamestates

gschup opened this issue · comments

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.

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

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.