M4: cap map images at Full HD (auto-shrink on import) #85

Closed
opened 2026-11-21 21:38:34 +01:00 by SirStone · 2 comments
Owner

Part of #63

Owner decision (FIXED, 2026-11-21)

Map images are capped at Full HD: at most 1920 px on the long side and 1080 px on the short side, either orientation. The import shrinks a larger image automatically, keeping proportions, and prints what it did (scaled 4000×3000 → 1440×1080). Smaller images are imported as-is (no upscaling).

Examples: 4000×3000 → 1440×1080, 16384×16384 → 1080×1080, 1921×1080 → 1920×1079.

Reason: a 16384 map meant ~30k tiles at 32 px / minutes / ~1 GB VRAM for a zoomed-out GM. The owner chose the simplest cure over an LOD pyramid.

Acceptance

  • fff-vtt import resizes with ImageMagick before tiling (Lanczos, alpha kept), sets scene w,h to the shrunk size, and prints the shrink on stdout; --help documents the cap.
  • Existing pixel-identity tests for un-shrunk images still pass; new tests cover landscape, portrait, square, exactly-at-cap and 1 px over, smaller untouched, alpha kept.
  • scene.set cannot set w,h (already true); an existing DB scene above the cap is left alone, with a server-log warning at startup (and a serve console warning when the args lane's file allows it).
  • DESIGN/ADR + TESTING gates and scenes sized to the Full HD maximum; import-scale now proves a 16384² input is shrunk fast and memory-bounded.
  • README, docs/HANDOFF-M4.md and the #77 checklist updated: any image works, it is shrunk to Full HD; the 16384/64 recipe is gone.

Size

S (~1 agent session).

Part of #63 ## Owner decision (FIXED, 2026-11-21) Map images are capped at Full HD: at most **1920 px on the long side** and **1080 px on the short side**, either orientation. The import **shrinks** a larger image automatically, keeping proportions, and prints what it did (`scaled 4000×3000 → 1440×1080`). Smaller images are imported as-is (no upscaling). Examples: `4000×3000 → 1440×1080`, `16384×16384 → 1080×1080`, `1921×1080 → 1920×1079`. Reason: a 16384 map meant ~30k tiles at 32 px / minutes / ~1 GB VRAM for a zoomed-out GM. The owner chose the simplest cure over an LOD pyramid. ## Acceptance - [ ] `fff-vtt import` resizes with ImageMagick before tiling (Lanczos, alpha kept), sets scene `w,h` to the shrunk size, and prints the shrink on stdout; `--help` documents the cap. - [ ] Existing pixel-identity tests for un-shrunk images still pass; new tests cover landscape, portrait, square, exactly-at-cap and 1 px over, smaller untouched, alpha kept. - [ ] `scene.set` cannot set `w,h` (already true); an existing DB scene above the cap is left alone, with a server-log warning at startup (and a serve console warning when the args lane's file allows it). - [ ] DESIGN/ADR + TESTING gates and scenes sized to the Full HD maximum; `import-scale` now proves a 16384² input is shrunk fast and memory-bounded. - [ ] README, `docs/HANDOFF-M4.md` and the #77 checklist updated: any image works, it is shrunk to Full HD; the 16384/64 recipe is gone. ## Size S (~1 agent session).
SirStone added the ready-for-agentenhancement labels 2026-11-21 21:38:34 +01:00
SirStone added a new dependency 2026-11-21 21:38:40 +01:00
Author
Owner

Done on m4/fullhd, commit 43947d1.

  • fff-vtt import shrinks a source above the cap with ImageMagick Lanczos before tiling (alpha kept, no upscaling), prints scaled WxH → WxH, and sets the scene w,h to the shrunk size; --help documents the cap. Sources at/below the cap are untouched, so the pixel-identity tests still pass.
  • New tests: landscape/portrait/square/exactly-at-cap/1 px over/smaller, alpha preserved; tests/tworld.nim pins cappedMapSize/exceedsMapCap.
  • Existing DB scenes above the cap are left alone: the server logs map_above_cap at startup and serve (including --dry-run) prints the re-import warning. scene.set still cannot write w/h.
  • ADR-0023; DESIGN 3.3/5.3/8/11.1/13/14, TESTING 5.3/13, README, HANDOFF-M4 and the v4 #77 checklist updated to the Full HD max. Fogbench/e2e use 1920×1080; the 16384 px bench/test rows remain labelled server stress references.
  • devbox run import-scale now proves a 16384² input shrinks to 1080×1080 (289 tiles at 64 px): ~12.6 s, peak RSS 303 MiB, 65 fds (results/import-scale.log).

Gate: devbox run test green (174 Node tests, 1 skip), client-test 183, e2e 29/29; import-scale green. No mutation run: no core server logic changed beyond the importer's size handling and a startup warning. Kernel watch clean.

Done on `m4/fullhd`, commit `43947d1`. - `fff-vtt import` shrinks a source above the cap with ImageMagick Lanczos before tiling (alpha kept, no upscaling), prints `scaled WxH → WxH`, and sets the scene `w,h` to the shrunk size; `--help` documents the cap. Sources at/below the cap are untouched, so the pixel-identity tests still pass. - New tests: landscape/portrait/square/exactly-at-cap/1 px over/smaller, alpha preserved; `tests/tworld.nim` pins `cappedMapSize`/`exceedsMapCap`. - Existing DB scenes above the cap are left alone: the server logs `map_above_cap` at startup and `serve` (including `--dry-run`) prints the re-import warning. `scene.set` still cannot write `w`/`h`. - ADR-0023; DESIGN 3.3/5.3/8/11.1/13/14, TESTING 5.3/13, README, HANDOFF-M4 and the v4 #77 checklist updated to the Full HD max. Fogbench/e2e use 1920×1080; the 16384 px bench/test rows remain labelled server stress references. - `devbox run import-scale` now proves a 16384² input shrinks to 1080×1080 (289 tiles at 64 px): ~12.6 s, peak RSS 303 MiB, 65 fds (results/import-scale.log). Gate: `devbox run test` green (174 Node tests, 1 skip), `client-test` 183, `e2e` 29/29; `import-scale` green. No mutation run: no core server logic changed beyond the importer's size handling and a startup warning. Kernel watch clean.
Author
Owner

Landed on main as a79d809 (was pushed to m4/fullhd by mistake). m4/fullhd deleted.

Landed on main as a79d809 (was pushed to m4/fullhd by mistake). m4/fullhd deleted.
Sign in to join this conversation.