W5 Vegetation and harvestable props #12

Closed
opened 2026-11-09 05:26:06 +00:00 by claude · 1 comment
Owner

Depends on: W3

Scatter trees, rocks, wrecks and crates by biome, using MultiMesh on the client and lightweight collision and health on the server.

Acceptance

  • Placement is deterministic and agrees between client and server.
  • Props have health and can be destroyed.
  • Thousands of props stay within the frame budget.
**Depends on:** W3 Scatter trees, rocks, wrecks and crates by biome, using MultiMesh on the client and lightweight collision and health on the server. **Acceptance** - Placement is deterministic and agrees between client and server. - Props have health and can be destroyed. - Thousands of props stay within the frame budget.
claude added this to the v0.2 Movement and Island milestone 2026-11-09 05:26:06 +00:00
claude added the type/feature label 2026-11-09 05:26:06 +00:00
claude added this to the Tidewall v1.0 project 2026-11-09 15:00:04 +00:00
eric closed this issue 2026-11-11 17:17:47 +00:00
Author
Owner

Done in 5db53de.

What changed

  • PropSet (src/sim/prop_set.gd) places pines, scrub, boulders, wrecks and crates from the seed on a jittered 4 m grid. Density is set per elevation band in Tuning.PROP_DENSITY, and grove noise thins or thickens the forest. Every square draws the same number of random values, so one square's outcome never shifts the next. Props keep PROP_POI_CLEARANCE from POI solids, loot markers and walking routes, and stay off spots too steep for their kind. That gives about 2,900 to 3,400 props per island.
  • Each prop is one collision box in SimGround, with health and a harvest material from Tuning.PROP_KINDS. Simulation.damage_prop() destroys a prop at zero health and removes its box at once through the new SimGround.remove_solid(), which never reuses IDs. Prop health is part of state_hash().
  • PropView (src/client/props/prop_view.gd) draws one MultiMesh per kind per 128 m square: about 150 instanced draws for 3,200 props. Each kind has its own visibility range (scrub and crates drop out first). The meshes are procedural, low-poly and flat-shaded, coloured per vertex in the palette, and fitted to the collision boxes. sync() hides felled props by reading only the new destruction records.

Tests (make check: 133 passed, plus self-check and smoke, p95 tick 0.51 ms with 24 bots)

  • Client and server agree on layout (a hash of every box and yaw), and different seeds give different layouts.
  • Six seeds each get at least 2,000 props and every kind. Props sit on land, aren't buried and keep clear of POIs.
  • A player walking into a pine is stopped at the trunk. After the pine takes enough hits to fall, the same walk passes through where it stood.
  • Damage is deterministic and hashed. Invalid, zero and negative damage is ignored.
  • 24 players sprinting through the forest: mean sim tick about 0.4 ms.
  • View: one instance per prop, instances fit their boxes, mesh normals face outward, felled props vanish, and draws stay at most squares × kinds. Headless, the build took 7 ms and syncing 54 felled props took 26 µs.

Captures (Forward+ on Lavapipe): props_forest, props_felled, props_overview, props_beach, props_crate and props_highland in test/capture/. I looked at each one. While doing that I found and fixed vertex colours being read as linear (washed out) and a pale specular on needle tips that read as snow.

Not verified: GPU frame time. "Within the frame budget" is supported by the draw count, the per-kind culling and the sim and main-thread costs above, but software rendering can't time a real GPU. That needs Eric's playtest (R6).

Follow-ups for later milestones: hooking harvesting into tools and materials (building, v0.3), and the art pass on prop meshes (v0.6).

Done in 5db53de. **What changed** - `PropSet` (`src/sim/prop_set.gd`) places pines, scrub, boulders, wrecks and crates from the seed on a jittered 4 m grid. Density is set per elevation band in `Tuning.PROP_DENSITY`, and grove noise thins or thickens the forest. Every square draws the same number of random values, so one square's outcome never shifts the next. Props keep `PROP_POI_CLEARANCE` from POI solids, loot markers and walking routes, and stay off spots too steep for their kind. That gives about 2,900 to 3,400 props per island. - Each prop is one collision box in `SimGround`, with health and a harvest material from `Tuning.PROP_KINDS`. `Simulation.damage_prop()` destroys a prop at zero health and removes its box at once through the new `SimGround.remove_solid()`, which never reuses IDs. Prop health is part of `state_hash()`. - `PropView` (`src/client/props/prop_view.gd`) draws one MultiMesh per kind per 128 m square: about 150 instanced draws for 3,200 props. Each kind has its own visibility range (scrub and crates drop out first). The meshes are procedural, low-poly and flat-shaded, coloured per vertex in the palette, and fitted to the collision boxes. `sync()` hides felled props by reading only the new destruction records. **Tests** (`make check`: 133 passed, plus self-check and smoke, p95 tick 0.51 ms with 24 bots) - Client and server agree on layout (a hash of every box and yaw), and different seeds give different layouts. - Six seeds each get at least 2,000 props and every kind. Props sit on land, aren't buried and keep clear of POIs. - A player walking into a pine is stopped at the trunk. After the pine takes enough hits to fall, the same walk passes through where it stood. - Damage is deterministic and hashed. Invalid, zero and negative damage is ignored. - 24 players sprinting through the forest: mean sim tick about 0.4 ms. - View: one instance per prop, instances fit their boxes, mesh normals face outward, felled props vanish, and draws stay at most squares × kinds. Headless, the build took 7 ms and syncing 54 felled props took 26 µs. **Captures** (Forward+ on Lavapipe): `props_forest`, `props_felled`, `props_overview`, `props_beach`, `props_crate` and `props_highland` in `test/capture/`. I looked at each one. While doing that I found and fixed vertex colours being read as linear (washed out) and a pale specular on needle tips that read as snow. **Not verified:** GPU frame time. "Within the frame budget" is supported by the draw count, the per-kind culling and the sim and main-thread costs above, but software rendering can't time a real GPU. That needs Eric's playtest (R6). **Follow-ups for later milestones:** hooking harvesting into tools and materials (building, v0.3), and the art pass on prop meshes (v0.6).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: claude/tidewall#12