B2: Grid building and placement preview

Server-authoritative grid building with wall, floor, ramp, roof and
breakwater pieces in driftwood, stone and salvage iron, plus a client
placement ghost.

- StructureSet: pieces in grid slots (floor, two wall edges, cell
  volume), their collision boxes in SimGround, and touching-neighbour
  links kept up to date for B3. Ramps are stairs of 0.4 m steps; walls
  over lower ground get a skirt down to the terrain; roofs are a low
  stepped pyramid. Pieces are part of the state hash.
- Building: target() snaps look and position to a slot, and check()
  validates any slot as if a hostile client chose it: state, range,
  occupancy, trapping a player, cost and support. Fire in build mode
  places at most 10 pieces a second; players in a low step are lifted.
- Levels are half a cell (2 m) apart, so ground pieces sit within a
  metre of the builder's feet instead of being half buried.
- Client: StructureView draws pieces from their boxes in plank, course
  or panel strips; ramps draw as a sloped deck. BuildGhost shows sea
  green or rust red from the same target() and check().
- Tests: 15 sim tests (targeting, every rejection, overlap, support,
  stairs climbable, skirts, determinism, 24 builders at 10 pieces a
  second within the tick budget) and 5 client tests (ghost states,
  ghost agrees with the server, view sync, mesh orientation).
- Capture scenarios build_fort and build_fort_side.

Closes #16

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-11 14:23:29 -05:00
co-authored by Claude Opus 5.5
parent b847ba9695
commit f35ebf7171
21 changed files with 1327 additions and 0 deletions
+14
View File
@@ -154,6 +154,20 @@ and `build_seconds`, and materials trade speed for strength. A piece goes up qui
reaches full health only after its `build_seconds` have passed. Pieces with no connection
to the ground collapse.
**Placing.** Build mode (Q) shows a ghost of the selected piece where it would go:
sea green if it can be placed, rust red if not. The look direction snaps to a quarter
turn. Walls and breakwaters go on the edge of your own cell in that direction; floors,
ramps and roofs go in the next cell, or in your own cell when you look well down. Ramps
rise away from you. Pieces snap up and down to levels `BUILD_LEVEL_METRES` (half a cell)
apart, choosing the level nearest your feet, or a whole cell higher when you look well
up. A wall built over lower ground gets a skirt down to the terrain, so there is no gap
underneath. The server places a piece only if it is in range (`BUILD_RANGE`), its slot
(and the same slot half a cell up or down) is empty, it wouldn't trap a player, you can
afford it, and it touches the terrain or another piece. A player standing in the low
step of a new floor or ramp is lifted onto it. Holding fire places up to 10 pieces a
second (`BUILD_INTERVAL_TICKS`). Ramps are stairs of `RAMP_STEPS` steps underneath,
drawn as a sloped deck.
**Harvesting.** Holding fire with the boathook swings once every `1 / fire_rate` seconds.
A swing reaches the boathook's `range_max` plus `HARVEST_REACH_SLACK` from the eye, and
hits the nearest standing prop it passes within `HARVEST_AIM_SLACK` of, unless terrain or