Files
FFF_vtt_frozen/results/m4-fog-bench.md
T
SirStone 43947d1197 feat(m4): cap map images at Full HD and shrink on import (#85)
The owner fixed the map cap at 1920 px on the long side and 1080 px on the
short side (either orientation). fff-vtt import now shrinks a larger source
with ImageMagick Lanczos before tiling (alpha kept, proportions preserved,
no upscaling), prints `scaled WxH -> WxH`, and records the shrunk w/h; a
source at or below the cap is untouched, so the pixel-identity tests still
hold. A scene row already above the cap is not rewritten: the server logs
`map_above_cap` at startup and serve prints the re-import advice.

Docs: ADR-0023, DESIGN 3.3/5.3/8/11.1/13/14, TESTING 5.3/13, README,
HANDOFF-M4, client README. The M4 phone gate and the fogbench measurement
now use the Full HD maximum; the 16384 px / 262144-cell bench and test rows
stay as labelled server stress references. import-scale now proves a 16384²
input is shrunk to 1080x1080 (289 tiles at 64 px) quickly and bounded.

Part of #63, #85. #77 is blocked by this issue.
2026-11-21 22:16:08 +01:00

61 lines
3.3 KiB
Markdown

# M4 fog measurement: 50 tokens on a Full HD map (#76, #85)
Recorded 2026-11-21 on the M4 finish tree. Command: `devbox run fogbench` (server half,
`tools/fogbench.nim`, raw log `results/m4-fog-bench.log`) and
`client/e2e/fogbench.test.mjs` (headless client half, `devbox run e2e`).
The scene is the **Full HD maximum** (1920x1080), the owner's cap of 2026-11-21 (#85, ADR-0023);
the old 16384 px map is no longer the product target.
The question this answers (spec #63, Testing notes): **does M4 need the per-token polygon cache
(build item 3) or incremental wall-edit refresh (build item 4) before the phone run?** The answer is
no: the measured move path is two orders of magnitude inside one 60 fps frame.
## Server recompute (real modules, release build)
Scene: 1920 x 1080 px, cell 32 (60 x 34 cells = 2 040), 1 875 walls (the 5k-wall generator clipped to
the Full HD height, with the 50-token cluster box cleared), 50 tokens, one controlled token with
`vision` and radius 300. This is what `main.refreshPlayer` runs for one `token.move`, plus the egress
that follows it for that player.
| Measurement | n | avg | worst |
|---|---:|---:|---:|
| vision refresh: polygon + `cellsTouched` + explored fold (1 token, 1875 walls) | 500 | **0.055 ms** | 0.448 ms |
| player egress, 50 visible tokens (`token` frames, fresh `Known` = reconnect) | 300 | **0.201 ms** | 1.673 ms |
| player egress, warm `Known` (no changes) | 2000 | 0.187 ms | 2.278 ms |
| move path total (refresh + 50-token egress) | | **0.256 ms** | |
(Brackets are run-to-run spread across the finish runs; the raw last run is in
`results/m4-fog-bench.log`.)
Budget: one 60 fps frame is 16.7 ms. The move path uses ~1 % of it. Cached per-token polygons
would save ~0.05 ms while adding an invalidation surface; **not built** (ticket AC: no
polygon-cache work unless the measurement says so). `results/bench.log` holds the current server
baselines (polygon 0.058 ms on the 5k sparse stress scene, 1.409 ms on the 5k dense stress scene)
and the explored/tile-gate numbers.
## Headless client frame cadence (correctness floor only)
Scene: the real server on the prepared Full HD scene (scene row patched before boot; only the
importer owns `w`/`h`), 50 tokens inside the sight, fog active, first viewport filled. Emulation:
412 x 869 CSS px, DPR 2.625, touch, mobile, then CDP 4x CPU throttle for the second sample.
| Measurement | value |
|---|---:|
| fog explored snapshot at connect (60 x 34 cells) | **0.7 ms** |
| explored cells in the sight | 542 |
| rAF cadence, real CPU (120 frames) | median **89.2 ms**, p95 182.2 ms |
| rAF cadence, 4x CPU (90 frames) | median **100.7 ms**, p95 213.1 ms |
**These are SwiftShader numbers, not phone numbers.** Headless Chromium in this repo renders with
the software rasteriser (no GPU), so its cadence is a floor for correctness and regression work. It
is deliberately **not a gate** (spec #63: no timing gate in the client suite). The 4096 px/50-token
run in `client/e2e/fog.test.mjs` is a synthetic stress fixture (above the product cap) and its
cadence is also recorded only.
The real 60 fps pass on the Note 10 and the laptop is **#77** and is the authority for the M4 accept.
## What was not measured here
- The actual phone GPU, thermal throttling, LAN latency and real map art: #77.
- 2000-token or 500-wall-dense scenes: outside the M4 accept target (DESIGN §13, Q2).