Research: sight with thick and low walls #39

Closed
opened 2026-11-15 15:48:53 +01:00 by SirStone · 1 comment
Owner

Part of #38

Question

How do 2D top-down sight systems handle walls with thickness and with height (see-over), and what does each approach cost against our sight budget (polygon <1 ms, 5k-wall scene, per-move recompute)? Options, trade-offs, measured or cited costs; compatibility with our ray-fan polygon and cell-based explored set.

Part of #38 ## Question How do 2D top-down sight systems handle walls with thickness and with height (see-over), and what does each approach cost against our sight budget (polygon <1 ms, 5k-wall scene, per-move recompute)? Options, trade-offs, measured or cited costs; compatibility with our ray-fan polygon and cell-based explored set.
SirStone added the wayfinder:research label 2026-11-15 15:48:53 +01:00
SirStone added a new dependency 2026-11-15 15:48:58 +01:00
SirStone self-assigned this 2026-11-15 15:49:31 +01:00
Author
Owner

Resolved. Findings: docs/research/walls-sight-thick-low.md (commit b472077 on main).

Gist:

  • Thickness as a rectangle in the ray fan costs 3.1x (0.084 -> 0.257 ms) on the 5k sparse scene, inside the 1 ms target; 9.9x (1.284 -> 12.779 ms) on the 5k dense stress scene, 12x over. Cheaper variants measured: 2 offset faces 3.8 ms dense, 1 near face = same cost as thin. Rays and segments both grow (6 -> 24 rays, 1 -> 4 segments per wall), so it is ~16x raw work per wall, not 4x.
  • Thick polygons are always a subset of thin ones (0 explored cells gained). Cells lost to a 10 px wall: 4.6 % of the polygon on the prototype scene, 9.7 % 5k sparse, 53 % 5k dense - it scales with t / room size; the 32 px tile/cell residual of Q4 absorbs the realistic case.
  • Height cannot go into one 2D polygon: a low wall hides a band behind it of depth s * h_wall / (h_eye - h_wall) (s = viewer distance to the wall), so the boundary is a curve, and a ray fan can only shorten rays, never resume them. Every engine surveyed (Foundry restriction levels + Scene Levels, FG terrain, Roll20 transparent/one-way, the Wall Height module) models see-over as a predicate, never as occluder geometry.
  • Cheapest see-over we can express is a per-ray distance threshold (one float compare per candidate hit): 0.088 vs 0.084 ms sparse, 1.18 vs 1.28 ms dense - within noise, and it is literally Foundry's Proximity/Reverse Proximity. Per-target 3D LOS on top of the polygon: 0.55-0.60 ms per 40 targets at 5k walls unindexed (0.10 ms with candidates precomputed), vs 0.025 ms for today's insideAny.
  • Nothing structural changes: explored chunks stay 64x64 = 512 B, the wire stays a full integer-px polygon (Q16, 2.5-3.7x more vertices), the tile gate stays one cell = one tile. What needs work is the leak checker's zero-width clearLine oracle, the tile-gate oracle and the bench baseline.

No decisions taken; the cost table is the input for "Height model" (#41), "Low walls" (#44) and "Thick walls" (#45). Also relevant to "One-way walls" (#47): Roll20's documented one-way use is elevation, so one-way and low walls may be one mechanism seen from both sides.

Resolved. Findings: `docs/research/walls-sight-thick-low.md` (commit `b472077` on main). Gist: - Thickness as a rectangle in the ray fan costs 3.1x (0.084 -> 0.257 ms) on the 5k sparse scene, inside the 1 ms target; **9.9x (1.284 -> 12.779 ms) on the 5k dense stress scene**, 12x over. Cheaper variants measured: 2 offset faces 3.8 ms dense, 1 near face = same cost as thin. Rays and segments both grow (6 -> 24 rays, 1 -> 4 segments per wall), so it is ~16x raw work per wall, not 4x. - Thick polygons are always a subset of thin ones (0 explored cells gained). Cells lost to a 10 px wall: 4.6 % of the polygon on the prototype scene, 9.7 % 5k sparse, 53 % 5k dense - it scales with `t / room size`; the 32 px tile/cell residual of Q4 absorbs the realistic case. - Height cannot go into one 2D polygon: a low wall hides a band behind it of depth `s * h_wall / (h_eye - h_wall)` (s = viewer distance to the wall), so the boundary is a curve, and a ray fan can only shorten rays, never resume them. Every engine surveyed (Foundry restriction levels + Scene Levels, FG terrain, Roll20 transparent/one-way, the Wall Height module) models see-over as a predicate, never as occluder geometry. - Cheapest see-over we can express is a per-ray distance threshold (one float compare per candidate hit): 0.088 vs 0.084 ms sparse, 1.18 vs 1.28 ms dense - within noise, and it is literally Foundry's Proximity/Reverse Proximity. Per-target 3D LOS on top of the polygon: 0.55-0.60 ms per 40 targets at 5k walls unindexed (0.10 ms with candidates precomputed), vs 0.025 ms for today's `insideAny`. - Nothing structural changes: explored chunks stay 64x64 = 512 B, the wire stays a full integer-px polygon (Q16, 2.5-3.7x more vertices), the tile gate stays one cell = one tile. What needs work is the leak checker's zero-width `clearLine` oracle, the tile-gate oracle and the bench baseline. No decisions taken; the cost table is the input for "Height model" (#41), "Low walls" (#44) and "Thick walls" (#45). Also relevant to "One-way walls" (#47): Roll20's documented one-way use is elevation, so one-way and low walls may be one mechanism seen from both sides.
Sign in to join this conversation.