Repository navigation
Adaptive interpolation (more responsive movement for players and NPCs) - #921
Merged
miredirex merged 4 commits intoOct 11, 2026
Merged
Conversation
Remote actors were shown a fixed 300 ms behind. Each now has a `PlaybackClock` that plays the owner's timeline back by the snapshot interval plus measured jitter, using network receive times so local stutters don't inflate it. Late snapshots are briefly extrapolated and corrected smoothly; teleports snap. Snapshots carry the owner's capture tick and are relayed by the server immediately and unreliably, at most 8 actors per message: ~30 Hz for players, mounts and actors in combat, ~10 Hz for other NPCs
Owners stamp snapshots with their synchronized clock, which was resynced using the time the sync message was processed rather than when it arrived. An owner stall during a sync left their timeline behind, which froze their actors on other clients for seconds
When an NPC left combat its owner dropped from ~30 to ~10 snapshots per second, but the snapshot interval was averaged over a 3 s window, so playback kept running out of snapshots and extrapolating for 2-3 s. The interval now also takes the average of the newest 4 gaps when that is longer, which cuts the stutter to under a second with little change elsewhere.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Other players and NPCs now move more smoothly and sit much closer to real time.
Before: remote actors were always shown a fixed 0.3s in the past (regardless of actual ping), so they felt laggy. Network hiccups could also make them freeze for a few seconds.
In action, before vs after on localhost (notice the delay):
combined.webm
Simulator that was used to test different network conditions and latency: https://gist.github.com/miredirex/710941b6b75f44d36f463755d55eb478
Player-friendly changelog entry:
Improved movement sync: other players and NPCs now move more smoothly and with much less delayNote on bandwidth: