With the server running on the remote server and the client connected to the ethernet with a ping of ~15ms the experience is fairly smooth. Changing direction isn't instant but the transition is smooth. The group still jitters (even when moving in the same direction) but it's very local, doesn't jump back and forth too far.
ethernet ping and debug metrics
The game is also fairly smooth over wifi and consistent ~18ms ping
wifi ping and debug metrics
Changes:
Replace rewind and replay with the client playing in the past and
interpolating to game states recieved from the server stored in a fixed
size buffer. The size of the buffer is configurable through the var
CLIENT_GAME_STATE_BUFFER_SIZE in game_settings.json.
The logic for updating the local game state is as follows:
If the clients tick is too far behind (more than
MAX_BEHIND_TICK_DELTA ticks) the smallest server state in the buffer
then the local state is overwritten with the smallest server state.
If the client tick is not too far behind the smallest server state
then then a game state is interpolated for the next tick using the
smallest server state.
If the client is ahead of the smallest server state then the next
game state in the buffer is used to recalculate the current tick's
state but the tick is not incremented. This is in order to stall and
fall back behind the smallest server state. If there aren't any states
in the buffer ahead of the current tick, then the game state doesn't
change.
Add debug metrics around interpolation, ahead, behind, etc and update
the layout to be more readable
Implement hermite interpolation to be able interpolate curves rather
than straight lines given start and end velocity of the rigid bodies.
Send collision events in game state updates. This was necessary
because we no longer extrapolate, we only interpolate, which means we no
longer run the physics simulation locally and can't trigger visuals
caused by collisions. The events recieved from the server are now
applied and trigger collision animations. This introduced a visual bug
(issue #214).
Reduce server input window sleep to 16ms to make the client and server
ticks/sec in sync. This is a messy dependency, it just so happens that
the server sleeps for that window causing it to control it's steps per
second. Not really a good way to control tick speed and the client and
server tick speeds goes out of sync as more clients connect. We might
need to implement some clock sync in the future.
Seems like this change also broke the winner being displayed on the
client (issue #215).
Description
With the server running on the remote server and the client connected to the ethernet with a ping of ~15ms the experience is fairly smooth. Changing direction isn't instant but the transition is smooth. The group still jitters (even when moving in the same direction) but it's very local, doesn't jump back and forth too far.
ethernet ping and debug metrics
The game is also fairly smooth over wifi and consistent ~18ms ping
wifi ping and debug metrics
Changes:
Fixes
Fixes #X