Repository navigation
feat: add buffered snapshot interpolation - #146
Merged
Merged
Conversation
Timerk
force-pushed
the
feat/netcode-ticks
branch
from
November 26, 2026 19:21
8a63bb0 to
28d2af0
Compare
SnapshotBuffer keeps a remote entity's transforms by server tick and samples them at a render tick: Hermite interpolation between bracketing samples, linear extrapolation for at most 250 ms, then hold. ServerClock estimates server time from the median snapshot offset over 2 s and slews the render time, 100 ms behind it, by at most 5%. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remote pilots and aliens are drawn at the render time each physics tick instead of lerping toward the newest snapshot. Buffers clear on spawn, despawn, new lives, map changes, dock and launch, and alien resets; late packets of the same life still fill gaps. Lasers and explosions anchor to the drawn ships. Network schema 25. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…overlay Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fold the interpolation readings into one line and clock drift into the jitter line, so the overlay still fits at 960x600. Loosen the relay test's acceleration bound for the 60 fps suite runner. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Timerk
force-pushed
the
feat/snapshot-interpolation
branch
from
November 26, 2026 19:21
7c9933a to
7f7ec31
Compare
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.
Phase 3 of the real-time netcode rework (
GAME_PLAN.md, Real-time netcode rework).Stacked PR. Dependency chain: #144 (
feat/network-simulator) → #145 (feat/netcode-ticks) → this PR. Merge in that order. After #145 merges, retarget this PR tomain.Behaviour
Remote pilots and aliens no longer lerp toward the newest snapshot. They are drawn about 100 ms in the past, between buffered server-tick snapshots.
SnapshotBuffer(scripts/snapshot_buffer.gd): one per remote entity. It holds up to 32 transforms keyed by server tick, in tick order, so out-of-order packets still fill gaps; stale and duplicate ticks are ignored.MAX_EXTRAPOLATION_TICKS), then holds.ServerClock(scripts/server_clock.gd): estimates server time from the median offset (snapshot tick / 60 minus arrival time) over the last 2 s.INTERPOLATION_DELAY(100 ms, a playtesting setting).FlightSession.drawn_point), so beams join the drawn ships.NetStats: interpolation delay, buffer depth min/mean, extrapolated share, underruns and clock drift.Results
docs/netcode-baseline.mdhas the full before/after table. Before is the phase 2 build running the same extended benchmark. The machine was heavily loaded by unrelated jobs during these runs (13–38 fps with 3 extra clients), and both builds ran under the same load.Tests
tests/snapshot_buffer_test.gd: bracketing, shortest-path angles, out-of-order and duplicate ticks, capacity, the extrapolation cap and hold, reset, and clock stability under ±30 ms jitter with 5% loss (no snaps, time-scale within ±5%, within 30 ms of ideal). Also checks latency-rise slewing and stall snapping.tests/interpolation_network_test.gd: an observer at 150 ± 30 ms with 5% loss through the relay watches a moving, turning pilot. It bounds the render-time error against the server's path, drawn acceleration against the server's, the spike share and the extrapolated share. It also replays the old per-tick lerp from the same packets and asserts that the lerp stutters (about 80% spike ticks). Finally it checks that buffers clear on leave and disconnect.rpc_compatibility_testnow expects schema 25, andautopilot_testdraws aliens at the newest tick../tools/dev.ps1 check: 73 of 75 scripts passed in the full run.dedicated_server_test(an admission timeout) passed when rerun on its own.net_simulator_test"Lowering latency while running takes effect immediately" (a 12 ms raw-UDP timing tolerance) fails under the current machine load on the unmodified phase 2 base as well, 3 runs out of 3. It passes on an idle machine. Phase 3 does not touch the relay or that test.Known limitations
🤖 Generated with Claude Code