W4: Points of interest

PoiSet.generate(island) places 10 to 16 points of interest per island from
the seed's "poi" stream: hilltop shrines, lighthouses, docks, salt works,
quarries and fishing hamlets, at least 85 m apart. Each kind has a siting
rule (height band, flatness, coast or summit) that loosens step by step
until its minimum is placed. Piers are sited so their deck clears the
ground all the way out to water 1.5 m deep.

Poi assembles each from modular parts in a local frame turned in quarter
turns, so every solid stays an axis-aligned box: walls with a door and
lintel, plinths, steps down to the ground, roofs, a stair to a loft. Each
POI carries loot spawn markers, exposed through PoiSet.loot_markers(),
and walking routes from open ground into its interiors.

- Simulation adds every POI solid to its ground and never spawns players
  inside one.
- SimGround indexes solids in 8 m cells, so collision queries only test
  nearby boxes. Smoke p95 tick is 0.47 ms with about 300 solids.
- Movement tests the body where it will stand after stepping up, so
  stairs with treads narrower than the body can be climbed. The
  traversal test found the lighthouse stair impassable without it.
- PoiView draws parts as one MultiMesh per look, in the seafaring
  palette. Capture scenarios poi_<kind> frame each kind.
- Summit stone is darker so it no longer reads as snow.

Tests: 30 seeds get every kind within its limits, 10 to 16 in total,
spaced and sited; placement is deterministic; loot markers stand on
floors and are not inside solids; a player walks every route of every
POI on 4 seeds through doors, up steps and the lighthouse stair; stairs
with 0.45 m treads are climbed and a step doesn't carry the body into a
wall; the solid index matches a full scan on 500 queries.

Closes #11

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-10 14:47:10 -05:00
co-authored by Claude Opus 5.5
parent 8b74485168
commit 5021d13686
23 changed files with 949 additions and 13 deletions
+27
View File
@@ -273,3 +273,30 @@ func _rough_simulation() -> Simulation:
for _index: int in 4:
sim.add_player()
return sim
func test_climbs_stairs_with_treads_narrower_than_the_body() -> void:
# Treads of 0.45 m are narrower than the 0.8 m body, so the next riser is under the
# body's front edge before its centre is lifted onto the current step. (Treads
# narrower than the 0.4 m radius can't be climbed: the second riser is reached
# before the centre is on the first.)
var ground: SimGround = SimGround.flat()
for index: int in 12:
ground.add_solid(AABB(Vector3(10.0 + index * 0.45, 0.0, 8.0), Vector3(0.45, 0.35 * (index + 1), 4.0)))
# A landing at the top, so the player stays up there.
ground.add_solid(AABB(Vector3(15.4, 0.0, 8.0), Vector3(20.0, 0.35 * 12, 4.0)))
var player: SimEntity = _player(Vector3(8.0, 0.0, 10.0))
_run(player, ground, 90, Vector2(0.0, 1.0), EAST)
assert_near(player.position.y, 0.35 * 12, 0.01, "should stand on the top step")
assert_true(player.position.x > 15.0, "should have walked up the flight")
func test_a_step_does_not_let_the_body_through_a_wall_behind_it() -> void:
# A climbable 0.4 m step with a 1.5 m wall right behind it: stepping up must not
# carry the body into the wall.
var ground: SimGround = SimGround.flat()
ground.add_solid(AABB(Vector3(10.0, 0.0, 8.0), Vector3(0.5, 0.4, 4.0)))
ground.add_solid(AABB(Vector3(10.5, 0.0, 8.0), Vector3(1.0, 1.5, 4.0)))
var player: SimEntity = _player(Vector3(8.0, 0.0, 10.0))
_run(player, ground, 90, Vector2(0.0, 1.0), EAST)
assert_true(player.position.x < 10.5 - Tuning.PLAYER_RADIUS + 0.01, "walked into the wall to x %.2f" % player.position.x)