docs: water at rest across the Core/Client/Server READMEs (terrain-water task 13)

Core: BlockRegistry gains WATER, with the reason it is wire-safe (block IDs
are never serialized) AND the reason it is a registry identity only rather
than a voxel the terrain path writes. Corrects the now-false line "Nothing
at runtime consumes the water data yet" -- it does, as of this task.
ChunkData's new per-column water fields and the Constants tunables.

Client: how the water sheet is built and, more importantly, WHY it is a
second mesh instead of a block in the density field -- the trap here is
that writing water into a Marching-Cubes field fuses it into the terrain
instead of laying it on top, and that is not obvious until you have done
it. Notes translucency came free from the separate material.

Server: the per-column water rule, which section is the authority for what
(WBID presence, WSRF level, WBTB fallback), that an unknown body leaves the
column dry rather than guessing, and why depth for shading comes from
blueprint heights rather than the clamped rendered geometry.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Stewart Howe 2026-08-09 02:33:06 -04:00
parent 9c255a4fc6
commit 3b5bc5e5d6
3 changed files with 38 additions and 4 deletions

View file

@ -11,7 +11,11 @@ never track live game events — who is online, which chunks are loaded, what ti
### Voxel materials
- **`BlockData.cs`** — struct describing one block type (ID, name, IsSolid, BaseColor).
- **`BlockRegistry.cs`** — the byte-ID master list (`AIR` 0, `BEDROCK`, `STONE`, `DIRT`, `SAND`, the
three grasses, `SNOW`, `WASTELAND_DIRT`, `ASPHALT`) with a safe `GetBlock` lookup.
three grasses, `SNOW`, `WASTELAND_DIRT`, `ASPHALT`, `WATER`) with a safe `GetBlock` lookup.
**Block IDs are never serialized** — the blueprint stores heights, biome ordinals and water data,
never block IDs, and chunks are not persisted — so appending to this table is wire-safe.
`WATER` is a registry identity only: it is not written into `ChunkData.BlockIDs`, because water is
drawn as its own surface rather than as part of the terrain iso-surface (see `Client/README.md`).
- **`BiomePalette.cs`** — decides which material sits where, given biome, depth, and whether the
column is roadbed. Two paths on purpose: an **integer** classification that decides what is stored
in each voxel, and a **float-depth** version used for rendering that returns the two materials
@ -43,11 +47,17 @@ rendering.
flag, and the optional water-bodies data: `WaterBodyIds`, `WaterBodies` table, `WaterSurfaceQ`).
Dispatches on the first byte: v2 tagged-section files get validation (version gate, size
bounds, section-length and ordinal range checks); legacy v1 files still load, intact, with a
deprecation warning. Nothing at runtime consumes the water data yet.
deprecation warning. **The water sections are consumed at runtime since task 13** — the server
reads them per column and the client draws the result (see `Server/README.md`).
- **`ChunkData.cs`** — one chunk's density and block-ID fields, `+1` padded on every axis so the
mesher can reach into the neighbouring chunk, plus the per-column data the renderer needs.
mesher can reach into the neighbouring chunk, plus the per-column data the renderer needs —
including `WaterSurfaceY` (world Y of the water surface, or `Constants.NO_WATER`), `WaterDepthM`
(true depth from blueprint heights) and `HasAnyWater`.
- **`Constants.cs`** — chunk dimensions, `ISO_LEVEL`, `VOXEL_SCALE`, and the visual/road tunables
(material blend band; per-tier road width, shoulder, grade smoothing and surface).
(material blend band; per-tier road width, shoulder, grade smoothing and surface), plus the
water-at-rest tunables: `HEIGHT_SCALE` (the one raw-height→metres mapping, shared by the terrain
surface and the water sheet so they cannot drift apart), `NO_WATER`, and the depth-shading
colour/alpha ramp.
### Maths
- **`MarchingCubes.cs`** — density field → `ArrayMesh`, with analytical normals and deterministic