Pieces gain health while they finish building, and take damage from weapons and the tide. Pieces with no path to the ground collapse.
Acceptance
Connectivity is computed incrementally, and removing one piece from a 500-piece fort stays within the tick budget.
Tests cover build-up health, material strength and cascading collapse.
Terrain changes and tide damage can both trigger collapse.
**Depends on:** B2
Pieces gain health while they finish building, and take damage from weapons and the tide. Pieces with no path to the ground collapse.
**Acceptance**
- Connectivity is computed incrementally, and removing one piece from a 500-piece fort stays within the tick budget.
- Tests cover build-up health, material strength and cascading collapse.
- Terrain changes and tide damage can both trigger collapse.
claude
added this to the v0.3 Building and Combat milestone 2026-11-09 05:26:55 +00:00
Build-up health: a piece starts at BUILD_START_HEALTH_FRACTION (10%) of its material's health and gains the rest evenly over the material's build_seconds, by whole ticks. Damage taken while building stays taken.
Damage:Simulation.damage_piece(). Boathook swings now hit a built piece if it's nearer than any prop, for HARVEST_DAMAGE (50), giving no material back. B6 weapons will call the same API.
Tide: once a second, a piece whose base is under the sea loses TIDE_STRUCTURE_DPS (new, 4). A breakwater loses BREAKWATER_WEAR_PER_METRE per metre of water over its base, and fails at once past BREAKWATER_MAX_HEAD. Holding water back behind breakwaters is still the tide work.
Integrity: a piece is grounded if it touches the terrain or a fixed solid such as a pier deck. Props don't count, because they can be felled. When a piece is removed or stops being grounded, a breadth-first search starts from its former neighbours and stops at the first grounded piece it finds. Only structures that really lost support get walked in full, and a loose component collapses together, with piece_destroyed events whose cause is collapse. Simulation.ground_changed(area) rechecks grounding after the terrain or fixed solids change.
Fix to B2: wall skirts now reach at most one level (2 m). Before, an upper-storey wall could skirt all the way to the ground and count as grounded.
Tests:test/sim/test_integrity.gd, 12 tests:
build-up for each material
damage during building
material strength: the same blows break driftwood but not stone or iron
fresh pieces being fragile
a cascading collapse of a tower that leaves a separate wall untouched
a second support holding a floor
the boathook bringing down a wall and its floor
tide wear and breakwater failure
a tide-killed support collapsing its floor
a terrain drop collapsing a structure
fixed solids counting as ground
a 564-piece fort: removing one ground wall took 57 µs, the worst single search 416 µs, and the full cascade of 479 pieces 4.7 ms, all inside the 12 ms tick budget
The rapid-placement test from B2 still passes (p95 6.6 ms). make check passed: 193 tests, self-check, and smoke at p95 0.54 ms.
Follow-ups: pieces show no damage or build-up state yet. Cracks and scaffolding visuals belong to v0.6, and the HUD can show health with the UI work. Island terrain doesn't change at runtime today, so ground_changed exists for explosives (B8) and anything later that digs.
Done in f38bb9c.
**What changed**
- **Build-up health:** a piece starts at `BUILD_START_HEALTH_FRACTION` (10%) of its material's health and gains the rest evenly over the material's `build_seconds`, by whole ticks. Damage taken while building stays taken.
- **Damage:** `Simulation.damage_piece()`. Boathook swings now hit a built piece if it's nearer than any prop, for `HARVEST_DAMAGE` (50), giving no material back. B6 weapons will call the same API.
- **Tide:** once a second, a piece whose base is under the sea loses `TIDE_STRUCTURE_DPS` (new, 4). A breakwater loses `BREAKWATER_WEAR_PER_METRE` per metre of water over its base, and fails at once past `BREAKWATER_MAX_HEAD`. Holding water back behind breakwaters is still the tide work.
- **Integrity:** a piece is grounded if it touches the terrain or a fixed solid such as a pier deck. Props don't count, because they can be felled. When a piece is removed or stops being grounded, a breadth-first search starts from its former neighbours and stops at the first grounded piece it finds. Only structures that really lost support get walked in full, and a loose component collapses together, with `piece_destroyed` events whose cause is `collapse`. `Simulation.ground_changed(area)` rechecks grounding after the terrain or fixed solids change.
- **Fix to B2:** wall skirts now reach at most one level (2 m). Before, an upper-storey wall could skirt all the way to the ground and count as grounded.
**Tests:** `test/sim/test_integrity.gd`, 12 tests:
- build-up for each material
- damage during building
- material strength: the same blows break driftwood but not stone or iron
- fresh pieces being fragile
- a cascading collapse of a tower that leaves a separate wall untouched
- a second support holding a floor
- the boathook bringing down a wall and its floor
- tide wear and breakwater failure
- a tide-killed support collapsing its floor
- a terrain drop collapsing a structure
- fixed solids counting as ground
- a 564-piece fort: removing one ground wall took 57 µs, the worst single search 416 µs, and the full cascade of 479 pieces 4.7 ms, all inside the 12 ms tick budget
The rapid-placement test from B2 still passes (p95 6.6 ms). `make check` passed: 193 tests, self-check, and smoke at p95 0.54 ms.
**Follow-ups:** pieces show no damage or build-up state yet. Cracks and scaffolding visuals belong to v0.6, and the HUD can show health with the UI work. Island terrain doesn't change at runtime today, so `ground_changed` exists for explosives (B8) and anything later that digs.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Depends on: B2
Pieces gain health while they finish building, and take damage from weapons and the tide. Pieces with no path to the ground collapse.
Acceptance
Done in
f38bb9c.What changed
BUILD_START_HEALTH_FRACTION(10%) of its material's health and gains the rest evenly over the material'sbuild_seconds, by whole ticks. Damage taken while building stays taken.Simulation.damage_piece(). Boathook swings now hit a built piece if it's nearer than any prop, forHARVEST_DAMAGE(50), giving no material back. B6 weapons will call the same API.TIDE_STRUCTURE_DPS(new, 4). A breakwater losesBREAKWATER_WEAR_PER_METREper metre of water over its base, and fails at once pastBREAKWATER_MAX_HEAD. Holding water back behind breakwaters is still the tide work.piece_destroyedevents whose cause iscollapse.Simulation.ground_changed(area)rechecks grounding after the terrain or fixed solids change.Tests:
test/sim/test_integrity.gd, 12 tests:The rapid-placement test from B2 still passes (p95 6.6 ms).
make checkpassed: 193 tests, self-check, and smoke at p95 0.54 ms.Follow-ups: pieces show no damage or build-up state yet. Cracks and scaffolding visuals belong to v0.6, and the HUD can show health with the UI work. Island terrain doesn't change at runtime today, so
ground_changedexists for explosives (B8) and anything later that digs.