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:
@@ -42,9 +42,12 @@ To import a map on the same first start, pass `--image` (an offline import runs
|
||||
a fresh state dir is created and migrated first):
|
||||
|
||||
```sh
|
||||
devbox run serve -- --image=run/map16384.png --tile-size=64
|
||||
devbox run serve -- --image=run/map16384.png
|
||||
```
|
||||
|
||||
Any single-frame PNG or WebP works: images larger than Full HD (1920 px long side, 1080 px short
|
||||
side) are shrunk automatically on import (see below), so no tile-size juggling is needed.
|
||||
|
||||
Everything after `--` reaches the script (#84: devbox 0.17.2 needs the `"$@"` suffix in
|
||||
`devbox.json`); an unknown or unusable flag fails loudly instead of being ignored. To check the
|
||||
parsed options without building anything: `devbox run serve -- --dry-run`.
|
||||
@@ -105,14 +108,21 @@ ImageMagick comes from the root devbox.
|
||||
|
||||
```sh
|
||||
# stop the server first, then:
|
||||
devbox run -- ./run/fff-vtt import --state-dir=run --image=/path/to/map.png --tile-size=64
|
||||
devbox run -- ./run/fff-vtt import --state-dir=run --image=/path/to/map.png
|
||||
# restart the server with the usual command
|
||||
```
|
||||
|
||||
**Any map image works, up to Full HD.** The cap is 1920 px on the long side and 1080 px on the
|
||||
short side (either orientation). A larger source is shrunk with ImageMagick's Lanczos filter before
|
||||
tiling, keeping proportions and alpha, and the import says what it did:
|
||||
`scaled 4000×3000 → 1440×1080`. Smaller images are imported as-is; nothing is upscaled. The scene's
|
||||
`w,h` become the (possibly shrunk) image size. A 16384×16384 source therefore becomes 1080×1080 —
|
||||
1156 tiles at 32 px or 289 at 64 px, not the ~30k a 16384 map used to need.
|
||||
|
||||
| argument | meaning |
|
||||
|---|---|
|
||||
| `--image=<path>` | source PNG or WebP (required); tiles are always PNG |
|
||||
| `--tile-size=<px>` | tile edge, default the scene's current tile size; must be a positive multiple of the 32 px explored cell (so 32 or the 64 px fallback) |
|
||||
| `--tile-size=<px>` | tile edge, default the scene's current tile size; must be a positive multiple of the 32 px explored cell (32 is the default, 64 a common larger choice) |
|
||||
| `--scene=<id>` | target scene; v1 has exactly one, id 1 |
|
||||
| `--state-dir=<path>` | the same state dir as the server (default `run`); created and migrated if absent |
|
||||
|
||||
@@ -126,18 +136,20 @@ cell, a malformed state DB, or a server still holding the state-dir lock (exit 3
|
||||
|
||||
Slicing streams: one ImageMagick decode of the source supplies raw row bands, and a small pool of
|
||||
`magick` children cuts one tile row each (live caches and file descriptors are bounded by the worker
|
||||
count, never by the tile count). A long import reports where it is on stderr, e.g.
|
||||
`rows 128/256, tiles 32768/65536`; a failure prints the image, the row band and ImageMagick's own
|
||||
message.
|
||||
count, never by the tile count). An import reports where it is on stderr, e.g.
|
||||
`rows 12/34, tiles 720/2040` for a Full HD map at 32 px; a failure prints the image, the row band and
|
||||
ImageMagick's own message.
|
||||
|
||||
**A 16384 px scene with 50 tokens (the phone-playtest target).**
|
||||
**A Full HD scene with 50 tokens (the phone-playtest target).**
|
||||
|
||||
1. Prepare a 16384×16384 PNG or WebP. `--tile-size=64` is the designed fallback and gives 256×256 =
|
||||
65,536 tiles (32 px would give 262,144 files). On this 16-core box such an import takes about
|
||||
20 s and peaks near 400 MB RSS (the old one-shot crop died at 4-8 GB and 65k fds, #83); the
|
||||
decode still uses ImageMagick's disk-backed pixel cache, so allow a few GB of temp space.
|
||||
2. Start with the import in one step: `devbox run serve -- --image=run/map16384.png --tile-size=64`
|
||||
(or stop the server, run `fff-vtt import` as above, then restart it).
|
||||
1. Use any single-frame PNG or WebP. Anything larger than 1920×1080 (long side × short side) is
|
||||
shrunk to the cap automatically. The Full HD maximum is 60×34 = 2040 tiles at 32 px (30×17 = 510
|
||||
at 64 px); a 16384×16384 square becomes 1080×1080, i.e. 34×34 = 1156 tiles at 32 px (17×17 = 289
|
||||
at 64 px). The shrink uses ImageMagick's disk-backed pixel cache, so a huge source needs a few GB
|
||||
of temp space but bounded RSS.
|
||||
2. Start with the import in one step: `devbox run serve -- --image=run/map16384.png`
|
||||
(or stop the server, run `fff-vtt import` as above, then restart it). The import prints
|
||||
`scaled 16384×16384 → 1080×1080` before the tile report.
|
||||
3. Create the 50 tokens with the seeding tool, not 50 panel submits (a rerun does not double up):
|
||||
|
||||
```sh
|
||||
@@ -332,8 +344,8 @@ panel); it needs USB debugging, the overlay does not.
|
||||
| `devbox run e2e` | builds `client/dist`, then drives headless Chromium against the real server through the TLS/HTTP2 test nginx |
|
||||
| `devbox run mutation` | mutation suite on a temp copy of `server/`, `tests/`, `tools/`: every seeded mutation must fail at least one test |
|
||||
| `devbox run bench` | release-build bench of the vision and egress paths, writing `results/bench.log` |
|
||||
| `devbox run fogbench` | the 50-token / 16384 px server measurement, writing `results/m4-fog-bench.log`; the numbers live in `results/m4-fog-bench.md` |
|
||||
| `devbox run import-scale` | the map import at target scale: 16384×16384 at 64 px (65,536 tiles) under a 256-fd limit, asserting bounded RSS/fds and progress, writing `results/import-scale.log`; ~25 s, too slow for the pre-push gate (`test` skips it) |
|
||||
| `devbox run fogbench` | the 50-token / Full HD (1920×1080, the max scene) server measurement, writing `results/m4-fog-bench.log`; the numbers live in `results/m4-fog-bench.md` |
|
||||
| `devbox run import-scale` | the map import at the old huge-input scale: a 16384×16384 source shrunk to 1080×1080 (289 tiles at 64 px) under a 256-fd limit, asserting bounded RSS/fds, the printed shrink and progress, writing `results/import-scale.log`; too slow for the pre-push gate (`test` skips it) |
|
||||
| `devbox run -- nimble install -d -y` | install/refresh the pinned Nim dependencies |
|
||||
| `devbox run -- bash -c 'cd client && npm ci && npm run dev'` | Vite dev server on :5173 — the UI only, no server API behind it |
|
||||
|
||||
|
||||
+3
-2
@@ -84,8 +84,9 @@ change them only if a slice needs a new *core* event, and say so in the PR.
|
||||
list is written in the test, never imported from `tools/leakcheck.nim`, so the proof is independent
|
||||
of the server's own list. A second test is the negative control: the same rules run against a
|
||||
`-d:leakfault` build with `LEAK_FAULT=otherVision` and must catch the injected foreign polygon.
|
||||
- **50-token measurement**: the server half is `tools/fogbench.nim` (`devbox run fogbench`, 16384 px,
|
||||
50 tokens, ~5k walls); the headless half is `e2e/fogbench.test.mjs`. Numbers and the honest caveat
|
||||
- **50-token measurement**: the server half is `tools/fogbench.nim` (`devbox run fogbench`, Full HD
|
||||
1920×1080, the max scene, 50 tokens, thousands of walls); the headless half is
|
||||
`e2e/fogbench.test.mjs`. Numbers and the honest caveat
|
||||
(SwiftShader is a floor, not a phone) are in `results/m4-fog-bench.md`. The real 60 fps run is #77.
|
||||
|
||||
## Name, badge and reconnect (T5, #68)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// T13 (#76): the 50-token, 16384 px map measurement the finish ticket records in
|
||||
// T13 (#76): the 50-token, Full HD map measurement the finish ticket records in
|
||||
// `results/m4-fog-bench.md`. This is NOT the phone gate: headless Chromium here renders with
|
||||
// SwiftShader (software), so its frame cadence is a floor for correctness work, never a substitute
|
||||
// for the Note 10 run (#77). The server half of the same measurement is `tools/fogbench.nim`.
|
||||
//
|
||||
// The scene is the real one, patched to 16384 px (only the importer owns w/h, so the harness writes
|
||||
// the scene row before the server loads it). 50 tokens sit inside the player's sight; the fog
|
||||
// texture is therefore 512x512 cells, the real M4 maximum.
|
||||
// The scene is the real one, patched to the Full HD cap (1920x1080; only the importer owns w/h, so
|
||||
// the harness writes the scene row before the server loads it). 50 tokens sit inside the player's
|
||||
// sight; the fog texture is therefore 60x34 cells, the real M4 maximum (#85).
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { spawnSync } from 'node:child_process'
|
||||
@@ -16,13 +16,13 @@ import { writeTileGrid } from '../../tools/tilefixture.mjs'
|
||||
import { launchBrowser, signIn, waitForVisible, withStack, sleep } from './stack.mjs'
|
||||
|
||||
const MOBILE = { viewport: { width: 412, height: 869 }, deviceScaleFactor: 2.625, isMobile: true, hasTouch: true }
|
||||
const SIZE = 16384
|
||||
const CENTRE = [SIZE / 2, SIZE / 2]
|
||||
const SIZE = { w: 1920, h: 1080 }
|
||||
const CENTRE = [SIZE.w / 2, SIZE.h / 2]
|
||||
|
||||
/** The scene row is the importer's (DESIGN 6.1: w/h are not wire fields); write it before boot. */
|
||||
function setSceneSize(stateDir, size) {
|
||||
const db = path.join(stateDir, 'state.db')
|
||||
const r = spawnSync('sqlite3', [db, `UPDATE scene SET w=${size}, h=${size} WHERE id=1`], { encoding: 'utf8' })
|
||||
const r = spawnSync('sqlite3', [db, `UPDATE scene SET w=${size.w}, h=${size.h} WHERE id=1`], { encoding: 'utf8' })
|
||||
assert.equal(r.status, 0, `set scene size: ${r.stderr}`)
|
||||
}
|
||||
|
||||
@@ -89,19 +89,22 @@ const fogState = page =>
|
||||
}
|
||||
})
|
||||
|
||||
test('50-token fog measurement on a 16384 px map (headless SwiftShader, not the phone gate)', { timeout: 180000 }, async () => {
|
||||
test('50-token fog measurement on a Full HD map (headless SwiftShader, not the phone gate)', { timeout: 180000 }, async () => {
|
||||
await withStack(async ({ origin, gmKey, stateDir }) => {
|
||||
const gm = await gmWorld(origin, gmKey)
|
||||
const scene = gm.scene
|
||||
assert.equal(scene.w, SIZE, 'the prepared scene is 16384 px')
|
||||
assert.equal(scene.w, SIZE.w, 'the prepared scene is 1920 px wide')
|
||||
assert.equal(scene.h, SIZE.h, 'the prepared scene is 1080 px high')
|
||||
const player = await createPlayer(gm.ws)
|
||||
await namePlayer(origin, player.key, 'Ann')
|
||||
await fiftyTokens(gm, scene, { id: player.id })
|
||||
|
||||
// Only the viewport's window needs fixture bytes; 16384 px would be 262144 files.
|
||||
// The capped map is only 60x34 tiles at 32 px, so write the whole grid: no viewport edge can
|
||||
// ask for a missing tile (the old 16384 px scene only had a viewport window, thousands of files).
|
||||
writeTileGrid(stateDir, {
|
||||
scene: scene.id, artVersion: scene.art_version, size: scene.tile_size,
|
||||
x0: 240, x1: 280, y0: 235, y1: 280,
|
||||
x0: 0, x1: Math.ceil(scene.w / scene.tile_size) - 1,
|
||||
y0: 0, y1: Math.ceil(scene.h / scene.tile_size) - 1,
|
||||
})
|
||||
|
||||
const browser = await launchBrowser()
|
||||
@@ -134,8 +137,8 @@ test('50-token fog measurement on a 16384 px map (headless SwiftShader, not the
|
||||
)
|
||||
const initial = await fogState(page)
|
||||
assert.equal(initial.tokens, 50, `the client draws 50 tokens: ${initial.tokens}`)
|
||||
assert.ok(initial.cells > 400, `a 16384 px map explored cells: ${initial.cells}`)
|
||||
assert.ok(initial.fullMs > 0, `the 512x512 fog snapshot was repainted: ${initial.fullMs}`)
|
||||
assert.ok(initial.cells > 300, `the Full HD map's explored cells: ${initial.cells}`)
|
||||
assert.ok(initial.fullMs > 0, `the 60x34 fog snapshot was repainted: ${initial.fullMs}`)
|
||||
|
||||
const real = await cadence(page, 120)
|
||||
await cdp.send('Emulation.setCPUThrottlingRate', { rate: 4 })
|
||||
@@ -144,7 +147,7 @@ test('50-token fog measurement on a 16384 px map (headless SwiftShader, not the
|
||||
assert.deepEqual(errors, [])
|
||||
|
||||
console.log(
|
||||
`fogbench (#76): 16384px map (512x512 cells), 50 tokens, 412x869 dpr2.625, ` +
|
||||
`fogbench (#76): Full HD map 1920x1080 (60x34 cells), 50 tokens, 412x869 dpr2.625, ` +
|
||||
`SwiftShader: fog snapshot=${initial.fullMs.toFixed(3)}ms exploredCells=${initial.cells} ` +
|
||||
`frames real median=${real.median.toFixed(1)}ms p95=${real.p95.toFixed(1)}ms ` +
|
||||
`4xCPU median=${throttled.median.toFixed(1)}ms p95=${throttled.p95.toFixed(1)}ms ` +
|
||||
|
||||
+20
-1
@@ -138,7 +138,10 @@ Source: `docs/archive/prototypes/server-vision/HANDOFF.md` (and README/NOTES wor
|
||||
2. Q2 - Largest map you plan to use (px), and typical wall count per scene? Drives tile size,
|
||||
spatial grid priority and explored chunking. **DEFERRED [FIXED (owner decision), 2026-11-08]:**
|
||||
owner does not know yet. 16384 px map and 5k walls stay [PROPOSED] test targets; revisit with real
|
||||
maps.
|
||||
maps. **Map size RESOLVED 2026-11-21 [FIXED (owner decision), #85]:** images are capped at Full HD
|
||||
(at most 1920 px long side, 1080 px short side) and the import shrinks larger sources; the largest
|
||||
scene is 60x34 cells at cell 32. 5k walls remains a PROPOSED server stress target only. See current
|
||||
3.3, 5.3, 8, 11.1, 13 and ADR-0023.
|
||||
3. Q3 - Multiple scenes in v1 (GM switches the active scene, per-scene explored grids), or exactly
|
||||
one scene per table to start? **RESOLVED [FIXED (owner decision), 2026-11-08]:** exactly one scene
|
||||
in v1; schema may stay `scene_id`-keyed.
|
||||
@@ -885,6 +888,16 @@ supersedes #63's "map import CLI (M6)" Out-of-Scope line for the CLI only; NixOS
|
||||
production vhost and tile-version cleanup stay M6. See current 3.3, 6.1, 11.1, 13 and TESTING 3.3 /
|
||||
10.3.
|
||||
|
||||
Owner also decided 2026-11-21 [FIXED (owner decision), #85]: **map images are capped at Full HD.**
|
||||
The long side is at most 1920 px and the short side at most 1080 px, either orientation; the import
|
||||
shrinks a larger source before tiling (Lanczos, alpha kept, proportions preserved, no upscaling) and
|
||||
records the shrunk `w,h`; `scene.set` still cannot set them, so the importer is the only writer. An
|
||||
existing DB scene above the cap is not rewritten: the server logs `map_above_cap` at startup and
|
||||
`serve` prints the re-import advice. Rationale: a 16384 px map meant ~30k tiles at 32 px, minutes per
|
||||
import and ~1 GB VRAM for a zoomed-out GM; an LOD pyramid was rejected as the more complex cure. The
|
||||
16384 px / 262144-cell bench and test rows become labelled server stress references, not the product
|
||||
target; the phone gate re-runs on the Full HD scene. See current 3.3, 5.3, 8, 11.1, 13 and ADR-0023.
|
||||
|
||||
## D. Superseded statements removed from the current spec
|
||||
|
||||
Each entry quotes the superseded statement (excerpt) and names the surviving rule.
|
||||
@@ -956,3 +969,9 @@ Each entry quotes the superseded statement (excerpt) and names the surviving rul
|
||||
rides the wall row's `FULL` transaction (inserts stay `NORMAL`), because a crash between the
|
||||
two would restore the marker with the new geometry and reveal a position the player never saw.
|
||||
Surviving rules: current §5.8, §8.
|
||||
|
||||
18. **"A 16384 px map is the target" (v0.30 and earlier).** Old: the M4 gate and the bench/tests
|
||||
named a 16384 px map (512x512 cells, 262144 files at 32 px) as the product target. Superseded
|
||||
2026-11-21 (#85): map images are capped at Full HD, the import shrinks larger sources, and the
|
||||
product maximum is 2040 explored cells. The 16384 px rows survive only as labelled server stress
|
||||
references. Surviving rules: current §3.3, §5.3, §8, §11.1, §13 and ADR-0023.
|
||||
|
||||
+40
-16
@@ -304,6 +304,12 @@ Notes:
|
||||
- A second consequence: map art itself may depict walls/doors. Art is "what players see once there",
|
||||
walls data is "what physics/vision uses". Authoring must keep them consistent; mismatch is GM
|
||||
error, not a leak.
|
||||
- **Map size is capped at Full HD [FIXED (owner decision), 2026-11-21, #85].** An imported map image
|
||||
is at most 1920 px on the long side and 1080 px on the short side, either orientation. The importer
|
||||
shrinks a larger source before tiling (Lanczos, alpha kept, proportions preserved) and the scene
|
||||
`w,h` become the shrunk size; smaller images are imported as-is. The largest scene is therefore
|
||||
60x34 explored cells at cell 32, which bounds the tile tree, the fog texture and the explored
|
||||
bitmaps (ADR-0023, §8, §11.1, §13).
|
||||
- Tile URLs include the scene's `art_version` so that re-imported art does not hit stale caches
|
||||
[FIXED, owner decision 2026-11-14, #7]: from M3 on, always `1` in M3. The gate reads
|
||||
`<state>/tiles/<scene>/v<art_version>/` (layout fixed in M3; writing versions is the import CLI of
|
||||
@@ -528,8 +534,9 @@ explored_chunk(player_id, scene_id, cx, cy, bits BLOB, PRIMARY KEY(player_id, sc
|
||||
- Prototype stores one row per explored cell (`exp(role, c)`, one INSERT per new cell,
|
||||
`HANDOFF.md`); the real build stores **chunked bitmaps** [FIXED (owner-delegated, 2026-11-15,
|
||||
#21)]: a chunk is 64x64 cells = 512 B, upserted per mutation and only when the mutation dirtied
|
||||
it. Sizes: 4096 px map / 32 px cell = 16 384 cells = 2 KB (2x2 chunks); 16384 px map = 262 144
|
||||
cells = 32 KB (8x8 chunks). The measured write cost and the pinning tests: TESTING §4.4.
|
||||
it. Sizes: the seeded 4096 px map / 32 px cell = 16 384 cells = 2 KB (2x2 chunks); the largest
|
||||
scene, Full HD / 32 px cell = 60x34 = 2040 cells (one chunk, 512 B) [FIXED (owner decision),
|
||||
2026-11-21, #85]. The measured write cost and the pinning tests: TESTING §4.4.
|
||||
- Entity move = one UPSERT of x,y (prototype: `INSERT OR REPLACE INTO tok`).
|
||||
- Migrations: `PRAGMA user_version` + forward-only migration list; startup refuses to run on a newer
|
||||
DB [PROPOSED]. Detail [FIXED (owner-delegated, 2026-11-14, #16)]: `schema_migration(version
|
||||
@@ -573,8 +580,8 @@ explored_chunk(player_id, scene_id, cx, cy, bits BLOB, PRIMARY KEY(player_id, sc
|
||||
row-major inside the chunk, least-significant bit first (cell `(cx, cy)` is bit `(cy mod 64) * 64
|
||||
+ (cx mod 64)`, byte `bit div 8`, mask `1 shl (bit mod 8)`). Cells outside the scene stay 0, so a
|
||||
map whose cell count is not a multiple of 64 needs no special case; the v1 scene is 128x128 cells
|
||||
= 2x2 chunks, a 16384 px map 8x8. Both FKs cascade, so `player.remove` and a scene delete take the
|
||||
explored rows with them. The layout is pinned by tests (TESTING §4.4), so a refactor cannot
|
||||
= 2x2 chunks, the largest Full HD scene is one chunk (#85). Both FKs cascade, so `player.remove`
|
||||
and a scene delete take the explored rows with them. The layout is pinned by tests (TESTING §4.4), so a refactor cannot
|
||||
silently swap axes or bit order.
|
||||
- Step 6 (`token details`) [FIXED (owner-delegated, 2026-11-15, #22)]: adds `entity.props_public`,
|
||||
`props_owner`, `props_gm` (`TEXT NOT NULL DEFAULT '{}'`: one JSON object per visibility bucket)
|
||||
@@ -747,6 +754,10 @@ Targets and accepted decisions. The measured table and the bench scenes are in T
|
||||
fan, never in per-viewer geometry.
|
||||
- **Load/perf regression gate:** the bench and concurrency numbers are compared with committed
|
||||
baselines; fail on > 2x regression [PROPOSED]. Numbers and method: TESTING §5.3.
|
||||
- **Map size bound [FIXED (owner decision), 2026-11-21, #85]:** the product maximum is Full HD
|
||||
(1920x1080), so the largest explored set is 2040 cells at cell 32. The 16384 px and 262144-cell
|
||||
bench rows are kept only as labelled server stress references, never as the product target
|
||||
(ADR-0023).
|
||||
|
||||
### 5.4 Known limitations (carry forward)
|
||||
- Token exactly on a wall cannot move off it: `moveBlocked` counts any touch as a hit, so every move
|
||||
@@ -2029,7 +2040,9 @@ exposure later leaks at most about the wall count (accepted). Rejected: dense id
|
||||
broadcast (in-flight intents hit the wrong wall); game-wide wall counter (per-scene ids keep scene
|
||||
copy/export stable).
|
||||
|
||||
- **Scene** (exactly one in v1, Q3): `id, name, w, h` (px), `tile_size` (32 default =
|
||||
- **Scene** (exactly one in v1, Q3): `id, name, w, h` (px; at most 1920 on the long side and 1080 on
|
||||
the short side [FIXED (owner decision), 2026-11-21, #85]: the importer shrinks larger images, and
|
||||
`scene.set` cannot write `w`/`h` at all, 6.1), `tile_size` (32 default =
|
||||
`explored_cell` [FIXED, Q4]; 64 is the per-scene fallback), `explored_cell` (32 default;
|
||||
`tile_size % cell == 0` required, prototype assumes it silently), `grid_size`,
|
||||
`vision_radius_default`, `token_radius_default` (px, > 0, no upper cap [FIXED, #4]),
|
||||
@@ -2273,13 +2286,20 @@ See TESTING §10.4 (Node 26 black-box harnesses, built-ins only, `devbox run tes
|
||||
the world origin and names are the gate's `<x>_<y>.png` (3.3). `art_version` grows on a re-import
|
||||
for a scene that already has art, so browsers never serve a stale cached tile; older versions stay
|
||||
on disk (cleanup remains M6). `--tile-size` defaults to the scene's current tile size and must be a
|
||||
positive multiple of the explored cell, so 64 px is the designed fallback. The state-dir lock of
|
||||
positive multiple of the explored cell (64 px is a common larger choice; with the Full HD cap 32 px
|
||||
is only 2040 tiles). The state-dir lock of
|
||||
3.2/11.1 is taken (a live server refuses the import, exit 3): the server reads the scene at startup
|
||||
(4.1), so the operator stops it, imports and restarts. Invalid input, an unsupported/multi-frame
|
||||
image, a scene other than the one v1 scene, a bad tile size, a missing/unreadable state dir or DB
|
||||
and a held lock all exit non-zero with a message and write nothing. Decoding is ImageMagick from
|
||||
and a held lock all exit non-zero with a message and write nothing. **Map images are capped at
|
||||
Full HD [FIXED (owner decision), 2026-11-21, #85]:** a source larger than 1920 px on the long side
|
||||
or 1080 px on the short side is shrunk with ImageMagick's Lanczos filter (alpha kept, proportions
|
||||
preserved) before tiling, the shrink is printed (`scaled 4000x3000 -> 1440x1080`), and the scene
|
||||
row gets the shrunk size; a smaller source is imported as-is and is never upscaled (ADR-0023). An
|
||||
existing DB scene above the cap is not rewritten: the server logs a `map_above_cap` warning at
|
||||
startup and `serve` prints the re-import advice. Decoding is ImageMagick from
|
||||
the root devbox (`imagemagick`); it is run with `-limit memory 256MiB -limit map 512MiB` so its
|
||||
pixel cache is disk-backed and a 16384 px source stays memory-sane. No Nim/npm image dependency is
|
||||
pixel cache is disk-backed and a huge source stays memory-sane. No Nim/npm image dependency is
|
||||
added, the FIXED stack (2) is unchanged, and the archived prototype's deterministic
|
||||
`docs/archive/prototypes/server-vision/tools/genmap.mjs` fixture generator is not reused. Browser
|
||||
upload is post-v1; CLI-only import in v1 (Q5 FIXED).
|
||||
@@ -2356,18 +2376,19 @@ columns with today's defaults) lands complete now, so the later build needs no m
|
||||
`docs/archive/prototypes/` (Q24). Thickness and height controls are not in M4 (build order above;
|
||||
5.7, 5.10).
|
||||
- **Map import CLI** [FIXED (owner-delegated), 2026-11-21, #79; moved here from M6]: the designed
|
||||
offline importer of 11.1 is built in M4 because the gate needs a 16384 px tiled scene and
|
||||
`scene.set` cannot set `w`, `h`, `tile_size`, `cell` or `art_version` (6.1).
|
||||
offline importer of 11.1 is built in M4 because the gate needs a tiled scene and `scene.set`
|
||||
cannot set `w`, `h`, `tile_size`, `cell` or `art_version` (6.1). Images are capped at Full HD
|
||||
and larger ones are shrunk on import [FIXED (owner decision), 2026-11-21, #85].
|
||||
- Accept: headless e2e (fog pixel checks, player traffic audit clean, reconnect restores) - met by
|
||||
`devbox run e2e` including `client/e2e/audit.test.mjs`; the manual run on laptop and Note 10 at
|
||||
60 fps with 50 tokens on a 16384 px tiled map (test target PROPOSED, Q2) with fog active is
|
||||
#77, the one `ready-for-human` step, and M4 accept is met only when it passes.
|
||||
60 fps (the 60 fps target is PROPOSED) with 50 tokens on a Full HD map (max scene, 1920x1080)
|
||||
with fog active is #77, the one `ready-for-human` step, and M4 accept is met only when it passes.
|
||||
- Tile-size gates [FIXED, Q4]: (a) automated headless-Chromium test (mobile emulation, real server
|
||||
path): viewport fills in < 1 s at zoom 1 - met in `client/e2e/map.test.mjs`; (b) one manual run
|
||||
on the owner's 5-year-old Android phone - #77. If either fails: `tile_size` 64 px (per-scene
|
||||
config, no code change). Harness detail and the prototype-run caveat: TESTING §13.
|
||||
- Build evidence (#76): `results/m4-fog-bench.md` (50 tokens / 16384 px: server move path
|
||||
0.119 ms; headless SwiftShader cadence recorded, explicitly not a phone number),
|
||||
- Build evidence (#76): `results/m4-fog-bench.md` (50 tokens / Full HD max scene: server move path
|
||||
recorded; headless SwiftShader cadence recorded, explicitly not a phone number),
|
||||
`results/bench.log`, `results/mutation.log`, `results/nimble-test.log`, and the
|
||||
`devbox run test | client-test | e2e` logs (regenerated, not committed).
|
||||
- **M5 - Robustness and observability.** SIGTERM handler, bounded metrics and SLOW lines, per-client
|
||||
@@ -2403,8 +2424,10 @@ owner may overturn. The full Q1-Q24 decision log is in [`docs/DESIGN-history.md`
|
||||
|
||||
### Open questions
|
||||
|
||||
- **Q2, map size and wall count.** The owner does not know yet; a 16384 px map and 5k walls are
|
||||
PROPOSED test targets (5.3, 13). Revisit with real maps.
|
||||
- **Q2, map size and wall count.** Map size is settled: images are capped at Full HD (1920x1080)
|
||||
[FIXED (owner decision), 2026-11-21, #85; ADR-0023], so the largest scene is 60x34 cells at cell
|
||||
32. The wall count is still unknown; 5k walls remains a PROPOSED server stress target (5.3, 13),
|
||||
not the product scene. Revisit with real maps.
|
||||
- **Q8, table conveniences after v1.** Order decided at M7.
|
||||
- **Q19, where FFF runs.** Hidden state is settled (no state beyond the three buckets and
|
||||
`gm_only`); engine language, runtime and location are not. Options in 9.
|
||||
@@ -2454,3 +2477,4 @@ the section here that it constrains.
|
||||
| [0020](adr/0020-characters-separate-from-tokens.md) | Characters are records separate from tokens | 8 | #14, #23 |
|
||||
| [0021](adr/0021-one-global-lock-v1.md) | One global lock in v1; persistence stays inside it | 4.2, 4.3 | #13 |
|
||||
| [0022](adr/0022-synchronous-normal-full-authoring.md) | `synchronous=NORMAL`, `FULL` around GM authoring | 4.4 | Q12 |
|
||||
| [0023](adr/0023-full-hd-map-cap.md) | Map images are capped at Full HD; the import shrinks larger ones | 3.3, 5.3, 8, 11.1, 13 | #85, #63, #77 |
|
||||
|
||||
+9
-7
@@ -15,18 +15,20 @@ what exists, what is proven, what is deliberately still open.
|
||||
both lists, drag with prediction/rollback, GM wall editor, roster/keys/tokens panel, characters/
|
||||
reveals/who-sees-it. Gates: `devbox run client-test`, `devbox run e2e`.
|
||||
- **M4 automatable accept gates:** `devbox run e2e` proves join, fog pixels, drag/rollback, reconnect
|
||||
and the independent player-traffic audit; `results/m4-fog-bench.md` records 50 tokens on a
|
||||
16384 px map (server move path 0.12-0.14 ms; headless SwiftShader cadence recorded as a floor,
|
||||
not a phone number). Thickness/height controls are **not** in M4 (ADR-0012); walls round 2 is
|
||||
#37/#45/#50/#41/#44.
|
||||
and the independent player-traffic audit; `results/m4-fog-bench.md` records 50 tokens on a Full HD
|
||||
map (1920x1080, the capped max scene; server move path recorded, headless SwiftShader cadence
|
||||
recorded as a floor, not a phone number). Map images are capped at Full HD and the import shrinks
|
||||
larger ones (#85, ADR-0023). Thickness/height controls are **not** in M4 (ADR-0012); walls round 2
|
||||
is #37/#45/#50/#41/#44.
|
||||
- **Archived:** the three `prototype-*` trees now live under `docs/archive/prototypes/` (frozen,
|
||||
not built). One maintained client (`/client`), one server (`/server`).
|
||||
|
||||
## Still open
|
||||
|
||||
- **#77** - the human real-phone playtest: Note 10 + laptop, 16384 px map, 50 tokens, fog active,
|
||||
LAN TLS/h2. Its comment is the checklist with commands, numbers to record and pass thresholds.
|
||||
M4 is accepted only when it passes; `#63` and `#62` close only after #77.
|
||||
- **#77** - the human real-phone playtest: Note 10 + laptop, Full HD (1920x1080, max scene) map,
|
||||
50 tokens, fog active, LAN TLS/h2. Its comment is the checklist with commands, numbers to record
|
||||
and pass thresholds; any image works because the import shrinks it to the cap (#85). M4 is
|
||||
accepted only when it passes; `#63` and `#62` close only after #77.
|
||||
- **Playtest tooling (#82, closed with this note):** `?perf=1` in-app fps/frame/JS/token/zoom
|
||||
overlay (off by default), `fff-vtt import` on a fresh/empty state dir, `devbox run serve --
|
||||
--image=<file>`, `devbox run seed -- --url=...` for the 50 tokens, and the GM token form's X/Y
|
||||
|
||||
+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
|
||||
|
||||
@@ -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.
|
||||
+22
-22
@@ -1,25 +1,25 @@
|
||||
== prototype scene (60 walls, 8 tokens, radius 400, cell 32) ==
|
||||
1 poly (jittered start positions): n=2000 avg=0.013ms worst=0.075ms
|
||||
6 polys (one 6-token party): n=500 avg=0.074ms worst=0.123ms
|
||||
1 poly + cellsTouched (scanline): n=2000 avg=0.019ms worst=0.072ms
|
||||
6 polys + cellsTouched (scanline): n=300 avg=0.172ms worst=0.252ms
|
||||
1 poly + cellsTouchedOld (prototype reference): n=500 avg=0.685ms worst=2.616ms
|
||||
TARGET polygon+cells, prototype scene (prototype baseline 0.451): 0.019 ms vs <= 0.451 ms: PASS
|
||||
== 5k sparse: genScene(world=16384., n=5000, seed=1), avg walls in vision bbox 15.6 ==
|
||||
1 poly, 5k sparse: n=2000 avg=0.035ms worst=0.433ms
|
||||
1 poly + cellsTouched, 5k sparse: n=2000 avg=0.047ms worst=0.451ms
|
||||
1 move check (pathClear, cap-length step), 5k sparse: n=20000 avg=0.007ms worst=0.466ms
|
||||
TARGET polygon, 5k-wall scene: 0.035 ms vs <= 1.0 ms: PASS
|
||||
== 5k dense: genScene(world=4096., n=5000, seed=1), avg walls in vision bbox 206.9 ==
|
||||
1 poly, 5k dense: n=2000 avg=0.747ms worst=1.900ms
|
||||
1 poly + cellsTouched, 5k dense: n=2000 avg=0.811ms worst=1.614ms
|
||||
1 move check (pathClear, cap-length step), 5k dense: n=20000 avg=0.008ms worst=0.042ms
|
||||
== egress (#28: 6 players x 40 encountered entries, 262144 explored cells) ==
|
||||
GM egress pass (fresh diff base): n=200 avg=0.423ms worst=1.106ms
|
||||
player egress pass (fresh diff base): n=200 avg=0.109ms worst=0.214ms
|
||||
1 poly (jittered start positions): n=2000 avg=0.020ms worst=0.873ms
|
||||
6 polys (one 6-token party): n=500 avg=0.160ms worst=7.235ms
|
||||
1 poly + cellsTouched (scanline): n=2000 avg=0.034ms worst=1.181ms
|
||||
6 polys + cellsTouched (scanline): n=300 avg=0.187ms worst=0.349ms
|
||||
1 poly + cellsTouchedOld (prototype reference): n=500 avg=0.849ms worst=2.251ms
|
||||
TARGET polygon+cells, prototype scene (prototype baseline 0.451): 0.034 ms vs <= 0.451 ms: PASS
|
||||
== 5k sparse (stress): genScene(world=16384., n=5000, seed=1), avg walls in vision bbox 15.6 ==
|
||||
1 poly, 5k sparse (stress): n=2000 avg=0.058ms worst=0.197ms
|
||||
1 poly + cellsTouched, 5k sparse (stress): n=2000 avg=0.061ms worst=0.169ms
|
||||
1 move check (pathClear, cap-length step), 5k sparse (stress): n=20000 avg=0.009ms worst=0.245ms
|
||||
TARGET polygon, 5k-wall stress scene: 0.058 ms vs <= 1.0 ms: PASS
|
||||
== 5k dense (stress): genScene(world=4096., n=5000, seed=1), avg walls in vision bbox 206.9 ==
|
||||
1 poly, 5k dense (stress): n=2000 avg=1.409ms worst=17.788ms
|
||||
1 poly + cellsTouched, 5k dense (stress): n=2000 avg=1.712ms worst=16.250ms
|
||||
1 move check (pathClear, cap-length step), 5k dense (stress): n=20000 avg=0.013ms worst=4.333ms
|
||||
== egress (#28 stress: 6 players x 40 encountered entries, 262144 explored cells) ==
|
||||
GM egress pass (fresh diff base): n=200 avg=0.586ms worst=1.199ms
|
||||
player egress pass (fresh diff base): n=200 avg=0.188ms worst=2.470ms
|
||||
== tile gate (#65): old SQL-under-lock path vs published snapshot ==
|
||||
tile gate old: parse + SHA-256 + session JOIN + HashSet: n=2000 avg=0.012ms worst=0.023ms
|
||||
tile gate new: parse + SHA-256 + cache lookup + bitmap: n=2000 avg=0.002ms worst=0.024ms
|
||||
explored snapshot build (262144 cells): n=20 avg=3.472ms worst=3.852ms
|
||||
explored incremental mark (16 fresh cells): n=5000 avg=0.001ms worst=0.011ms
|
||||
tile gate old: parse + SHA-256 + session JOIN + HashSet: n=2000 avg=0.014ms worst=0.582ms
|
||||
tile gate new: parse + SHA-256 + cache lookup + bitmap: n=2000 avg=0.001ms worst=0.013ms
|
||||
explored snapshot build (262144 cells): n=20 avg=3.606ms worst=4.623ms
|
||||
explored incremental mark (16 fresh cells): n=5000 avg=0.002ms worst=0.765ms
|
||||
(sink 24393102)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# scale: gen=2515ms import=15259ms peakRSS=486MiB peakFds=71 peakProcs=10 tiles=65536
|
||||
✔ map import CLI: 16384 px source at 64 px stays memory- and fd-bounded (#83) (21279.293203ms)
|
||||
# scale: gen=5279ms import=12558ms peakRSS=303MiB peakFds=65 peakProcs=10 tiles=289
|
||||
✔ map import CLI: a 16384 px source is shrunk to Full HD and stays memory- and fd-bounded (#83, #85) (21653.434682ms)
|
||||
ℹ tests 1
|
||||
ℹ suites 0
|
||||
ℹ pass 1
|
||||
@@ -7,4 +7,4 @@
|
||||
ℹ cancelled 0
|
||||
ℹ skipped 0
|
||||
ℹ todo 0
|
||||
ℹ duration_ms 21545.730115
|
||||
ℹ duration_ms 22009.487202
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
/home/davide/Projects/GDR/FFF_vtt-m76/server/worldmap.nim(18, 44) Warning: imported and not used: 'faults' [UnusedImport]
|
||||
/home/davide/Projects/GDR/FFF_vtt-m76/server/vision.nim(31, 43) Warning: imported and not used: 'faults' [UnusedImport]
|
||||
== M4 fog bench: 16384 px map, cell 32 (512x512 cells), 50 tokens, 4979 walls ==
|
||||
server vision refresh, one player (1 polygon, radius 300, ~5k walls): n=500 avg=0.054ms worst=0.132ms
|
||||
== M4 fog bench: Full HD map 1920x1080, cell 32 (60x34 cells), 50 tokens, 1875 walls ==
|
||||
server vision refresh, one player (1 polygon, radius 300, 5k-wall generator clipped to the scene): n=500 avg=0.055ms worst=0.448ms
|
||||
player egress frames with 50 visible tokens: 52 frames, "vision","explored","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token","token"
|
||||
player egress pass, 50 visible tokens (fresh Known): n=300 avg=0.089ms worst=0.167ms
|
||||
player egress pass, warm Known (no changes): n=2000 avg=0.094ms worst=0.261ms
|
||||
explored snapshot size: 316 cells on the 16384 px map
|
||||
TARGET move path: refresh + 50-token egress 0.143 ms vs <= 16.7 ms (one 60 fps frame): PASS
|
||||
player egress pass, 50 visible tokens (fresh Known): n=300 avg=0.201ms worst=1.673ms
|
||||
player egress pass, warm Known (no changes): n=2000 avg=0.187ms worst=2.278ms
|
||||
explored snapshot size: 318 cells on the Full HD map
|
||||
TARGET move path: refresh + 50-token egress 0.256 ms vs <= 16.7 ms (one 60 fps frame): PASS
|
||||
(sink 20800)
|
||||
|
||||
+22
-17
@@ -1,52 +1,57 @@
|
||||
# M4 fog measurement: 50 tokens on a 16384 px map (#76)
|
||||
# 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: 16384 x 16384 px, cell 32 (512 x 512 cells = 262 144), 4 979 sparse walls
|
||||
(`genScene(16384, 5000, 1)` 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.
|
||||
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, 5k walls) | 500 | **0.044-0.054 ms** | 0.132 ms |
|
||||
| player egress, 50 visible tokens (`token` frames, fresh `Known` = reconnect) | 300 | **0.075-0.089 ms** | 0.167 ms |
|
||||
| player egress, warm `Known` (no changes) | 2000 | 0.084-0.094 ms | 0.261 ms |
|
||||
| move path total (refresh + 50-token egress) | | **0.119-0.143 ms** | |
|
||||
| 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 M1-M3 baselines
|
||||
(polygon 0.041 ms sparse, 0.73 ms dense 5k) and the explored/tile-gate numbers.
|
||||
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 16384 px scene (scene row patched before boot; only the M6
|
||||
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 (512 x 512 cells) | **2.0-2.2 ms** |
|
||||
| explored cells in the sight | 540 |
|
||||
| rAF cadence, real CPU (120 frames) | median **70-78 ms**, p95 81-166 ms |
|
||||
| rAF cadence, 4x CPU (90 frames) | median **77-83 ms**, p95 83-167 ms |
|
||||
| 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` records the same order (median 72-98 ms) and is also recorded only.
|
||||
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
|
||||
|
||||
+83
-27
@@ -20,6 +20,12 @@
|
||||
## image dependency is added; the FIXED stack of DESIGN 2 is unchanged, and `tools/` keeps its
|
||||
## built-ins-only rule (TESTING 10.4). The tile layout the gate parses is produced here, not by the
|
||||
## prototype's deterministic fixture generator.
|
||||
##
|
||||
## Map images are capped at Full HD (FIXED owner decision 2026-11-21, #85): before tiling, a source
|
||||
## larger than 1920 px on the long side or 1080 px on the short side is shrunk with ImageMagick's
|
||||
## Lanczos filter (alpha kept, no upscaling) and the shrink is printed. The scene row gets the
|
||||
## shrunk size; smaller images are imported byte-for-byte unchanged (the pixel-identity tests rely
|
||||
## on that).
|
||||
import std/[math, options, os, osproc, streams, strutils, times]
|
||||
import db_connector/db_sqlite
|
||||
import config, db, instancelock, world
|
||||
@@ -39,11 +45,16 @@ const
|
||||
|
||||
Slice a map image into the scene's tile tree and register the scene dimensions.
|
||||
|
||||
The image is capped at Full HD: at most 1920 px on the long side and 1080 px on the short side
|
||||
(either orientation). A larger source is shrunk with Lanczos before tiling and the shrink is
|
||||
printed ("scaled 4000x3000 -> 1440x1080"); the scene's w/h become the shrunk size. A smaller
|
||||
image is imported as-is (no upscaling).
|
||||
|
||||
Options:
|
||||
--image=<path> Source image (PNG or WebP). Required.
|
||||
--tile-size=<px> Tile edge in px (default: the scene's current tile_size). Must be a
|
||||
positive multiple of the scene's explored cell (32 px), so 64 is the
|
||||
designed fallback.
|
||||
positive multiple of the scene's explored cell (32 px); 64 is a common
|
||||
larger choice.
|
||||
--scene=<id> Target scene. v1 has exactly one scene, id 1.
|
||||
--state-dir=<path> Directory holding state.db and tiles (default: run). A missing or empty
|
||||
directory is created and migrated through the server's startup path, so
|
||||
@@ -130,6 +141,36 @@ proc lastLine(s: string): string =
|
||||
var lines = s.strip.splitLines
|
||||
if lines.len == 0: "" else: lines[^1]
|
||||
|
||||
type
|
||||
IdentifiedImage = object
|
||||
width, height, depth: int
|
||||
imageType: string
|
||||
|
||||
proc identifyImage(path, label: string): tuple[rc: int, message: string, info: IdentifiedImage] =
|
||||
## Dimensions, one format, and the sample layout the streaming slice feeds raw to `magick`.
|
||||
## Multi-frame input (animated PNG/WebP) would break the one-tile-per-coordinate tree, so it is
|
||||
## refused rather than silently importing frame zero. `label` is the user-facing source name
|
||||
## (the shrunk intermediate is an implementation detail).
|
||||
let ident = runMagick(@["identify", "-ping", "-format", "%w %h %m %[type] %z", path])
|
||||
if ident.status != 0:
|
||||
return (1, "cannot read image \"" & label & "\": " & lastLine(ident.output), IdentifiedImage())
|
||||
let parts = ident.output.splitWhitespace
|
||||
if parts.len != 5:
|
||||
return (2, "multi-frame image \"" & label &
|
||||
"\" is not supported; import a single-frame PNG or WebP", IdentifiedImage())
|
||||
if parts[2].toUpperAscii notin ImportedFormats:
|
||||
return (2, "unsupported format " & parts[2] &
|
||||
": the source must be PNG or WebP (tiles are always PNG)", IdentifiedImage())
|
||||
try:
|
||||
result.info.width = parseInt(parts[0])
|
||||
result.info.height = parseInt(parts[1])
|
||||
result.info.depth = parseInt(parts[4])
|
||||
except ValueError:
|
||||
return (1, "cannot read image dimensions from \"" & label & "\"", IdentifiedImage())
|
||||
if result.info.width <= 0 or result.info.height <= 0:
|
||||
return (1, "image \"" & label & "\" has no pixels", IdentifiedImage())
|
||||
result.info.imageType = parts[3]
|
||||
|
||||
type
|
||||
SlicePlan = object
|
||||
## How the decoded source is handed to the children as raw samples: the channel set follows
|
||||
@@ -312,31 +353,10 @@ proc runImport*(rawArgs: seq[string]): int =
|
||||
# Validate the source before touching the state dir: an error creates nothing.
|
||||
if not fileExists(a.image):
|
||||
return failImport("source image \"" & a.image & "\" does not exist", 1)
|
||||
let imagePath = expandFilename(a.image)
|
||||
var imagePath = expandFilename(a.image)
|
||||
|
||||
# Identify: dimensions, one format, and the sample layout the streaming slice feeds raw to
|
||||
# `magick` (type/depth). Multi-frame input (animated PNG/WebP) would break the one-tile-per-
|
||||
# coordinate tree, so it is refused rather than silently importing frame zero.
|
||||
let ident = runMagick(@["identify", "-ping", "-format", "%w %h %m %[type] %z", imagePath])
|
||||
if ident.status != 0:
|
||||
return failImport("cannot read image \"" & a.image & "\": " & lastLine(ident.output), 1)
|
||||
let parts = ident.output.splitWhitespace
|
||||
if parts.len != 5:
|
||||
return failImport("multi-frame image \"" & a.image &
|
||||
"\" is not supported; import a single-frame PNG or WebP", 2)
|
||||
if parts[2].toUpperAscii notin ImportedFormats:
|
||||
return failImport("unsupported format " & parts[2] &
|
||||
": the source must be PNG or WebP (tiles are always PNG)", 2)
|
||||
var imgW, imgH, srcDepth: int
|
||||
try:
|
||||
imgW = parseInt(parts[0])
|
||||
imgH = parseInt(parts[1])
|
||||
srcDepth = parseInt(parts[4])
|
||||
except ValueError:
|
||||
return failImport("cannot read image dimensions from \"" & a.image & "\"", 1)
|
||||
if imgW <= 0 or imgH <= 0:
|
||||
return failImport("image \"" & a.image & "\" has no pixels", 1)
|
||||
let plan = slicePlan(parts[3], srcDepth)
|
||||
let source = identifyImage(imagePath, a.image)
|
||||
if source.rc != 0: return failImport(source.message, source.rc)
|
||||
|
||||
# A fresh or empty state dir is the normal case (#82): create and migrate through the same
|
||||
# startup path as the server, under the same state-dir lock. The lock is taken before the DB is
|
||||
@@ -375,7 +395,43 @@ proc runImport*(rawArgs: seq[string]): int =
|
||||
return failImport("--tile-size must be positive, got " & $tileSize, 2)
|
||||
if tileSize mod scene.cell != 0:
|
||||
return failImport("--tile-size " & $tileSize & " is not a multiple of the scene's explored cell " &
|
||||
$scene.cell & " px; the gate requires tile_size % cell == 0 (64 is the designed fallback)", 2)
|
||||
$scene.cell & " px; the gate requires tile_size % cell == 0 (64 px is a common larger choice)", 2)
|
||||
|
||||
# Full HD cap (FIXED owner decision 2026-11-21, #85). Shrink before tiling, with the same
|
||||
# disk-backed pixel cache as the rest of the import, and keep alpha. A source at or below the
|
||||
# cap stays byte-for-byte the same input to the slice, so its tiles remain pixel-identical.
|
||||
var info = source.info
|
||||
var shrinkDir = ""
|
||||
defer:
|
||||
if shrinkDir.len > 0: removeBands(shrinkDir)
|
||||
if exceedsMapCap(float(info.width), float(info.height)):
|
||||
let target = cappedMapSize(info.width, info.height)
|
||||
shrinkDir = getTempDir() / ("fff-vtt-import-" & $getCurrentProcessId() & "-" &
|
||||
$int(epochTime() * 1000.0))
|
||||
try: createDir(shrinkDir)
|
||||
except OSError as e:
|
||||
return failImport("cannot create temporary directory " & shrinkDir & ": " & e.msg, 1)
|
||||
let resizedPath = shrinkDir / "map.png"
|
||||
let shrunk = runMagick(@["-limit", "memory", "256MiB", "-limit", "map", "512MiB",
|
||||
imagePath, "-filter", "Lanczos", "-resize",
|
||||
$target.w & "x" & $target.h & "!", resizedPath])
|
||||
if shrunk.status != 0:
|
||||
return failImport("magick failed to shrink \"" & a.image & "\" to " & $target.w & "x" &
|
||||
$target.h & ": " & lastLine(shrunk.output), 1)
|
||||
let resized = identifyImage(resizedPath, a.image)
|
||||
if resized.rc != 0: return failImport("shrunk image cannot be read: " & resized.message, 1)
|
||||
if resized.info.width != target.w or resized.info.height != target.h:
|
||||
return failImport("magick shrank to " & $resized.info.width & "x" & $resized.info.height &
|
||||
" instead of the expected " & $target.w & "x" & $target.h, 1)
|
||||
imagePath = resizedPath
|
||||
info = resized.info
|
||||
stdout.writeLine "scaled " & $source.info.width & "×" & $source.info.height & " → " &
|
||||
$target.w & "×" & $target.h
|
||||
stdout.flushFile()
|
||||
|
||||
let imgW = info.width
|
||||
let imgH = info.height
|
||||
let plan = slicePlan(info.imageType, info.depth)
|
||||
|
||||
let cols = int(ceil(float(imgW) / float(tileSize)))
|
||||
let rows = int(ceil(float(imgH) / float(tileSize)))
|
||||
|
||||
@@ -2493,6 +2493,14 @@ proc runServer(cfg: Config): int =
|
||||
lg.log(lvError, "scene_missing", [("path", cfg.dbPath), ("scene", $DefaultSceneId)])
|
||||
return 1
|
||||
state.scene = loaded.get
|
||||
# #85: a scene imported before the Full HD cap is left as it is on disk, but the operator is
|
||||
# told once at startup that the map is above the product maximum and should be re-imported.
|
||||
if exceedsMapCap(state.scene.w, state.scene.h):
|
||||
lg.log(lvWarn, "map_above_cap", [
|
||||
("w", $int(state.scene.w)), ("h", $int(state.scene.h)),
|
||||
("cap", $MapCapLongSide & "x" & $MapCapShortSide),
|
||||
("detail", "map is " & $int(state.scene.w) & "x" & $int(state.scene.h) &
|
||||
", above the Full HD cap; re-import to shrink")])
|
||||
state.tokens = loadTokens(conn, state.scene.id)
|
||||
# 8 / slice 8: the characters, the per-player reveals and the encountered snapshots.
|
||||
state.characters = characters.loadCharacters(conn)
|
||||
|
||||
@@ -131,6 +131,11 @@ type
|
||||
const
|
||||
DefaultSceneId* = 1
|
||||
## The seeded v1 scene (migration step 3). Exactly one scene exists in v1 (Q3).
|
||||
MapCapLongSide* = 1920
|
||||
MapCapShortSide* = 1080
|
||||
## The Full HD map cap (FIXED owner decision 2026-11-21, #85): at most this many px on the
|
||||
## long side and on the short side, either orientation. The import shrinks a larger source;
|
||||
## a scene row above it is never rewritten, only warned about at startup.
|
||||
WallPositions* = [wpCenter, wpLeft, wpRight]
|
||||
SightDirs* = [sdBoth, sdLeft, sdRight]
|
||||
Presets* = [pwWall, pwDoor, pwWindow, pwOneWay]
|
||||
@@ -139,6 +144,21 @@ const
|
||||
WallLabelMaxLen* = 64
|
||||
## `wall.label`: the 6.5 text rule, 1..64 code points, trimmed, no control characters (#55).
|
||||
|
||||
proc exceedsMapCap*(w, h: float): bool =
|
||||
## True when a scene/image is larger than the Full HD cap, either orientation (#85). Written so
|
||||
## NaN compares false (a corrupt dimension is not quietly "over the cap").
|
||||
w > 0 and h > 0 and (max(w, h) > float(MapCapLongSide) or min(w, h) > float(MapCapShortSide))
|
||||
|
||||
proc cappedMapSize*(w, h: int): tuple[w, h: int] =
|
||||
## The dimensions a source larger than the cap is shrunk to, preserving proportions and rounding
|
||||
## to whole pixels: `4000x3000 -> 1440x1080`, `16384x16384 -> 1080x1080`. A source at or below
|
||||
## the cap is returned unchanged (no upscaling).
|
||||
result = (w, h)
|
||||
if w <= 0 or h <= 0 or not exceedsMapCap(float(w), float(h)): return
|
||||
let scale = min(1.0, min(float(MapCapLongSide) / max(float(w), float(h)),
|
||||
float(MapCapShortSide) / min(float(w), float(h))))
|
||||
result = (max(1, int(round(float(w) * scale))), max(1, int(round(float(h) * scale))))
|
||||
|
||||
proc defaultWall*(a, b: Vec): WallRec =
|
||||
## The `wall` preset's switches: both blocks on, both-way sight, no marker, no door settings,
|
||||
## zero thickness, centre placement and full height (DESIGN 5.8, 6.1).
|
||||
|
||||
+4
-2
@@ -549,8 +549,10 @@ suite "egress borrows the world instead of copying it (#28)":
|
||||
check sizeof(Context) <= 6 * sizeof(pointer) + 8
|
||||
|
||||
test "building a Context and egressing does not scale with the explored sets":
|
||||
var small = bigStore(16384) # 128 x 128 cells: the v1 map at cell 32
|
||||
var large = bigStore(262144) # 512 x 512 cells: a 16384 px map at cell 32
|
||||
# Synthetic server stress sizes, not the product target: the Full HD maximum is 60 x 34 =
|
||||
# 2040 cells at cell 32 (#85). Kept large so an explored-set regression has room to show.
|
||||
var small = bigStore(16384) # 128 x 128 cells (synthetic)
|
||||
var large = bigStore(262144) # 512 x 512 cells: a 16384 px stress map at cell 32
|
||||
var sink = 0
|
||||
# Wall-clock gates are load-sensitive, so every number below is the *fastest* timed sample
|
||||
# after a warm-up, never a mean: a sample the OS descheduled (or a parallel build on the same
|
||||
|
||||
@@ -510,3 +510,23 @@ suite "scene.set (6.1, slice 10 / #25)":
|
||||
check parseScenePatch(%*{"extra": []}).isNone
|
||||
check parseScenePatch(%*{"extra": newJNull()}).isNone
|
||||
check parseScenePatch(%*{"extra": {}}).isSome
|
||||
|
||||
suite "Full HD map cap (#85)":
|
||||
test "cappedMapSize preserves proportions and never upscales":
|
||||
check cappedMapSize(4000, 3000) == (1440, 1080)
|
||||
check cappedMapSize(3000, 4000) == (1080, 1440)
|
||||
check cappedMapSize(16384, 16384) == (1080, 1080)
|
||||
check cappedMapSize(2000, 2000) == (1080, 1080)
|
||||
check cappedMapSize(1921, 1080) == (1920, 1079)
|
||||
check cappedMapSize(1080, 1921) == (1079, 1920)
|
||||
check cappedMapSize(1920, 1080) == (1920, 1080) # exactly at the cap
|
||||
check cappedMapSize(256, 192) == (256, 192) # smaller is untouched
|
||||
|
||||
test "exceedsMapCap is the long/short side rule, either orientation":
|
||||
check not exceedsMapCap(1920, 1080)
|
||||
check not exceedsMapCap(1080, 1920)
|
||||
check exceedsMapCap(1921, 1080)
|
||||
check exceedsMapCap(1080, 1921)
|
||||
check exceedsMapCap(1920, 1081)
|
||||
check exceedsMapCap(16384, 1080)
|
||||
check not exceedsMapCap(0, 5000) # no pixels, not "over"
|
||||
|
||||
+9
-6
@@ -1,6 +1,8 @@
|
||||
## Vision and egress microbench: devbox run bench (nim c -d:release -r tools/bench.nim; log: results/bench.log).
|
||||
## No timing code lives in server/: this harness times from outside with O(1) accumulators (sum, worst), no sample arrays.
|
||||
## Targets (DESIGN 5.3 / 13 M2, PROPOSED): polygon + cells <= 0.451 ms avg on the prototype scene; polygon < 1 ms avg on 5k walls.
|
||||
## Targets (DESIGN 5.3 / 13 M2, PROPOSED): polygon + cells <= 0.451 ms avg on the prototype scene; polygon < 1 ms avg on the 5k-wall stress scene.
|
||||
## The product map maximum is Full HD (1920x1080, #85); the 16384 px and 262144-cell rows below are labelled
|
||||
## stress references for the server, not the product target.
|
||||
## The egress rows record the absolute averages the in-process gate (tests/tviews.nim, TESTING 5.3) deliberately does not assert.
|
||||
import std/[json, monotimes, times, strformat, os, math, options, sets, tables]
|
||||
import db_connector/db_sqlite
|
||||
@@ -72,10 +74,10 @@ proc big(label: string, world: float) =
|
||||
discard bench(&"1 move check (pathClear, cap-length step), {label}", 20000, proc(i: int) =
|
||||
let o: Vec = (rng.uni(400, world - 400), rng.uni(400, world - 400))
|
||||
sink += int(pathClear(walls, o, (o.x + 300, o.y), 20)))
|
||||
if label == "5k sparse": target("polygon, 5k-wall scene", po, 1.0)
|
||||
big("5k sparse", 16384)
|
||||
big("5k dense", 4096)
|
||||
echo "== egress (#28: 6 players x 40 encountered entries, 262144 explored cells) =="
|
||||
if label == "5k sparse (stress)": target("polygon, 5k-wall stress scene", po, 1.0)
|
||||
big("5k sparse (stress)", 16384)
|
||||
big("5k dense (stress)", 4096)
|
||||
echo "== egress (#28 stress: 6 players x 40 encountered entries, 262144 explored cells) =="
|
||||
proc egressStore(cells: int): ref ContextStore =
|
||||
var tokens: seq[TokenRec]
|
||||
for i in 0 ..< 6:
|
||||
@@ -136,7 +138,8 @@ discard bench("tile gate old: parse + SHA-256 + session JOIN + HashSet", 2000, p
|
||||
discard bench("tile gate new: parse + SHA-256 + cache lookup + bitmap", 2000, proc(i: int) =
|
||||
let h = sha256Hex(benchToken)
|
||||
if gc.gateTile(h, "1", "v1", "9_9.png").allowed: inc sink)
|
||||
# Explored ops: the snapshot build at the 16384 px size (512x512 cells) and the incremental mark.
|
||||
# Explored ops: the snapshot build at a synthetic 16384 px stress size (512x512 cells) and the
|
||||
# incremental mark. The product maximum is Full HD (2040 cells at cell 32, #85).
|
||||
let bigScene = SceneRec(id: 1, name: "Scene", w: 16384, h: 16384, tileSize: 32, cell: 32,
|
||||
visionRadiusDefault: 400, tokenRadiusDefault: 20, artVersion: 1,
|
||||
nextWallId: 1, extra: newJObject())
|
||||
|
||||
+22
-17
@@ -1,10 +1,11 @@
|
||||
## M4 fog benchmark (#76): the 50-token, 16384 px tile map measurement the finish ticket records
|
||||
## in `results/m4-fog-bench.md`. `devbox run fogbench` compiles and runs it; the log lands in
|
||||
## `results/m4-fog-bench.log`.
|
||||
## M4 fog benchmark (#76): the 50-token, Full HD (1920x1080) tile map measurement the finish ticket
|
||||
## records in `results/m4-fog-bench.md`. `devbox run fogbench` compiles and runs it; the log lands in
|
||||
## `results/m4-fog-bench.log`. The Full HD cap is the owner decision of 2026-11-21 (#85), so this is
|
||||
## the product maximum, not the old 16384 px stress map.
|
||||
##
|
||||
## Two numbers the phone gate needs to make sense of:
|
||||
## 1. server recompute on a move: one player's vision refresh (one polygon, ~5k sparse walls,
|
||||
## 16384 px map) plus the egress pass for that player with 50 visible tokens;
|
||||
## 1. server recompute on a move: one player's vision refresh (one polygon, 5k-wall generator
|
||||
## clipped to the Full HD scene) plus the egress pass for that player with 50 visible tokens;
|
||||
## 2. the client's headless frame time is measured separately by `client/e2e/fogbench.test.mjs`
|
||||
## (SwiftShader, so it is a floor, never the phone number it is compared with).
|
||||
##
|
||||
@@ -26,31 +27,35 @@ proc bench(name: string, n: int, f: proc(i: int)): float =
|
||||
echo &"{name}: n={n} avg={sum / n.float:.3f}ms worst={worst:.3f}ms"
|
||||
sum / n.float
|
||||
|
||||
const World = 16384.0
|
||||
const
|
||||
WorldW = 1920.0
|
||||
WorldH = 1080.0
|
||||
const PlayerId = 2
|
||||
|
||||
## 50 tokens: the player's one sighted token at the map centre, 49 NPCs inside its radius. The
|
||||
## cluster is the phone scene (50 tokens rendered with the fog on), so the wall generator's walls
|
||||
## inside that box are removed: the sight cost still comes from the ~5k walls elsewhere.
|
||||
## inside that box are removed. The 5k-wall generator runs on a WorldW square and is clipped to the
|
||||
## Full HD height, so the sight cost still comes from thousands of walls elsewhere.
|
||||
proc build(): ref ContextStore =
|
||||
var tokens: seq[TokenRec]
|
||||
tokens.add TokenRec(id: "vision-token", scene: 1, kind: "pc", descriptiveName: "Ann",
|
||||
actualName: "Ann", pos: (World / 2, World / 2), owner: PlayerId,
|
||||
actualName: "Ann", pos: (WorldW / 2, WorldH / 2), owner: PlayerId,
|
||||
flags: %*{"vision": true}, visionRadius: some(300.0), radius: some(20.0),
|
||||
props: newProps())
|
||||
for i in 0 ..< 49:
|
||||
let dx = float((i mod 7) - 3) * 28.0
|
||||
let dy = float((i div 7) - 3) * 28.0
|
||||
tokens.add TokenRec(id: &"npc-{i}", scene: 1, kind: "npc", descriptiveName: &"T{i}",
|
||||
actualName: &"T{i}", pos: (World / 2 + dx, World / 2 + dy),
|
||||
actualName: &"T{i}", pos: (WorldW / 2 + dx, WorldH / 2 + dy),
|
||||
owner: GmControlled, flags: %*{}, props: newProps())
|
||||
|
||||
let centre = World / 2
|
||||
let centre = (WorldW / 2, WorldH / 2)
|
||||
var walls: seq[WallRec]
|
||||
var id = 0
|
||||
for w in genScene(World, 5000, 1):
|
||||
let near = max(w.a.x, w.b.x) >= centre - 400 and min(w.a.x, w.b.x) <= centre + 400 and
|
||||
max(w.a.y, w.b.y) >= centre - 400 and min(w.a.y, w.b.y) <= centre + 400
|
||||
for w in genScene(WorldW, 5000, 1):
|
||||
if w.a.y > WorldH or w.b.y > WorldH: continue # clipped away by the Full HD scene height
|
||||
let near = max(w.a.x, w.b.x) >= centre[0] - 400 and min(w.a.x, w.b.x) <= centre[0] + 400 and
|
||||
max(w.a.y, w.b.y) >= centre[1] - 400 and min(w.a.y, w.b.y) <= centre[1] + 400
|
||||
if near: continue
|
||||
inc id
|
||||
walls.add WallRec(id: id, a: w.a, b: w.b, thickness: 0, position: wpCenter,
|
||||
@@ -60,7 +65,7 @@ proc build(): ref ContextStore =
|
||||
flags: newJObject())
|
||||
|
||||
result = (ref ContextStore)(scene: SceneRec(
|
||||
id: 1, name: "Scene", w: World, h: World, tileSize: 32, cell: 32,
|
||||
id: 1, name: "Scene", w: WorldW, h: WorldH, tileSize: 32, cell: 32,
|
||||
visionRadiusDefault: 400, tokenRadiusDefault: 20, artVersion: 1, nextWallId: id + 1,
|
||||
extra: newJObject(), walls: walls), tokens: tokens)
|
||||
for pid in 2 .. 7:
|
||||
@@ -70,11 +75,11 @@ proc build(): ref ContextStore =
|
||||
result.encountered[pid] = initTable[string, characters.EncounteredEntry]()
|
||||
|
||||
let store = build()
|
||||
echo &"== M4 fog bench: 16384 px map, cell 32 ({store.scene.cols}x{store.scene.rows} cells), " &
|
||||
echo &"== M4 fog bench: Full HD map 1920x1080, cell 32 ({store.scene.cols}x{store.scene.rows} cells), " &
|
||||
&"{store.tokens.len} tokens, {store.scene.walls.len} walls =="
|
||||
|
||||
# 1. A move refreshes the mover's player: one polygon + its explored cells (main.refreshPlayer).
|
||||
let refreshAvg = bench("server vision refresh, one player (1 polygon, radius 300, ~5k walls)", 500, proc(i: int) =
|
||||
let refreshAvg = bench("server vision refresh, one player (1 polygon, radius 300, 5k-wall generator clipped to the scene)", 500, proc(i: int) =
|
||||
store.visions[PlayerId].refresh(store.scene, store.tokens, PlayerId)
|
||||
sink += store.visions[PlayerId].polys.len)
|
||||
|
||||
@@ -95,7 +100,7 @@ discard egressFrames(Recipient(isGm: false, playerId: PlayerId), ctx, warmKnown)
|
||||
discard bench("player egress pass, warm Known (no changes)", 2000, proc(i: int) =
|
||||
sink += egressFrames(Recipient(isGm: false, playerId: PlayerId), ctx, warmKnown).len)
|
||||
|
||||
echo &"explored snapshot size: {store.visions[PlayerId].explored.card} cells on the 16384 px map"
|
||||
echo &"explored snapshot size: {store.visions[PlayerId].explored.card} cells on the Full HD map"
|
||||
let budget = 16.7
|
||||
echo &"TARGET move path: refresh + 50-token egress {refreshAvg + egressAvg:.3f} ms vs <= {budget} ms " &
|
||||
&"(one 60 fps frame): {(if refreshAvg + egressAvg <= budget: \"PASS\" else: \"MISS\")}"
|
||||
|
||||
@@ -10,6 +10,7 @@ import assert from 'node:assert/strict'
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { spawnSync } from 'node:child_process'
|
||||
import { DatabaseSync } from 'node:sqlite'
|
||||
import { createPlayer, freePort, httpsBaseUrl, namePlayer } from './lib.mjs'
|
||||
import { buildServer, gmKeyOf, makeStateDir, openAs, startServer, stopServer } from './withserver.mjs'
|
||||
import { startTestNginx, stopTestNginx } from './nginx.mjs'
|
||||
@@ -192,6 +193,71 @@ test('map import CLI: the streamed slice matches the one-shot crop pixel for pix
|
||||
}
|
||||
})
|
||||
|
||||
function sceneDims(stateDir) {
|
||||
const db = new DatabaseSync(path.join(stateDir, 'state.db'), { readOnly: true })
|
||||
try {
|
||||
const row = db.prepare('SELECT w, h FROM scene WHERE id = 1').get()
|
||||
return [row.w, row.h]
|
||||
} finally {
|
||||
db.close()
|
||||
}
|
||||
}
|
||||
|
||||
test('map import CLI: images above Full HD are shrunk to the cap, smaller ones untouched (#85)', () => {
|
||||
const stateDir = makeStateDir()
|
||||
try {
|
||||
const cases = [
|
||||
// [name, source w/h, expected scene w/h, expected stdout]
|
||||
['landscape', 4000, 3000, 1440, 1080, 'scaled 4000×3000 → 1440×1080'],
|
||||
['portrait', 3000, 4000, 1080, 1440, 'scaled 3000×4000 → 1080×1440'],
|
||||
['square', 2000, 2000, 1080, 1080, 'scaled 2000×2000 → 1080×1080'],
|
||||
['exactly-at-cap', 1920, 1080, 1920, 1080, null],
|
||||
['one-px-over', 1921, 1080, 1920, 1079, 'scaled 1921×1080 → 1920×1079'],
|
||||
['smaller', 256, 192, 256, 192, null],
|
||||
]
|
||||
for (const [name, w, h, wantW, wantH, scaled] of cases) {
|
||||
const state = path.join(stateDir, name)
|
||||
const img = path.join(state, `${name}.png`)
|
||||
fs.mkdirSync(state, { recursive: true })
|
||||
fs.writeFileSync(img, pngBytesWH(w, h, (x, y) => [x & 0xff, y & 0xff, 128]))
|
||||
const imported = runImport(state, [`--image=${img}`, '--tile-size=64'])
|
||||
assert.equal(imported.status, 0, `${name}: ${imported.stderr}`)
|
||||
assert.deepEqual(sceneDims(state), [wantW, wantH], `${name}: scene row is the imported size`)
|
||||
assert.match(imported.stdout, new RegExp(`${wantW}x${wantH} px, tile 64 px`),
|
||||
`${name}: stdout reports the final size`)
|
||||
if (scaled) assert.ok(imported.stdout.includes(scaled), `${name}: shrink is printed: ${imported.stdout}`)
|
||||
else assert.equal(imported.stdout.includes('scaled '), false, `${name}: no needless resize`)
|
||||
const cols = Math.ceil(wantW / 64)
|
||||
const rows = Math.ceil(wantH / 64)
|
||||
assert.equal(tileNames(path.join(state, 'tiles', '1', 'v1')).length, cols * rows,
|
||||
`${name}: the tile grid follows the shrunk size`)
|
||||
}
|
||||
|
||||
// Alpha survives the resize: a 50% transparent RGBA source is still RGBA at the cap size.
|
||||
const alphaState = path.join(stateDir, 'alpha')
|
||||
const alphaImg = path.join(alphaState, 'alpha.png')
|
||||
fs.mkdirSync(alphaState, { recursive: true })
|
||||
const made = spawnSync('magick', ['-size', '2000x1500', 'xc:rgba(255,0,0,0.5)',
|
||||
'-depth', '8', alphaImg], { encoding: 'utf8' })
|
||||
assert.equal(made.status, 0, made.stderr)
|
||||
const alphaRun = runImport(alphaState, [`--image=${alphaImg}`, '--tile-size=64'])
|
||||
assert.equal(alphaRun.status, 0, alphaRun.stderr)
|
||||
assert.deepEqual(sceneDims(alphaState), [1440, 1080])
|
||||
const tile = path.join(alphaState, 'tiles', '1', 'v1', '0_0.png')
|
||||
const channels = spawnSync('magick', ['identify', '-format', '%[channels]', tile],
|
||||
{ encoding: 'utf8' })
|
||||
assert.equal(channels.status, 0, channels.stderr)
|
||||
assert.match(channels.stdout, /a/, 'the tile still has an alpha channel')
|
||||
const alphaMean = spawnSync('magick', [tile, '-format', '%[fx:mean.a]', 'info:'],
|
||||
{ encoding: 'utf8' })
|
||||
assert.equal(alphaMean.status, 0, alphaMean.stderr)
|
||||
assert.ok(Math.abs(Number(alphaMean.stdout) - 0.50196) < 0.02,
|
||||
`the alpha value survives the resize: ${alphaMean.stdout}`)
|
||||
} finally {
|
||||
fs.rmSync(stateDir, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
|
||||
test('map import CLI: a truncated source fails loudly and publishes nothing (#83)', () => {
|
||||
// The streaming path reads the decoder's stdout band by band; a decode that dies mid-stream must
|
||||
// surface magick's own message, not an empty tile tree or a byte-count mystery.
|
||||
|
||||
+27
-18
@@ -1,10 +1,13 @@
|
||||
// #83: the map import at the real target scale — a 16384x16384 source at tile size 64, i.e. 65,536
|
||||
// tiles. The one-shot `-crop ... +adjoin` this replaces died here with "Too many open files" after
|
||||
// minutes at 4-8 GB RSS, so this gate is the regression proof: bounded memory, bounded file
|
||||
// descriptors (it runs under a low `ulimit -n`), a streamed progress trail, and the full tile tree.
|
||||
// #83/#85: the map import at the old 16384 px input scale, now under the Full HD cap: the source is
|
||||
// shrunk to 1080x1080 before tiling (289 tiles at 64 px, not 65,536). The one-shot
|
||||
// `-crop ... +adjoin` this replaces died here with "Too many open files" after minutes at 4-8 GB
|
||||
// RSS, so this gate is the regression proof: the huge input is shrunk quickly, memory and file
|
||||
// descriptors stay bounded (it runs under a low `ulimit -n`), the streamed progress trail appears,
|
||||
// and the output tile tree follows the shrunk scene.
|
||||
//
|
||||
// It is deliberately NOT part of `devbox run test`: generating the source and writing 65,536 PNGs
|
||||
// takes ~40 s on a 16-core box. `devbox run import-scale` runs it and leaves results/import-scale.log.
|
||||
// It is deliberately NOT part of `devbox run test`: generating the 16384 px source takes seconds,
|
||||
// and the shrink is real ImageMagick work. `devbox run import-scale` runs it and leaves
|
||||
// results/import-scale.log.
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import fs from 'node:fs'
|
||||
@@ -17,8 +20,9 @@ import { pngSize } from './tilefixture.mjs'
|
||||
|
||||
const enabled = process.env.IMPORT_SCALE === '1'
|
||||
const SIDE = 16384
|
||||
const OUT = 1080
|
||||
const TILE = 64
|
||||
const TILE_COUNT = (SIDE / TILE) ** 2
|
||||
const TILE_COUNT = Math.ceil(OUT / TILE) ** 2
|
||||
|
||||
const CRC_TABLE = (() => {
|
||||
const table = new Int32Array(256)
|
||||
@@ -134,7 +138,7 @@ async function runMeasured(args, ulimitN) {
|
||||
peakFds, peakProcs }
|
||||
}
|
||||
|
||||
test('map import CLI: 16384 px source at 64 px stays memory- and fd-bounded (#83)',
|
||||
test('map import CLI: a 16384 px source is shrunk to Full HD and stays memory- and fd-bounded (#83, #85)',
|
||||
{ skip: enabled ? false : 'scale test: run `devbox run import-scale`' }, async () => {
|
||||
const stateDir = makeStateDir()
|
||||
const img = path.join(stateDir, 'map16384.png')
|
||||
@@ -154,23 +158,28 @@ test('map import CLI: 16384 px source at 64 px stays memory- and fd-bounded (#83
|
||||
`peakFds=${run.peakFds} peakProcs=${run.peakProcs} tiles=${tiles.length}`)
|
||||
|
||||
assert.equal(run.status, 0, run.stderr)
|
||||
assert.equal(tiles.length, TILE_COUNT, 'every tile of the 256x256 grid exists')
|
||||
assert.equal(tiles.length, TILE_COUNT, 'the shrunk 1080x1080 scene has all 289 tiles at 64 px')
|
||||
assert.match(fs.readFileSync(`${dir}/0_0.png`).slice(0, 8).toString('latin1'), /^\x89PNG/,
|
||||
'tiles are PNGs')
|
||||
assert.deepEqual(pngSize(`${dir}/255_255.png`), { width: TILE, height: TILE })
|
||||
assert.deepEqual(pngSize(`${dir}/255_0.png`), { width: TILE, height: TILE })
|
||||
assert.deepEqual(pngSize(`${dir}/15_15.png`), { width: TILE, height: TILE })
|
||||
assert.deepEqual(pngSize(`${dir}/15_0.png`), { width: TILE, height: TILE })
|
||||
assert.deepEqual(pngSize(`${dir}/16_16.png`),
|
||||
{ width: OUT - 16 * TILE, height: OUT - 16 * TILE }, 'the last edge tile is 56x56')
|
||||
assert.equal(fs.existsSync(`${dir}/255_255.png`), false,
|
||||
'the 16384 px grid is gone: the scene is the Full HD shrink')
|
||||
|
||||
// Progress must be visible while it runs, not only at the end.
|
||||
assert.match(run.stderr, /slicing 16384x16384 into 65536 tiles at 64 px/)
|
||||
assert.match(run.stderr, /rows 12\/256, tiles 3072\/65536/)
|
||||
assert.match(run.stderr, /rows 256\/256, tiles 65536\/65536/)
|
||||
assert.match(run.stdout, /16384x16384 px, tile 64 px, 256x256 tiles/)
|
||||
// The shrink itself is reported, then the slice of the shrunk image.
|
||||
assert.match(run.stdout, /scaled 16384×16384 → 1080×1080/)
|
||||
assert.match(run.stdout, /1080x1080 px, tile 64 px, 17x17 tiles/)
|
||||
assert.match(run.stderr, /slicing 1080x1080 into 289 tiles at 64 px/)
|
||||
assert.match(run.stderr, /rows 17\/17, tiles 289\/289/)
|
||||
|
||||
// The numbers are the point of this gate: 4-8 GB and 1024 fds were the old failure.
|
||||
// The numbers are the point of this gate: 4-8 GB and 1024 fds were the old failure, and a
|
||||
// 16384 px input used to mean minutes and 65k tiles.
|
||||
assert.ok(run.peakRssMiB < 1024, `peak RSS ${run.peakRssMiB.toFixed(0)} MiB must stay under 1 GiB`)
|
||||
assert.ok(run.peakFds < 256, `peak fds ${run.peakFds} must stay far under the 256 ulimit`)
|
||||
assert.ok(run.peakProcs <= 12, `only the importer, one decoder and <=8 children may run (saw ${run.peakProcs})`)
|
||||
assert.ok(run.ms < 600_000, `a 16384/64 import must finish in minutes, took ${run.ms} ms`)
|
||||
assert.ok(run.ms < 180_000, `the huge input must be shrunk and tiled in minutes, took ${run.ms} ms`)
|
||||
|
||||
assert.equal(fs.readdirSync(path.join(stateDir, 'tiles', '1'))
|
||||
.some(n => n.startsWith('.import-')), false, 'no temporary directory is left behind')
|
||||
|
||||
+28
-7
@@ -127,23 +127,32 @@ function importImage(opts, stateDir) {
|
||||
}
|
||||
}
|
||||
|
||||
/** The map a no-image start will serve, read from the state db without starting anything. */
|
||||
function describeScene(stateDir) {
|
||||
// The Full HD map cap (FIXED owner decision 2026-11-21, #85); the server warns in its own log,
|
||||
// this is the same warning on the console where the operator actually looks.
|
||||
const CAP_LONG = 1920
|
||||
const CAP_SHORT = 1080
|
||||
|
||||
function readSceneRow(stateDir) {
|
||||
const dbFile = path.join(stateDir, 'state.db')
|
||||
if (!fs.existsSync(dbFile)) return 'fresh state: default 4096x4096, tile 32, art v1'
|
||||
if (!fs.existsSync(dbFile)) return { text: 'fresh state: default 4096x4096, tile 32, art v1' }
|
||||
let db
|
||||
try {
|
||||
db = new DatabaseSync(dbFile, { readOnly: true })
|
||||
const row = db.prepare('SELECT w, h, tile_size, art_version FROM scene WHERE id = 1').get()
|
||||
if (!row) return `no scene row in ${dbFile}`
|
||||
return `${row.w}x${row.h}, tile ${row.tile_size}, art v${row.art_version}`
|
||||
if (!row) return { text: `no scene row in ${dbFile}` }
|
||||
return { row, text: `${row.w}x${row.h}, tile ${row.tile_size}, art v${row.art_version}` }
|
||||
} catch (e) {
|
||||
return `unreadable ${dbFile} (${e.message})`
|
||||
return { text: `unreadable ${dbFile} (${e.message})` }
|
||||
} finally {
|
||||
db?.close()
|
||||
}
|
||||
}
|
||||
|
||||
/** The map a no-image start will serve, read from the state db without starting anything. */
|
||||
function describeScene(stateDir) {
|
||||
return readSceneRow(stateDir).text
|
||||
}
|
||||
|
||||
/** `--dry-run`: prove the `--` arguments reached this script, then exit without side effects. */
|
||||
function printDryRun(opts, stateDir) {
|
||||
const lines = [
|
||||
@@ -157,7 +166,14 @@ function printDryRun(opts, stateDir) {
|
||||
` image: ${opts.image ? path.resolve(opts.image) : '<none, keeping current map>'}`,
|
||||
` tile-size: ${opts.tileSize ?? '<none>'}`,
|
||||
]
|
||||
if (!opts.image) lines.push(` current map: ${describeScene(stateDir)}`)
|
||||
if (!opts.image) {
|
||||
lines.push(` current map: ${describeScene(stateDir)}`)
|
||||
const { row } = readSceneRow(stateDir)
|
||||
if (row && (Math.max(row.w, row.h) > CAP_LONG || Math.min(row.w, row.h) > CAP_SHORT)) {
|
||||
lines.push(` WARNING: map is ${row.w}x${row.h}, above the Full HD cap ` +
|
||||
`(at most ${CAP_LONG} px long side, ${CAP_SHORT} px short side); re-import to shrink.`)
|
||||
}
|
||||
}
|
||||
process.stdout.write(lines.join('\n') + '\n')
|
||||
}
|
||||
|
||||
@@ -213,6 +229,11 @@ function printStartup(handle) {
|
||||
if (!fs.existsSync(distDir)) {
|
||||
lines.push(`WARNING: no client build at ${distDir}; "/" will 404 until it is built.`, '')
|
||||
}
|
||||
const { row } = readSceneRow(stateDir)
|
||||
if (row && (Math.max(row.w, row.h) > CAP_LONG || Math.min(row.w, row.h) > CAP_SHORT)) {
|
||||
lines.push(`WARNING: map is ${row.w}x${row.h}, above the Full HD cap ` +
|
||||
`(at most ${CAP_LONG} px long side, ${CAP_SHORT} px short side); re-import to shrink.`, '')
|
||||
}
|
||||
lines.push('The certificate only names this LAN address; if the laptop\'s address changes,',
|
||||
'`devbox run serve` regenerates it and prints these steps again.', '')
|
||||
process.stdout.write(lines.join('\n') + '\n')
|
||||
|
||||
Reference in New Issue
Block a user