Files
aevolution/docs/networking/M10_PREDICTION_TRACES.md
T
dingoandClaude Opus 5.5 5728e7682e
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m55s
Foundation / checks (client) (push) Successful in 12m27s
Foundation / checks (network) (push) Successful in 12m46s
Foundation / checks (tsan) (push) Successful in 7m59s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 25m13s
Foundation / checks (postgres) (push) Canceled after 12m48s
Wire M10.7b interpolation and the stale loss view into the client
ADR-0095. The engineering client times presentation with the tick clock:
its own marker between ticks, other markers interpolated a few ticks behind
(grey when stale). Silence beyond 3 ticks and long-gap holds are stale. A lost
session leaves its last view frozen and labelled stale until the reconnect's
fresh baseline; nothing is predicted or sent meanwhile.

evo-motion-trace --remote measures remote-marker error between two clients
through the relay, with a 1.5 s outage (motion-trace-remote-smoke CTest).
Prediction errors are recorded only for ticks inputs are scheduled for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 17:50:41 -04:00

107 lines
6.1 KiB
Markdown

# M10.6c probe-marker prediction traces (2026-10-06)
Development reference for ADR-0094 (EXPERIMENT: a probe marker, not organism movement).
Tool: `evo-motion-trace` (tools/network/motion_trace.cpp, preset `client-network`).
## Setup
- The engineering client's own session code (`apps/evo-client/remote_session.hpp`: the
predictor, adaptive lead, resend, smoothing).
- A loopback region simulating at 50 ms in real time, with RegionSessions and probe
markers.
- The owned UDP impairment relay with the same impairment in both directions (seed 0xE6).
- Script: a new direction every 0.4-1.1 s from 9 choices (including stop) for 20 s. Then
stop and require convergence: nothing in flight and the presented (smoothed) marker
exactly on the authoritative position.
- The `rtt120-loss2` profile then advances the epoch: the session reconnects with its next
grant after the client's 2 s pause, and resync is measured until the prediction matches
the respawned marker.
- Error: one sample per authoritative snapshot of the own marker. It is the distance
between what the client predicted for that tick and what the authority reported.
Corrections are the jumps that rebasing made to the presented position.
## Results (Linux GCC 14 release, WSL2, one run)
| Profile | RTT ms | Jitter ms | Loss | Samples | Exact | p95 mm | p99 mm | max mm | Corrections | Refused | Dropped | Resends | Final lead | Max pending | Converged |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| clean | 0 | 0 | 0 % | 400 | 100 % | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | yes |
| lan | 20 | 2 | 0 % | 400 | 100 % | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | yes |
| rtt60-loss2 | 60 | 5 | 2 % | 378 | 97.9 % | 0 | 369.5 | 799.9 | 3 | 2 | 3 | 3 | 4 | 1 | yes |
| rtt120-loss2 | 120 | 10 | 2 % | 279 | 99.3 % | 0 | 0 | 200.0 | 1 | 2 | 2 | 2 | 2 | 1 | yes |
| rtt200-loss5 | 200 | 20 | 5 % | 358 | 94.1 % | 100.0 | 500.0 | 989.9 | 6 | 5 | 7 | 6 | 7 | 2 | yes |
Windows MSVC 19.44 (same tool, one run):
- clean and lan: 100 % exact.
- rtt60-loss2: 99.5 % exact, max 200 mm.
- rtt120-loss2: 98.6 %, max 500 mm; resync 2,498 ms.
- rtt200-loss5: 94.3 %, p95 100 mm, p99 600 mm, max 1,399.8 mm, lead 7, max 2 pending.
- All profiles converged.
Restart (rtt120-loss2): resync took 2,946 ms, almost all of it the client's reconnect pause
(2 s) and login. The smoke profile (6 s of rtt60-loss2 plus a restart) passed three runs in a
row: 95.9-98.3 % exact, resync 2,241-2,248 ms.
## Reading
- Without loss every prediction is exact: the rule is shared and integer-exact, and inputs
are scheduled far enough ahead.
- Errors come from inputs that did not take effect: lost datagrams (dropped) or arrivals
after their tick (refused, which also raises the lead). Each costs at most the motion
until the resend lands: 100 mm per tick, so up to about 1.4 m at 200 ms RTT with 5 % loss
(two losses in a row). Smoothing hid
every correction (no snaps above 2 m).
- The input list stayed tiny (at most 2 pending), far below its bound of 32. Replay depth
equals the lead plus the snapshot age.
- The lead adapts upward on refusals (7 at 200 ms RTT) and back down when receipts show
spare ticks. At 120 ms it ended at 2 after recovering; occasional refusals stay bounded
by the resend rule.
- Figures are single runs on one machine with wall-clock pacing: indicative, not
acceptance thresholds. The CTest `motion-trace-smoke` checks only convergence,
boundedness and a majority of exact predictions.
## Not measured
- Remote-entity interpolation (10.7).
- Many clients at once (10.8).
- Real links (dev route); deferred until a v3 server is deployed.
- Sub-tick presentation: the marker steps at 20 Hz.
## M10.7b remote interpolation (2026-10-06, ADR-0095)
`evo-motion-trace --remote`. Two clients, each behind its own relay with the profile's
impairment. A moves with the script; B shows A's marker interpolated. Every 10 ms B's
presented position is compared with A's authoritative path, interpolated linearly at B's
render tick (clock minus delay). Midway through the 20 s, B's link is cut for 1.5 s
(outage). "Current" excludes markers shown as stale.
| Profile | Samples | p99 mm (all) | max mm (all) | Current p99 mm | Current max mm | Extrapolated | Stale | Mean delay (ticks) | Outage shown stale | Recovered ms |
|---|---|---|---|---|---|---|---|---|---|---|
| clean | 1705 | 0 | 2,514.0 | 0 | 0 | 0 % | 0.8 % | 2.00 | 89.9 % | 156 |
| lan | 1706 | 0 | 2,518.7 | 0 | 0 | 0 % | 0.8 % | 2.00 | 89.3 % | 160 |
| rtt60-loss2 | 1704 | 0 | 2,598.8 | 0 | 0 | 0 % | 0.8 % | 2.00 | 89.9 % | 154 |
| rtt120-loss2 | 1700 | 87.6 | 2,977.8 | 60.7 | 100.0 | 0 % | 2.8 % | 2.98 | 86.3 % | 510 |
| rtt200-loss5 | 1696 | 2,811.5 | 2,862.4 | 22.0 | 83.0 | 2.5 % | 5.3 % | 2.11 | 84.2 % | 950 |
- Markers shown as current are within about 0.1 m of the true path at their render tick.
Linear motion between snapshots is exact; errors come from direction changes within a
gap.
- The large all-sample maxima come from the long-gap rule after the outage: the
pre-outage position is held until the first post-outage snapshot's tick. Those frames
are flagged stale and drawn grey, never presented as current.
- During the outage the marker is shown stale after the 150 ms grace (the clock freezes
one tick past the last observation; silence beyond 3 ticks is stale). The ~10 % of
outage samples that are not yet stale are that grace.
- Recovery (the first non-stale frame after the link returns) takes 150-950 ms. It grows
with RTT and loss: the next snapshot must arrive, and the delay must cover it.
- Variance: in one of three smoke runs (rtt60-loss2, 8 s), 32 % of samples were
extrapolated and 36 % stale, while current errors stayed at 0 mm. That is consistent
with snapshot datagrams being dropped under congestion while watermarks still arrived;
the adaptive delay rose only to 2.23 ticks on average. The other two runs matched the
table.
Prediction rerun after the M10.7 changes (own marker presented between ticks; errors
recorded only for ticks inputs are scheduled for):
- clean: 100 % exact.
- lan: 99.8 %.
- rtt60-loss2: 99.5 %.
- rtt120-loss2: 97.1 %; resync 2,500 ms.
- rtt200-loss5: 94.2 %; max 1,293.3 mm.
All profiles converged.