W6: Water and swimming

The simulation has a global sea level (Simulation.sea_level, changed with
set_sea_level and read every tick, so the tide can move it mid-match).
Walkers wade more slowly in water over WADE_DEPTH; in water SWIM_DEPTH deep
they swim: floating head-out, sprint-swimming, diving with crouch, kicking
out with jump, and standing again in the shallows. Falling into deep water
does no fall damage. Water tracks breath, stamina and drowning in whole
ticks: swimming spends stamina, an exhausted swimmer slips under, and with
no breath left the tide phase's drown damage lands once a second. All of
it, plus the sea level, is in the state hash.

WaterView draws the sea surface at the simulation's level with a
procedural shader: depth-tinted colour, foam at the waterline, ripples.

Closes #13

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-11 12:24:50 -05:00
co-authored by Claude Opus 5.5
parent 5db53de4e8
commit be987b6f82
18 changed files with 641 additions and 10 deletions
+5 -1
View File
@@ -117,7 +117,11 @@ seed, so only damage is match state.
The last phase raises the sea above the highest ground, so every match ends. Players
standing in shallow water wade and slow down. Underwater, they lose breath over
`BREATH_SECONDS`, and then take the phase's `drown_dps`. Swimming is slow and leaves a
player unable to build or fire. Water flows along the terrain, so low ground that is
player unable to build or fire. Players swim where the water over the floor is at least
`SWIM_DEPTH`, floating head-out at `SWIM_FLOAT_DEPTH`; crouch dives and jump kicks out of
the water. Swimming spends stamina (`SWIM_STAMINA_SECONDS`, faster when sprint-swimming),
which comes back on land. A swimmer with no stamina slips under and starts losing breath,
so a long swim out to sea can drown. Landing in deep water does no fall damage. Water flows along the terrain, so low ground that is
cut off from the sea stays dry until something opens a path.
## Building