feat(m4): playtest friction: perf overlay, fresh import, token seed (#82)

Opt-in ?perf=1 overlay (fps, frame p50/p95, JS p50/p95, tokens, zoom; no node or ticker work when off). fff-vtt import creates and migrates a fresh/empty state dir through the shared server startup path; devbox run serve gains --image. devbox run seed creates deterministic labelled NPC tokens over the real WS (idempotent rerun, --replace), and the GM token form defaults X/Y to the viewport centre.
This commit is contained in:
2026-11-21 17:20:05 +01:00
parent 356705823b
commit 9c7f9de910
20 changed files with 933 additions and 53 deletions
+6
View File
@@ -15,6 +15,7 @@ import {
pinchCamera,
screenToWorld,
tileUrl,
viewportCentre,
visibleTiles,
worldToScreen,
zoomCamera,
@@ -78,6 +79,11 @@ describe('camera', () => {
expect(screen[1]).toBeCloseTo(80, 10)
})
it('viewportCentre is the world point under the middle of the screen (#82)', () => {
expect(viewportCentre(centredCamera(scene, size), size)).toEqual([2048, 2048])
expect(viewportCentre({ x: -100, y: -200, zoom: 2 }, size)).toEqual([130, 180])
})
it('zoomCamera keeps the world point under the anchor fixed and clamps', () => {
const camera = { x: -1000, y: -800, zoom: 1 }
const anchor = { x: 120, y: 200 }