Wire M10.7b interpolation and the stale loss view into the client
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

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>
This commit is contained in:
dingo
2026-10-06 17:50:41 -04:00
co-authored by Claude Opus 5.5
parent 90cdb61e30
commit 5728e7682e
17 changed files with 651 additions and 210 deletions
+7 -4
View File
@@ -35,12 +35,15 @@ class TickClock {
[[nodiscard]] std::uint64_t snaps() const noexcept {
return snaps_;
}
// Ticks of local time since the last observation (nothing before the first): a silent
// server freezes the clock, so silence itself is what marks views stale.
[[nodiscard]] std::optional<double> silence(Clock::time_point now) const;
private:
[[nodiscard]] double raw(double base, Clock::time_point now) const;
TickClockLimits limits_;
std::optional<double> base_tick_;
Clock::time_point base_time_{};
Clock::time_point base_time_{}, seen_{};
std::uint64_t newest_{};
double returned_{};
std::uint64_t snaps_{};
@@ -51,9 +54,9 @@ class TickClock {
// snapshot a marker continues its replicated held vector for at most `max_extrapolation`
// ticks, then freezes and is marked stale. A marker appears at the tick of the snapshot that
// added it and disappears at the tick of the one that removed it (never interpolated toward a
// removal). Snapshots further apart than `max_gap` are not interpolated across (the newer
// one is shown from its tick). The delay adapts to the observed gaps between received
// snapshots (lost or late ones), within [min_delay, max_delay].
// removal). Snapshots further apart than `max_gap` are not interpolated across: the older is
// held, marked stale, until the newer one's tick. The delay adapts to the observed gaps between
// received snapshots (lost or late ones), within [min_delay, max_delay].
struct InterpolationLimits {
double min_delay{2}, max_delay{6}; // Ticks (ADR-0095).
double max_extrapolation{2}; // Ticks beyond the newest snapshot.
+6 -2
View File
@@ -55,11 +55,14 @@ class MotionPredictor {
// nothing before the first authoritative state.
[[nodiscard]] std::optional<network::motion::State> predict(std::uint64_t tick);
// M10.7 (ADR-0095): the position `fraction` (0..1) of the way from tick to tick + 1, for
// presentation between ticks; records the prediction for `tick` like predict().
// presentation between ticks. With `record`, the prediction for `tick` is kept to measure
// errors like predict(); a caller presenting beyond the tick it schedules inputs for passes
// false (inputs for that tick may still come).
struct Point {
double x{}, y{}; // Micrometres.
};
[[nodiscard]] std::optional<Point> predict_between(std::uint64_t tick, double fraction);
[[nodiscard]] std::optional<Point> predict_between(std::uint64_t tick, double fraction,
bool record = true);
// The jump rebasing made to the newest prediction (old minus new), since the last call.
struct Offset {
std::int64_t x{}, y{};
@@ -82,6 +85,7 @@ class MotionPredictor {
}
private:
[[nodiscard]] std::optional<network::motion::State> predict(std::uint64_t tick, bool record);
[[nodiscard]] std::optional<network::motion::State> replay(std::uint64_t tick);
// Re-predicts the newest presented tick after a change and accumulates the jump.
void rebase(const std::optional<network::motion::State>& before);