Add M10.7a tick clock and remote-marker interpolation
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (ecs) (push) Successful in 1m59s
Foundation / checks (client) (push) Successful in 12m44s
Foundation / checks (network) (push) Successful in 12m45s
Foundation / checks (tsan) (push) Successful in 8m5s
Foundation / checks (checks) (push) Successful in 32m4s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 21m38s

ADR-0095 (presentation only): a drift-corrected monotonic tick clock that
never runs more than one tick past the newest observation; remote probe
markers shown 2-6 ticks behind (adaptive to snapshot gaps), interpolated,
extrapolated for at most 2 ticks and then marked stale; appearance and
removal at their snapshot ticks; organisms never extrapolated; sub-tick
own-marker prediction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-06 17:16:20 -04:00
co-authored by Claude Opus 5.5
parent 61d899de3c
commit 90cdb61e30
12 changed files with 539 additions and 5 deletions
+3 -1
View File
@@ -531,7 +531,9 @@ probe) with process evidence done; 10.5c engineering client switched to M10 sess
10.6 split (ADR-0094, EXPERIMENT probe marker, not an organism movement rule): 10.6a shared
probe-motion-v1 rule, server markers, session protocol v3 marker records and the client
predictor done; 10.6b wiring (sessions, evo-server, probe, GUI marker) done; 10.6c impaired
traces done (networking/M10_PREDICTION_TRACES.md). 10.7-10.9 planned.
traces done (networking/M10_PREDICTION_TRACES.md). 10.7 split (ADR-0095): 10.7a tick clock,
remote-marker interpolation and fractional prediction done; 10.7b client wiring, loss view
and two-client trace follow. 10.8-10.9 planned.
**Entry:** M9 client/session evidence and M7/M8 dev/stage durability. Read
NETWORK_ARCHITECTURE, PERSISTENCE_ARCHITECTURE and ADR-0017. The M9 transport is
+4 -2
View File
@@ -59,8 +59,10 @@ M10.6b wires it: evo-server gives every session a marker in the habitat area, th
prints it, and the engineering client predicts and draws it (WASD), following it with
camera and interest. M10.6c traces it through the impairment relay: exact without loss,
94-99 % exact at 60-200 ms RTT with 2-5 % loss, convergence after stopping and a restart
resync of about 2-3 s (networking/M10_PREDICTION_TRACES.md). M10.6 is complete. Next: M10.7
interpolation and session loss.
resync of about 2-3 s (networking/M10_PREDICTION_TRACES.md). M10.6 is complete. M10.7a (ADR-0095) adds a drift-corrected tick clock, adaptive
interpolation of remote markers (2-6 ticks behind, at most 2 ticks extrapolated, then
stale; organisms never) and sub-tick own-marker presentation. Next: 10.7b client wiring,
the stale loss view and a two-client trace.
## Previous gate - 2026-10-02
@@ -0,0 +1,57 @@
# ADR-0095: M10 tick clock, remote interpolation and session loss
## Status
Accepted for M10.7 (2026-10-06). Decisions confirmed with the maintainer on 2026-10-06:
- an adaptive interpolation delay of 2-6 ticks;
- remote markers extrapolate at most 2 ticks, and organisms never;
- on session loss the last view stays frozen, dimmed and labelled stale, and a reconnect
starts from a fresh baseline;
- a drift-corrected client tick clock, with sub-tick presentation.
Delivery: 10.7a the headless clock, interpolator and fractional prediction (this text);
10.7b engineering client wiring, the loss view and a two-client trace. Each segment amends
this ADR. Presentation only: none of it is authority, and no outcome is invented.
## Context
NETWORK_ARCHITECTURE requires remote entities to interpolate buffered snapshots with
bounded extrapolation, loss to request a fresh baseline, and death, mutation and
reproduction to remain server decisions. M10.6 (ADR-0094) predicts the own probe marker at
whole ticks. Other markers are drawn as last replicated, so they step at 20 Hz and jump
when a snapshot is lost. No controllable organism moves yet.
## Decision (10.7a)
- **Tick clock** (`include/evo/client/interpolation.hpp`). Each observed server tick
(watermark or snapshot) slews a local estimate by 10 % of the error. An error beyond 4
ticks snaps forward. The estimate is monotonic between resets and never more than one
tick beyond the newest observation, so a silent or paused server freezes it rather than
inventing time. Assumes 50 ms ticks; drift of ±4 % stays within 1.5 ticks in tests.
- **Remote markers** are presented at `clock - delay`, interpolated linearly between the
buffered snapshots around that tick (at most 16 snapshots).
- A marker appears at the tick of the snapshot that adds it.
- It is shown unmoved until the tick of the snapshot that removes it: never moved toward
a removal.
- Snapshots more than 8 ticks apart are not interpolated across.
- Reordered or duplicate snapshots are ignored.
- Beyond the newest snapshot the replicated held vector continues for at most 2 ticks;
then the marker freezes there and is marked stale.
- **Adaptive delay.** The target is the 90th-percentile gap between received snapshots
(last 40) plus one tick, within 2-6. The delay rises toward it at 2 ticks/s and falls at
0.5 ticks/s.
- **Organisms** are never extrapolated or interpolated: they are shown as replicated (newest
snapshot, ADR-0093). A dead or removed organism is therefore never shown moving or as
present after its removal.
- **Own marker between ticks.** `MotionPredictor::predict_between(tick, fraction)`
interpolates the prediction between two whole ticks for presentation. Error measurement
still records whole ticks.
## Alternatives considered
- A fixed 2- or 3-tick delay: simpler, but either stutters on lossy links or adds latency
on good ones.
- No extrapolation: visible stalls on every lost snapshot.
- Longer extrapolation (4 ticks): larger errors when a remote changes direction.
- Clock from the local timer only: drifts without bound against the server's pacing.
## Consequences
- Remote markers are shown 100-300 ms in the past, the own marker in the predicted
present. That is the usual split; interactions that need both are later work.
- Extrapolated or stale markers are flagged so the client can draw them differently.
+32
View File
@@ -4603,3 +4603,35 @@ The Postgres suite was not rerun: no server code changed since 10.6b.
Not done:
- traces over the dev route (a v3 server must be deployed first);
- many-client load (10.8).
## 2026-10-06 — M10.7a tick clock and remote interpolation (ADR-0095)
Implemented:
- `TickClock` (slew 10 %, forward snap beyond 4 ticks, monotonic, at most 1 tick beyond the
newest observation);
- `MarkerInterpolator`:
- interpolation, then at most 2 ticks of extrapolation, then stale;
- appearance and removal at their snapshot ticks;
- reordering ignored; no interpolation across gaps over 8 ticks;
- adaptive delay of 2-6 ticks from the 90th-percentile gap;
- `MotionPredictor::predict_between`.
Tests (`tests/network_interpolation.cpp`):
- clock basics: freeze while silent, no backward step, forward snap, reset;
- drift with jitter at 0 % and ±4 % (4,000 ticks): within 1.5 ticks, monotonic, no snaps;
- interpolation, removal, appearance, extrapolation and staleness, reordering, long gaps,
reset;
- adaptive delay up and down;
- fractional prediction.
Executed:
- **Linux GCC 14:**
- preset `quic`: 4/4;
- `client-network`: 15/15.
- **Linux Clang 19:** ASan/UBSan `evo-network-tests`, and clang-tidy 19 on the new sources
and tests (after fixing one optional-access finding).
- **Windows MSVC 19.44:**
- preset `quic`: 4/4 (rebuilt after the fix);
- `client-network`: 13/13.
Not done: client wiring, the loss view and the two-client trace (10.7b).