bench: harness with synthetic 5k-wall scenes (devbox run bench), scenegen + tests

Targets met without a spatial grid: polygon+cells 0.048 ms (<= 0.451) on the prototype scene, polygon 0.083 ms
(< 1 ms) on 5k sparse. 5k dense stress layout reported (1.28 ms). Logs: results/bench.log, nimble-test.log.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-08 12:15:31 +01:00
co-authored by Claude Sonnet 5.5
parent afe84f2add
commit e0705a8533
7 changed files with 228 additions and 16 deletions
+17
View File
@@ -0,0 +1,17 @@
== prototype scene (60 walls, 8 tokens, radius 400, cell 32) ==
1 poly (jittered start positions): n=2000 avg=0.036ms worst=0.121ms
6 polys (one 6-token party): n=500 avg=0.204ms worst=0.264ms
1 poly + cellsTouched (scanline): n=2000 avg=0.049ms worst=0.339ms
6 polys + cellsTouched (scanline): n=300 avg=0.265ms worst=0.353ms
1 poly + cellsTouchedOld (prototype reference): n=500 avg=0.726ms worst=2.365ms
TARGET polygon+cells, prototype scene (prototype baseline 0.451): 0.049 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.082ms worst=0.127ms
1 poly + cellsTouched, 5k sparse: n=2000 avg=0.096ms worst=0.145ms
1 move check (pathClear, cap-length step), 5k sparse: n=20000 avg=0.010ms worst=0.131ms
TARGET polygon, 5k-wall scene: 0.082 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=1.282ms worst=3.079ms
1 poly + cellsTouched, 5k dense: n=2000 avg=1.319ms worst=2.817ms
1 move check (pathClear, cap-length step), 5k dense: n=20000 avg=0.009ms worst=0.116ms
(sink 6023672)
+77 -16
View File
@@ -1,5 +1,7 @@
Info: Using the environment variable: NIMBLE_DIR='/home/davide/Projects/GDR/FFF_vtt/.devbox/nimble'
Info: using /nix/store/0cbdz34lsakfirycixckf6ypsd8hazhg-x86_64-unknown-linux-gnu-nim-wrapper-2.2.12/bin/nim for compilation
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/testutil (from package fff_vtt) using c backend
Success: Execution finished
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tgeometry (from package fff_vtt) using c backend
Nim Output [Suite] visibility
... [OK] open space is a circle
@@ -20,7 +22,29 @@
... [OK] long thin corridor
... [OK] wall endpoints behind the viewer: fan stays angularly ordered
... [OK] radius clips
... [Suite] moves
... [Suite] cells
... [OK] square polygon
... [OK] tiny polygon inside one cell
... [OK] polygon spanning a cell with no vertex in it
... [OK] big polygon includes fully covered interior cells
... [OK] degenerate input: fewer than 3 vertices
... [OK] touching a cell line: inclusive on the max side, not on the bbox minimum side
... [OK] concave polygon: a notch cell is not filled
... [Suite] seed
... [OK] every token in seed sees itself and is not walled in
... [Suite] corpus (prototype leak transcripts)
... [OK] visibilityPolygon and cellsTouched equal the prototype results
... [Suite] cellsTouched differential vs prototype
... [OK] random visibility polygons: identical cell lists
... [OK] random simple polygons (star-shaped, concave): identical cell lists
... [OK] grid-aligned integer polygons (edges on cell lines): identical cell lists
... [Suite] explored oracle (independent, tolerance 0.5 px)
... [OK] prototype scene, all tokens, doors closed and opened
... [OK] random wall fields, cell 32 and 25
... [OK] negative control: the oracle notices a missing and an invented cell
Success: Execution finished
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tmoverules (from package fff_vtt) using c backend
Nim Output [Suite] pathClear, r = 0 (ported prototype move tests)
... [OK] crossing blocked, parallel ok
... [OK] grazing an endpoint is blocked
... [OK] no leak through shared vertex
@@ -28,20 +52,57 @@
... [OK] moving along a collinear wall is blocked
... [OK] doors
... [OK] zero-length move
... [Suite] cells
... [OK] square polygon
... [OK] tiny polygon inside one cell
... [OK] polygon spanning a cell with no vertex in it
... [OK] big polygon includes fully covered interior cells
... [Suite] seed
... [OK] every token in seed sees itself and is not walled in
... [Suite] token clearance (r=20)
... [OK] near pillar: circle overlapping blocked, clear ok
... [OK] near closed door blocks, open door passes
... [OK] 64px corridor and doorway passable on centerline
... [OK] legacy overlap can escape, not stay overlapped
... [Suite] door/wall closing on a token (M1 pins current behaviour)
... [OK] door closed on a token: Q14 undecided, DESIGN 5.4 vs 12 H2 conflict
... [OK] KNOWN LIMITATION: token exactly on a wall cannot move off it
... [Suite] capsule (swept circle), r = 20
... [OK] near pillar: circle overlapping blocked, clear ok (ported)
... [OK] closed door blocks near, open door passes (ported)
... [OK] 64px corridor and doorway passable on the centreline (ported)
... [OK] corner clipping: path passes the wall end closer than r though both ends are clear
... [OK] parallel pass: r clear, just under r blocked (touching at exactly r is clear)
... [OK] diagonal squeeze past an L corner with a gap narrower than 2r is blocked
... [OK] leg of the path inside r of a non-start wall blocks even if start and end are clear
... [Suite] token on / near a wall: escape (replaces the KNOWN LIMITATION pin)
... [OK] exactly on a wall: can step off perpendicular, either side, to a clear spot
... [OK] exactly on a wall: still refused when it would stay overlapped or run along/through
... [OK] r = 0: standing on a wall is not an escape case (touch blocks), as the prototype
... [OK] overlapping 10 px off: may leave away from the wall, not cross it, not stay overlapped
... [OK] escaping one wall does not excuse another
... [OK] escape from a closed door; an open door never needed an escape
... [OK] overlapping at a wall end: leave past the end without crossing
... [Suite] move rules: player vs GM, step cap, uniform nack
... [OK] owner check: not yours is mkError, no position
... [OK] GM-controlled token (no owner): players get mkError
... [OK] step cap = scene default without vision, token vision radius with it
... [OK] over-cap, blocked-by-wall, blocked-flag and out-of-bounds nacks are identical
... [OK] an accepted move applies and echoes the destination
... [OK] player move honours walls (capsule) via moveToken
... [OK] GM: ignores walls, step cap and blocked; bounds still apply
... [Suite] blocked flag
... [OK] wall added within r of the circle (centre not on it) sets blocked; exactly r does not
... [OK] GM-controlled tokens get the flag too; wall bbox does not matter, distance does
... [OK] open door added or opened never sets; closing a door on a token does
... [OK] blocked token: player moves refused, GM move allowed and does not clear
... [OK] cleared by removing the wall; unrelated removals keep it
... [OK] cleared by opening the door; a second open is a no-op
... [OK] cleared by the GM; not re-set by itself
... [OK] wall update = remove then add
... [OK] GM placement and GM move onto a wall never set blocked, and the token can escape
... [OK] Q14: a door closed 10 px from a token: token blocked, player refused, GM moves it, opening frees it
... [OK] unconfirmed (b), pinned: opening a door clears blocked although another closed wall still overlaps
... [Suite] seed scene
... [OK] no escape hatch: a player cannot walk through any wall of a boxed room
Success: Execution finished
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tprobing (from package fff_vtt) using c backend
Nim Output [Suite] probing (T8)
... [OK] P1: probes longer than the cap get one fixed nack regardless of the scene
... [OK] P2: scenes differing only beyond the bound give identical replies over 3000 probes
... [OK] P3 negative control: a wall inside the disc IS visible through replies (the harness can fail)
... [OK] P4: probing cannot unflag or move a blocked token
... [OK] doors beyond the bound: opening or closing them changes no reply
Success: Execution finished
Compiling /home/davide/Projects/GDR/FFF_vtt/tests/tscenegen (from package fff_vtt) using c backend
Nim Output [Suite] scenegen (bench scenes)
... [OK] exactly n walls, deterministic per seed, seeds differ
... [OK] doors are every 10th wall, all closed; walls stay inside the world (+- jitter)
... [OK] walls are non-degenerate and axis-ish segments of room-edge length
Success: Execution finished
Success: All tests passed