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:
@@ -0,0 +1,39 @@
|
||||
# Map images are capped at Full HD; the import shrinks larger ones
|
||||
|
||||
A map image is at most 1920 px on its long side and 1080 px on its short side, either orientation.
|
||||
`fff-vtt import` shrinks a larger source automatically with ImageMagick (Lanczos, alpha kept,
|
||||
proportions preserved) before tiling, prints what it did (`scaled 4000×3000 → 1440×1080`), and writes
|
||||
the shrunk size into the scene row. A source at or below the cap is imported as-is; nothing is ever
|
||||
upscaled. Examples: `4000×3000 → 1440×1080`, `16384×16384 → 1080×1080`.
|
||||
|
||||
An existing database scene above the cap is left untouched: the server logs a `map_above_cap` warning
|
||||
at startup and `devbox run serve` prints the same warning, so the operator re-imports rather than the
|
||||
server rewriting authored data. `scene.set` cannot set `w`/`h` at all (DESIGN 6.1), so the importer is
|
||||
the only writer and the cap is enforced exactly where dimensions enter the system.
|
||||
|
||||
## Status
|
||||
accepted — FIXED owner decision, 2026-11-21
|
||||
|
||||
## Alternatives
|
||||
- An LOD pyramid (a few downscaled zoom levels): rejected, much more importer, storage and client
|
||||
work for a table that only ever views one map at a time.
|
||||
- Cap only the tile count or refuse oversized images: rejected, the owner wants any image to work;
|
||||
shrinking keeps the ordinary "drop in a battle map" flow.
|
||||
- Shrink at serve time or in the client: rejected, the server would decode and resize per request or
|
||||
per start, and clients would receive the full-size bytes first.
|
||||
- Keep 16384 px as the target: rejected, ~30k tiles at 32 px, minutes per import and ~1 GB VRAM for a
|
||||
zoomed-out GM.
|
||||
|
||||
## Consequences
|
||||
The largest scene is 60×34 explored cells at cell 32 (2040 cells), so tiled art, the fog texture and
|
||||
the explored bitmaps are bounded by construction. The old 16384 px and 262144-cell rows in
|
||||
`tools/bench.nim` and `tests/tviews.nim` remain synthetic server stress references, labelled as such,
|
||||
not the product target. The importer still streams the slice: a huge input is shrunk first, so the
|
||||
65k-tile path cannot be reached from a bigger source. A 16384² input now costs one bounded resize plus
|
||||
at most 2040 tiles at 32 px (or 289 at 64 px) instead of 30k-65k tiles.
|
||||
|
||||
## Tickets
|
||||
#85; #63 (decision), #77 (phone gate re-runs on the Full HD map), #83 (streamed import).
|
||||
|
||||
## Spec
|
||||
Current §3.3, §8, §11.1, §13.
|
||||
Reference in New Issue
Block a user