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.
This commit is contained in:
+20
-11
@@ -159,8 +159,8 @@ built against glibc 2.44 while this host (NixOS) runs 2.42, so a 2.44-built `lib
|
||||
- Chunked explored, measured cost of one mutation-scale write (BEGIN; 512 B upsert; COMMIT): avg
|
||||
0.015 ms, p99 0.035 ms (DESIGN §4.3's accepted commit tail is ~20 ms), and a real move's ack stays at
|
||||
avg 0.7 ms / p99 1-2 ms with explored writes on (`tests/texplored.nim`, `tools/persistence.test.mjs`).
|
||||
Sizes: 4096 px map / 32 px cell = 16 384 cells = 2 KB (2x2 chunks); 16384 px map = 262 144 cells =
|
||||
32 KB (8x8 chunks).
|
||||
Sizes: the seeded 4096 px map / 32 px cell = 16 384 cells = 2 KB (2x2 chunks); the largest Full HD
|
||||
scene (60x34 cells) is one 512 B chunk (#85).
|
||||
- The chunk layout is pinned by `tests/texplored.nim` (exact byte/bit positions) and re-read
|
||||
independently by `tools/persistence.test.mjs`, so a refactor cannot silently swap axes or bit order.
|
||||
- Seeding the scene in migration step 3 keeps it identical on every start and lets the migration test
|
||||
@@ -211,10 +211,14 @@ built against glibc 2.44 while this host (NixOS) runs 2.42, so a 2.44-built `lib
|
||||
implementation [PROPOSED; built in M2].
|
||||
- The prototype scene the table measures has 60 walls and 8 tokens, so its numbers say nothing about
|
||||
big maps; the 5k bench scenes below are the answer.
|
||||
- Bench scenes (`tools/scenegen.nim`): the 5k target is the sparse primary layout
|
||||
`genScene(16384, 5000, 1)`: 0.082 ms avg [MEASURED, `results/bench.log`]. The dense layout
|
||||
`genScene(4096, 5000, 1)` is a stress reference (1.28 ms avg, ~207 walls in the vision bbox)
|
||||
[MEASURED]; the uniform spatial grid is revisited if real maps approach that density.
|
||||
- **Product maximum [FIXED (owner decision), 2026-11-21, #85]:** map images are capped at Full HD,
|
||||
so the largest scene is 1920x1080 (60x34 cells at cell 32). The fog measurement and the M4 phone
|
||||
gate use that maximum; numbers below at 16384 px / 262144 cells are labelled **server stress**,
|
||||
not the product target.
|
||||
- Bench scenes (`tools/scenegen.nim`): the sparse **stress** layout `genScene(16384, 5000, 1)`:
|
||||
0.058 ms avg [MEASURED, `results/bench.log`]. The dense layout `genScene(4096, 5000, 1)` is also a
|
||||
stress reference (1.409 ms avg, ~207 walls in the vision bbox) [MEASURED]; the uniform spatial
|
||||
grid is revisited if real maps approach that density.
|
||||
- **Thickness cost** [#43, DESIGN §5.10]: a thick body is a quad, and the fan costs about 10x on a dense
|
||||
scene (13.2 ms vs 1.25 ms baseline on the 5k dense layout; 0.26 ms per polygon, 3.15x, on the 5k
|
||||
sparse one). The owner accepted that and re-baselined the per-move budget [FIXED (owner decision),
|
||||
@@ -230,7 +234,8 @@ built against glibc 2.44 while this host (NixOS) runs 2.42, so a 2.44-built `lib
|
||||
a per-pass mean; the #28 shape measured 0.79 ms GM / 0.32 ms player on the reference build, 0.5-1.7 ms
|
||||
in the debug suite depending on CPU clocks). The gate allows a documented 2x around each budget
|
||||
(20 us, 4 ms) for a saturated box. The load-insensitive explored-size invariant
|
||||
`smallMs <= gmMs*3 + 0.5` (16384 vs 262144 cells) is kept on minima. Absolute averages are
|
||||
`smallMs <= gmMs*3 + 0.5` (synthetic 16384 vs 262144 cells; the Full HD product maximum is 2040
|
||||
cells, #85) is kept on minima. Absolute averages are
|
||||
*recorded*, not asserted, by `devbox run bench` (`results/bench.log`: GM egress pass 0.24 ms,
|
||||
player 0.08 ms, release build).
|
||||
|
||||
@@ -642,8 +647,9 @@ from the prototype, what was missing, what the M3 build added, and the tools it
|
||||
keeps holding.
|
||||
- `devbox run test` = Nim tests first, then Node harnesses. `devbox run client-test` = the client's
|
||||
Vitest seam (pure reducer, protocol client, envelope); `devbox run e2e` = the built client through
|
||||
the real server and vhost; `devbox run fogbench` = the 50-token 16384 px server measurement
|
||||
(`results/m4-fog-bench.log`). The finish gate (#76) runs all of them plus `mutation` and `bench`.
|
||||
the real server and vhost; `devbox run fogbench` = the 50-token Full HD (1920x1080, the max scene)
|
||||
server measurement (`results/m4-fog-bench.log`). The finish gate (#76) runs all of them plus
|
||||
`mutation` and `bench`.
|
||||
Both suites fan out files at `FFF_TEST_JOBS` (see "How to run"); no file is serialised for
|
||||
correctness, only the wall-clock gate files are run alone so their budgets stay meaningful.
|
||||
- The nine M3 accept groups and their proving harness tests are mapped in `tools/groups.mjs`;
|
||||
@@ -716,8 +722,11 @@ from the prototype, what was missing, what the M3 build added, and the tools it
|
||||
control + 80 mutations each failing at least its expected test, `devbox run bench` PASS and
|
||||
`devbox run fogbench` PASS. Evidence: `results/nimble-test.log`, `results/mutation.log`,
|
||||
`results/bench.log`, `results/m4-fog-bench.md` (+ `.log`); the e2e/client logs are regenerated
|
||||
per run and not committed. The manual Note 10 + laptop 60 fps run is **#77** and is the only
|
||||
open M4 accept item: M4 is accepted after it passes, not before. Mutation housekeeping found
|
||||
per run and not committed. The phone gate's scene is the Full HD maximum (1920x1080) [FIXED
|
||||
(owner decision), 2026-11-21, #85]; the fog-update test's 4096 px / 128x128-cell scene is a
|
||||
synthetic correctness/stress fixture above the cap, not the product target. The manual Note 10 +
|
||||
laptop 60 fps run is **#77** and is the only open M4 accept item: M4 is accepted after it passes,
|
||||
not before. Mutation housekeeping found
|
||||
here: `c1`/`c2` still patched the pre-#65 tile-gate expression and had silently become `sed`
|
||||
no-ops; both now patch `cy * sc.cols + cx in explored` and fail the tile gate group again.
|
||||
- **M4 gate harness.** (a) automated headless-Chromium test with mobile emulation (viewport, dpr, CPU
|
||||
|
||||
Reference in New Issue
Block a user