nx_beach_zone.nx
buildroot/runtime/nx_beach_zone.nx
about
nx_beach_zone.nx -- specialized water-land transition generator.
Third demonstration of the kind-specific-generator cardinal
`feedback-kind-specific-generators-not-broad-noise` after
nx_forest_layout (scattered features) and nx_river_carve (polyline
path). Beach is the 3rd shape variant: BANDED ZONE -- a horizontal
elevation band between water and upland.
Beach-internal logic in v1:
- Zone classification by elevation relative to water level:
below water_level -> UNDERWATER
water_level..water_level+tidal_height -> TIDAL
tidal_top..max_beach_height -> BEACH
above max_beach_height -> UPLAND (no override)
- 4 beach types (SANDY / TIDAL_FLAT / PEBBLE / ROCKY) producing
different material per zone (sand vs gravel vs rock)
- Optional height-smoothing pulls upland gradually toward water
level inside the beach zone, so the transition isn't a cliff
Abstract material codes (NOT game block IDs) -- caller maps to
their voxel palette. Keeps this primitive substrate-pure so it
composes with non-voxel applications too (scientific terrain
visualisers, map renderers, etc.).
V2 follow-ups (queued):
- Dune barriers behind the beach zone (composes a wind-direction
hint with nx_wind_erosion v2)
- Per-tide-cycle wet/dry striping in the TIDAL band
- Beach width modulation by slope (gentle slope -> wide beach;
steep slope -> narrow / pocket beach)
- River-mouth detection (beach widens at delta junctions; reads
nx_river_carve segment ends)
- Cliff-face emergence (ROCKY beach + steep slope -> exposed
bedrock cliffs instead of beach)
Loss audit: Q14 integer arithmetic; ramp interpolation is exact in
the documented bands. Classification is sealed-enum so no
"interpolated zone" half-state.
genealogy_id: bascom_1980_waves_beaches +
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_tier.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 62 | const NX_BEACH_Q: nx_int = 16384 |
| 66 | const NX_BEACH_ZONE_UNDERWATER: nx_int = 0 // below water_level |
| 67 | const NX_BEACH_ZONE_TIDAL: nx_int = 1 // wave-washed wet zone |
| 68 | const NX_BEACH_ZONE_BEACH: nx_int = 2 // dry-sand zone above tidal |
| 69 | const NX_BEACH_ZONE_UPLAND: nx_int = 3 // beyond max_beach_height, no override |
| 71 | const NX_BEACH_ZONE_COUNT: nx_int = 4 |
| 75 | const NX_BEACH_TYPE_SANDY: nx_int = 0 // soft sand, classic shoreline |
| 76 | const NX_BEACH_TYPE_TIDAL_FLAT: nx_int = 1 // wide gentle, mud / wet sand |
| 77 | const NX_BEACH_TYPE_PEBBLE: nx_int = 2 // shingle / pebble |
| 78 | const NX_BEACH_TYPE_ROCKY: nx_int = 3 // rocky shoreline, exposed rock |
| 80 | const NX_BEACH_TYPE_COUNT: nx_int = 4 |
| 90 | const NX_BEACH_MATERIAL_PASSTHROUGH: nx_int = 0 |
| 91 | const NX_BEACH_MATERIAL_WATER: nx_int = 1 |
| 92 | const NX_BEACH_MATERIAL_SAND: nx_int = 2 |
| 93 | const NX_BEACH_MATERIAL_GRAVEL: nx_int = 3 |
| 94 | const NX_BEACH_MATERIAL_ROCK: nx_int = 4 |
| 96 | const NX_BEACH_MATERIAL_COUNT: nx_int = 5 |
functions
| 99 | func nx_beach_zone_is_valid(z: nx_int) -> nx_int called by 1: main |
| 107 | func nx_beach_type_is_valid(t: nx_int) -> nx_int called by 1: main |
| 115 | func nx_beach_material_is_valid(m: nx_int) -> nx_int called by 1: main |
| 138 | func nx_beach_zone_classify( |
| 163 | func nx_beach_material(zone: nx_int, beach_type: nx_int) -> nx_int called by 1: main |
| 194 | func nx_beach_height_smooth( |
| 232 | func main() -> i64 |