Status: done (2026-11-12)
Priority: 3
Size: S
Arch: debt
Phase: implement
Design ref: Claims, ownership and territory (Cached overlay: Proposed; the open challenge of a modular and fast overlay).
Goal: VB-004’s Land overlay (src/page/land.js) is redrawn whole whenever st.landDirty holds tiles, at most twice a second. At 1,000 pawns, with fields and plots changing hands and, from slice 5, fields foreclosed and let, redraw only what changed.
Acceptance criteria (rewritten by VB-184, 11 Nov 2026):
src/page/chunks.js), one graphics object a chunk; the dirty tiles of st.landDirty (already marked by setOwner and the claim helpers) name the chunks to redraw, with their neighbours where an edge or a border crosses into them; the page clears the set as now.node tools/shot.js).docs/roadmap.md, section 3.5; the slices Decided by Kim): moved to slice 5, arch debt (from claims). blocked until the slice’s plan (VB-184) confirms, rewrites or closes it.st.landDirty, VB-004), so what is left is drawing by chunk. Page only; no simulation change, golden unchanged. Independent of the debt chain.src/page/land.js: one PIXI.Graphics per chunk of LV[0].size (512 units; about 190 chunks on a medium map), holding the tiles whose centre lies in
it; landIndex() buckets the tiles per world, resetLand() (called by the loader) destroys the graphics. refreshLand() runs each frame while the
overlay is on (animate.js: landOn || landDirty.size): it turns st.landDirty into stale chunk keys (the tile’s chunk and its neighbours’ chunks,
for an edge or a border) and clears the set, then draws the stale chunks in view (view plus two hexes): a first drawing at once, a redraw of a drawn
chunk at most twice a second, within 10 ms a frame (one chunk at least); the other chunks wait stale and hidden. Toggling on marks all stale, so the
chunks in view draw first and the rest as the camera reaches them. Claims, cairns and wood are looked up per tile of the chunk (no loop over all claims).chunks.js (LV[0]); the overlay needs no canvas, only a grid of the same units.npm test: 111 scripts passed (4 targets out, none of them near the page); tests/browser.js, browser-mobile.js, smoke.js run singly: green.
No sim change: golden and counters untouched.docs/img/vb045-{before,after}-{island,close1}.jpg (small map, populous seed 7, 3 years, overlay on), compared by pixel difference
(PIL): island 21 pixels of 1.3 M differ by more than 24/255, close-up 366 (0.03 %), all in clouds and moving pawns; the overlay looks the same by eye.performance.now around refreshLand; one tile of the first village marked dirty with the overlay on; a few samples,
noisy because the throttle runs on page time, which the slow frames stretch): before, a whole redraw: village view 37.9, 23.9, 9.3 ms; island view 9.7,
19.4, 15.3 ms. After, a chunk redraw: village view 2.9 ms, island view 0.9 ms (other calls are an idle check of 0.1 to 0.2 ms). Frame time itself (rAF)
is dominated by the software renderer (600 to 900 ms either way) and shows no difference. A first drawing at the island view costs 3 frames of 70 ms
mean (up to 130 ms) after, against one whole-map stall before. The runs were not during a moving round at game speed: the slow frames let the game
advance only a few days in 20 s, so there was no natural dirt in the before run; hence the marked tile. The large map was not tried (generation too slow).npm run verify as a whole (orchestrator’s rule tonight).