W5: Vegetation and harvestable props

PropSet places about 3,000 pines, scrub, boulders, wrecks and crates per
island from the seed, by elevation band with grove noise, clear of points
of interest. Each prop is one collision box in SimGround with health from
Tuning.PROP_KINDS; destroying it removes the box at once
(SimGround.remove_solid). Prop health is part of the state hash.

PropView draws them as one MultiMesh per kind per 128 m square (about 150
instanced draws), with per-kind visibility ranges, procedural flat-shaded
meshes fitted to the collision boxes, and cheap sync of felled props.

Closes #12

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-11 12:17:42 -05:00
co-authored by Claude Opus 5.5
parent 283d0e966e
commit 5db53de4e8
20 changed files with 1116 additions and 1 deletions
+13
View File
@@ -18,6 +18,9 @@ var island: Island
## The island's points of interest, whose solids are part of `ground`. Empty when a
## test supplied its own ground.
var pois: PoiSet = PoiSet.new()
## Trees, scrub, boulders, wrecks and crates, whose boxes are part of `ground`. Empty
## when a test supplied its own ground.
var props: PropSet = PropSet.new()
## Player entity ID -> { command tick -> PlayerCommand }
var _pending: Dictionary = {}
@@ -34,6 +37,8 @@ func _init(match_seed: int, world: SimGround = null) -> void:
world = island.ground
pois = PoiSet.generate(island)
pois.add_solids_to(world)
props = PropSet.generate(island, pois)
props.add_solids_to(world)
ground = world
@@ -92,6 +97,11 @@ func _apply_command(player: SimEntity, command: PlayerCommand) -> void:
Movement.step(player, command, ground)
## Damages a prop. Returns true if this destroyed it; its collision goes at once.
func damage_prop(prop: int, amount: int) -> bool:
return props.damage(prop, amount)
## SHA-256 hex digest of a canonical encoding of the whole state.
func state_hash() -> String:
var buffer: StreamPeerBuffer = StreamPeerBuffer.new()
@@ -115,6 +125,9 @@ func state_hash() -> String:
for value: float in [entity.velocity.x, entity.velocity.y, entity.velocity.z]:
buffer.put_64(roundi(value * 1000.0))
buffer.put_64(props.count())
buffer.put_data(props.health.to_byte_array())
var hasher: HashingContext = HashingContext.new()
hasher.start(HashingContext.HASH_SHA256)
hasher.update(buffer.data_array)