netplayjs
netplayjs copied to clipboard
Add Delay-based Netcode
Lockstep netcode allows you to synchronize a deterministic game over the network even if you cannot serialize / restore it. This is used in the physics demo. However lockstep is not really practical, since a stall-free experience requires latency < timestep
.
Delay-based netcode adds input delay to allow additional time for inputs to resolve.
I think the best move is to add this as a new class. Trying to implement delay as a parameter to LockstepNetcode
could make the lockstep code too complicated.
I think input delay would also be useful to apply to rollback netcode, in my opinion about 2 frames of input delay usually makes rollback a better experience. Without a few frames of input delay, player will see more 'warping'.