diff --git a/docs/DEVLOG.md b/docs/DEVLOG.md index 2e47009..d1c8f58 100644 --- a/docs/DEVLOG.md +++ b/docs/DEVLOG.md @@ -558,3 +558,85 @@ N3 (#34, prediction, reconciliation and interpolation, starting with the self bl and a client-side match that runs from `NetClient` and `SnapshotReceiver`), then N5 (#36) and N4 (#35). To make Monday, v0.6 has to be cut to its high-priority issues, and A3, A7, A12 and A13 deferred. + +## 2026-11-12 (late morning): N3 and N4 + +**Start of run:** clean tree, fast-forward pull was a no-op. The Agents category had +nothing newer than 2026-11-11 and nothing for this task; nothing posted. + +**Done:** +- N3 (#34): the client's side of a match, in `src/net/`. `ClientGame` takes notices + and snapshots and answers with commands; `ClientClock` decides which tick a command + is for; `ClientPrediction` runs each command on a copy of the client's own player + and reconciles with the server; `SnapshotInterpolator` draws everyone else in the + past. Snapshots carry the client's own block (37 bytes, exact). Protocol version 2. +- N4 (#35): lag compensation. Commands carry `view_lag`; `HitHistory` keeps 15 ticks + of where every body was; hitscan shots are judged against the moment the shooter + saw. Commands are 15 bytes; command log version 2. +- Opened N10 (#77, v0.5, high): no client program exists yet. `ClientGame` is driven + by tests only and `MatchView` still reads a local server's simulation. + +**Tests:** `make check` passes on the pushed tree: 426 tests, self-check and smoke +(p99 2.3 ms with 24 bots). `make match` replays to the same hash. Numbers, all from +a simulated link, headless: +- Prediction, 100 ms each way, 20 ms jitter, 2% loss, two players through the drop + and 75 s of ground play on a real island: about 1,415 snapshots compared per client + and none corrected. The other player was drawn 0.4 mm on average from where a + perfect link would draw them (max 13 cm, after a lost snapshot), 9 mm from the + server's position at that moment. +- 150 ms each way, 40 ms jitter, 10% loss: 3 and 7 corrections, at most 22 cm, all + blended. +- Lag compensation, a client firing once a second at a walking target as drawn: 41 + of 41 hits at 50, 100 and 200 ms round trips; 0 of 41 with the lag ignored; 0 of 41 + at 500 ms, past the cap. +- 24-player match start: 4.1 KB/s per client on average, worst 4.3, against 40. + +**Found:** N2 sent a snapshot every third tick. At 30 ticks a second that is 10 a +second, not the 20 its code comments, the architecture document and my last entry +said. The byte rates reported then were right per second; the rate was mislabelled. +Snapshots now go every second tick, 15 a second, the nearest even spacing, and +everything says 15. + +**Decisions and what I learned:** +- The own block is 32-bit floats because that is what a `Vector3` holds, so the + client can start from the server's state to the bit. With the same code, ground and + commands, the prediction then equals the server's result exactly, and "no + correction" is an equality test, not a tolerance. The water level is a double for + the same reason: it is one on the server. +- The client plans the barge route itself: `Drop.plan` on a fresh `SimRng` of the + match seed at tick 0 gives the server's route, so the ride and the leap are + predicted too. A test checks the two routes match. +- The client gets the flood as nine bits: which cells around the player the water + reaches. A basin still filling after a breach counts as dry. +- The command clock uses no round-trip measurement. The server echoes the newest + command tick it has *received* (it used to be the newest it had taken), and the + client holds three commands waiting. It jumps only after two late reports running: + jumping on one made a 10%-loss link lurch five times in 90 s. +- Interpolation delay is 4 ticks (133 ms), two snapshots at 15 a second. The drawing + clock is steered by a smoothed error, at most 10% fast or slow; it ran between 0.489 + and 0.511 ticks a frame through the jitter. +- `view_lag` is in the command, not beside it, because the simulation takes nothing + but commands and a seed, and a replay has to judge shots the same way. +- A view only moves forward. A client whose lag suddenly grows is judged a little + late for as many ticks as it grew. That is the price of nobody being able to pick + between the past and the present per shot. +- `Callable.bind()` appends its arguments after the call's own. +- A lambda that captures the object it is stored on is a reference cycle and leaks. + Clear the callable when done. +- After adding a `class_name`, run `make import` before running one test file, or + the new name isn't known. + +**Known gaps:** there is no client program (#77). Built pieces, broken props, loot +and inventory aren't replicated (N5), so a client is corrected near built pieces and +has nothing to show in a HUD. Projectiles and the boathook aren't lag-compensated. +A round trip much over 300 ms is past the compensation cap. A forward jump of the +command clock predicts several ticks in one frame, which would show as a lurch; it +happened once per client, on the barge. Building 24 snapshots takes about 5.4 ms and +now happens every second tick (H1). Nothing here has been felt by a person. + +**Pace:** v0.4 still has M6 and M7 open (deferred), so no tag. v0.5 was due last +night: N1 to N4 done; N5, N6, N7, N8, N9 and N10 open. More than a day behind, four +days left. Next: N5 (#36, replicating structures, props, loot and inventory, with +optimistic placement), then N10 (#77), which is what makes multiplayer something a +person can start, then N6 (#37). To make Monday, v0.6 has to be cut to its +high-priority issues, and A3, A7, A12 and A13 deferred.