Skip to content

Adaptive interpolation (more responsive movement for players and NPCs) - #921

Merged
miredirex merged 4 commits into
tiltedphoques:devfrom
miredirex:feat/adaptive-interpolation
Oct 11, 2026
Merged

miredirex merged 4 commits into
tiltedphoques:devfrom
miredirex:feat/adaptive-interpolation

Conversation

@miredirex

@miredirex miredirex commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

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 delay


Note on bandwidth:

If bandwidth ever becomes a problem, the easiest savings are:

  1. Delta-encode the animation variables against the last snapshot. Most of the ~120 bytes are animation floats that hardly change between frames. Because movement is unreliable, this needs either acks for which snapshot the other side has, or a full keyframe every N snapshots. That could easily halve the size.
  2. Lower the send rate for actors that are far away from the receiving player, not just for idle ones.
  3. Skip snapshots for actors that haven't moved. Standing NPCs currently still send 10 times a second.

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.
@miredirex
miredirex merged commit fb847a8 into tiltedphoques:dev Oct 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant