Smooth other-player movement with velocity dead reckoning

Previously other players jittered because the entity sat frozen at its
destination between movement packets, then snapped to the new start
position on the next packet (stop-pop-stop-pop at ~10 Hz).

Entity interpolation now tracks a smoothed velocity and dead-reckons
past the end of each packet window, so the entity keeps gliding at the
estimated speed until the next server update arrives. Movement stops
only after two consecutive intervals with no new packet (entity has
genuinely stopped).

Also replaced the raw packet-delta duration with an exponential moving
average (EMA) per player. A single slow or fast packet no longer spikes
the playback speed; the EMA converges on the actual send rate (~100 ms)
and absorbs jitter without adding a fixed input-latency penalty.
This commit is contained in:
Kelsi 2026-02-19 16:45:39 -08:00
parent 98ed8411e6
commit 5d84679b56
3 changed files with 50 additions and 12 deletions

View file

@ -1330,6 +1330,7 @@ private:
std::unordered_map<uint64_t, std::array<uint32_t, 19>> otherPlayerVisibleItemEntries_;
std::unordered_set<uint64_t> otherPlayerVisibleDirty_;
std::unordered_map<uint64_t, uint32_t> otherPlayerMoveTimeMs_;
std::unordered_map<uint64_t, float> otherPlayerSmoothedIntervalMs_; // EMA of packet intervals
// Inspect fallback (when visible item fields are missing/unreliable)
std::unordered_map<uint64_t, std::array<uint32_t, 19>> inspectedPlayerItemEntries_;