You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR #213 introduces a bug where a collision event causes mine to appear to be mined twice in a quick visual glitch.
This happens because now that the client is just interpolating, it no longer computes collisions locally. In order for the appropriate visual side effects of a collision event occur (such as the collision animaton), the server now sends events along with the game state. The callbacks for this event are then triggered on the client. This was done to trigger the collision animation but the "mine" callback also triggers. This causes the mine to lose a resource. Since the server already sent the mine with the updated number of resources we are now showing the state where the mine was mined twice. In the next frame this is likely to get corrected when we interpolate again but this causes a quick visual glitch.
A solution could be to have distinct callback subscriptions on the server and the client. That way the client can just subscribe the animation callback and not the "mine" one.
The text was updated successfully, but these errors were encountered:
- 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).
- Minor code cleanup.
PR #213 introduces a bug where a collision event causes mine to appear to be mined twice in a quick visual glitch.
This happens because now that the client is just interpolating, it no longer computes collisions locally. In order for the appropriate visual side effects of a collision event occur (such as the collision animaton), the server now sends events along with the game state. The callbacks for this event are then triggered on the client. This was done to trigger the collision animation but the "mine" callback also triggers. This causes the mine to lose a resource. Since the server already sent the mine with the updated number of resources we are now showing the state where the mine was mined twice. In the next frame this is likely to get corrected when we interpolate again but this causes a quick visual glitch.
A solution could be to have distinct callback subscriptions on the server and the client. That way the client can just subscribe the animation callback and not the "mine" one.
The text was updated successfully, but these errors were encountered: