code wiki / (root) / nx_procgen_water.nx

nx_procgen_water.nx

buildroot/runtime/nx_procgen_water.nx

16821 B379 linesdepth 6pulls 7 transitivereach 6 importersview sourcekind librarytopic procgen
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_tier.nx nx_procgen_preset.nx nx_procgen_signature.nx nx_poisson_disk.nx nx_procgen_water.nx nx_procgen_water_test.nx nx_worldgen_tunelib.nx

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

35const NX_MAGIC_1000000000: i64 = 1000000000
36const NX_MAGIC_2048: i64 = 2048
55const NX_W_RILL_DEPTH: nx_int = 45 // shallow: texture, not canyons
56const NX_W_RILL_MAXLEN: nx_int = 12
57const NX_W_SPRING_SEED_OFF: nx_int = 31511
58const NX_W_RILL_SEED_OFF: nx_int = 47903
59const NX_W_POND_RADIUS_DIV: nx_int = 16 // pond radius = min(w,h)/16
182const NX_W_NO_FLOOR: nx_int = 0 - 1000000000

functions

39func _w_n_rivers(p: nx_int) -> nx_int
called by 1: nx_water_rivers_cfg
45func _w_river_depth(p: nx_int) -> nx_int
51func _w_rill_radius(p: nx_int) -> nx_int
63func nx_water_default_river_depth(p: nx_int) -> nx_int { return _w_river_depth(p) }
called by 2: tl_load_knobsmain calls 1: _w_river_depth
64func nx_water_default_rill_depth() -> nx_int { return NX_W_RILL_DEPTH }
called by 2: tl_load_knobsmain
65func nx_water_default_rill_radius(p: nx_int) -> nx_int { return _w_rill_radius(p) }
called by 1: tl_load_knobs calls 1: _w_rill_radius
71func nx_water_lowest_neighbor(hm: *i64, w: nx_int, h: nx_int,
called by 2: nx_water_tracemain
95func nx_water_trace(hm: *i64, w: nx_int, h: nx_int,
134func nx_water_carve_band(hm: *i64, w: nx_int, h: nx_int,
174func nx_water_carve_floor(hm: *i64, w: nx_int, h: nx_int,
called by 1: nx_water_carve calls 1: nx_water_carve_band
184func nx_water_carve(hm: *i64, w: nx_int, h: nx_int,
called by 1: main calls 1: nx_water_carve_floor
196func nx_water_rivers_cfg(hm: *i64, w: nx_int, h: nx_int,
284func nx_water_rivers(hm: *i64, w: nx_int, h: nx_int,
295func nx_water_rills_cfg(hm: *i64, w: nx_int, h: nx_int, seed: nx_int,
330func nx_water_rills(hm: *i64, w: nx_int, h: nx_int,
339func nx_water_compose_cfg(hm: *i64, w: nx_int, h: nx_int,
357func nx_water_compose(hm: *i64, w: nx_int, h: nx_int,
371func nx_procgen_landscape_v2(seed: nx_int, preset: nx_int,