nx_procgen_water.nx
buildroot/runtime/nx_procgen_water.nx
about
nx_procgen_water.nx -- CAUSAL water: source-to-sea rivers + drainage
rills (PROCGEN arc P4 = EXCEED10 ladder R3, bucket B3; also the first
honest attack on the grader's chronic LOCAL_VARIATION loss -- the
refine verdict has said ADD_DETAIL on nearly every config since P1).
Water here is DERIVED, never painted:
springs -- constraint-picked sites: poisson candidates filtered to
the upper-third elevation (water starts high)
trace -- steepest-descent walk: each step moves to the strictly
lowest 4-neighbour; termination is CAUSAL (map edge =
reached the sea, local minimum = water collects)
carve -- channel incision along the traced path (centre + banks),
terminus local-min gets a pond basin (nx_sig_basin --
P1's primitive, composed not duplicated)
rills -- a DENSE network of short shallow traces from poisson
sites: drainage texture. This is what raises the
LOCAL_VARIATION axis -- channel edges create real
neighbour relief, the kind fbm-at-our-cell-step lacks.
The water MASK (1 = channel/pond cell) feeds P3: a feature standing in
water IS water (reeds/pool), overriding the biome mix -- causality
beats the probability table.
API is ADDITIVE (contract stability): nx_procgen_landscape (v1) is
untouched; nx_procgen_landscape_v2 composes v1 + water and fills the
caller's mask. All integer Q10; deterministic per (seed, preset).
license_tier: ORIGINAL
dependencies 5 imports · 2 importers
imports: nx_syscalls.nxnx_tier.nxnx_procgen_preset.nxnx_procgen_signature.nxnx_poisson_disk.nx
imported by: nx_procgen_water_test.nxnx_worldgen_tunelib.nx
structs
| none |
consts
| 35 | const NX_MAGIC_1000000000: i64 = 1000000000 |
| 36 | const NX_MAGIC_2048: i64 = 2048 |
| 55 | const NX_W_RILL_DEPTH: nx_int = 45 // shallow: texture, not canyons |
| 56 | const NX_W_RILL_MAXLEN: nx_int = 12 |
| 57 | const NX_W_SPRING_SEED_OFF: nx_int = 31511 |
| 58 | const NX_W_RILL_SEED_OFF: nx_int = 47903 |
| 59 | const NX_W_POND_RADIUS_DIV: nx_int = 16 // pond radius = min(w,h)/16 |
| 182 | const NX_W_NO_FLOOR: nx_int = 0 - 1000000000 |
functions
| 39 | func _w_n_rivers(p: nx_int) -> nx_int called by 1: nx_water_rivers_cfg |
| 45 | func _w_river_depth(p: nx_int) -> nx_int |
| 51 | func _w_rill_radius(p: nx_int) -> nx_int |
| 63 | func nx_water_default_river_depth(p: nx_int) -> nx_int { return _w_river_depth(p) } |
| 64 | func nx_water_default_rill_depth() -> nx_int { return NX_W_RILL_DEPTH } |
| 65 | func nx_water_default_rill_radius(p: nx_int) -> nx_int { return _w_rill_radius(p) } |
| 71 | func nx_water_lowest_neighbor(hm: *i64, w: nx_int, h: nx_int, |
| 95 | func nx_water_trace(hm: *i64, w: nx_int, h: nx_int, |
| 134 | func nx_water_carve_band(hm: *i64, w: nx_int, h: nx_int, |
| 174 | func nx_water_carve_floor(hm: *i64, w: nx_int, h: nx_int, |
| 184 | func nx_water_carve(hm: *i64, w: nx_int, h: nx_int, |
| 196 | func nx_water_rivers_cfg(hm: *i64, w: nx_int, h: nx_int, |
| 284 | func nx_water_rivers(hm: *i64, w: nx_int, h: nx_int, |
| 295 | func nx_water_rills_cfg(hm: *i64, w: nx_int, h: nx_int, seed: nx_int, |
| 330 | func nx_water_rills(hm: *i64, w: nx_int, h: nx_int, |
| 339 | func nx_water_compose_cfg(hm: *i64, w: nx_int, h: nx_int, |
| 357 | func nx_water_compose(hm: *i64, w: nx_int, h: nx_int, |
| 371 | func nx_procgen_landscape_v2(seed: nx_int, preset: nx_int, |