rameshvarun / netplayjs

Make P2P multiplayer browser games, no server hosting or synchronization code required. Powered by rollback netcode + WebRTC.
https://rameshvarun.github.io/netplayjs/
ISC License
496 stars 34 forks source link

Add Deterministic Mode for Rollback #78

Open rameshvarun opened 1 year ago

rameshvarun commented 1 year ago

NetplayJS, by default, does not assume that game code is deterministic. Instead, it corrects for drift by having the host send authoritative state updates to the other players. In rollback netcode, because the player predicts ahead, state updates trigger a rollback / replay in addition to the rollbacks from player inputs.

Lockstep has an option to disable state synchronization, but this hasn't been implemented in Rollback netcode yet.

The fix is pretty simple - don't send state updates, and don't wait for state updates to clean up old history.