code wiki / (root) / nx_worldpipe.nx

nx_worldpipe.nx

buildroot/runtime/nx_worldpipe.nx

20700 B379 linesdepth 3pulls 4 transitivereach 8 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_worldpipe.nx -- ★R5 STAGED PROCGEN (the banked Minecraft-pipeline curriculum, engine-convergence rung 5): worldgen as an ORDERED STAGED PIPELINE over a MULTI-PARAMETER space -- not one noise call. STAGE 1 PARAMS six independent noise fields at (x,z): temperature / humidity / CONTINENTALNESS / erosion / weirdness / river. (Their 6th, depth, is the 3D-density param -- ours is a heightfield: named residual.) STAGE 2 SPLINE height BASE = piecewise-linear SPLINE over continentalness (deep ocean -> coast -> inland -> highland), the curriculum's core lesson: params map to height THROUGH SPLINES. STAGE 3 RELIEF ridged mountains scaled by WEIRDNESS and flattened by EROSION (high erosion = plains). STAGE 4 CARVER rivers CUT the terrain where the river field crosses its band (geometry change, toggleable). STAGE 5 BIOME classified from the parameter VECTOR (temp x humidity x cont x weirdness) -- NOT from height (the anti-"height-only" lesson: two same-height points can be desert vs snowfield). STAGE 6 SURFACE per-biome + slope + altitude surface colours (sand/grass/snow/rock/water). STAGE 7 FEATURES per-biome placements by seeded hash (trees / cacti / spruce / boulders). STAGE 8 SPAWN a valid spawn point (land, gentle slope) found deterministically. Pure integer, deterministic per seed. Stages 4/7 have toggles so gates can prove CAUSALITY per stage. license_tier: ORIGINAL

dependencies 2 imports · 5 importers

nx_syscalls.nx nx_trimesh.nx nx_worldpipe.nx nx_authorgen.nx nx_engine_phys_gate.nx nx_engine_stream_gate.nx nx_m2d_engine.nx nx_worldpipe_gate.nx

imports: nx_syscalls.nxnx_trimesh.nx

imported by: nx_authorgen.nxnx_engine_phys_gate.nxnx_engine_stream_gate.nxnx_m2d_engine.nxnx_worldpipe_gate.nx

structs

none

consts

18const WP_MAGIC_1400: i64 = 1400
19const WP_MAGIC_3400: i64 = 3400
20const WP_MAGIC_2600: i64 = 2600
21const WP_MAGIC_2100: i64 = 2100
22const WP_MAGIC_1700: i64 = 1700
23const WP_MAGIC_1300: i64 = 1300
24const WP_MAGIC_2400: i64 = 2400
25const WP_MAGIC_9973: i64 = 9973
26const WP_MAGIC_524287: i64 = 524287
27const WP_MAGIC_1024: i64 = 1024
28const WP_MAGIC_9600: i64 = 9600
29const WP_MAGIC_1000000000: i64 = 1000000000
30const WP_MAGIC_10100: i64 = 10100
31const WP_MAGIC_1000000: i64 = 1000000
32const WP_MAGIC_999999: i64 = 999999
33const WP_MAGIC_65536: i64 = 65536
115const HYW: i64 = 320
116const HYCELL: i64 = 64
117const HYSPAN: i64 = 10240
121const HYOFF: i64 = 5000000
298const WP_L_AMB: i64 = 256 // FLAT GROUND = unity (measured: an ambient floor of 168 made the
301const WP_L_GAIN: i64 = 22 // diffuse gain per height-step unit
302const WP_L_STEP: i64 = 90 // sample distance for the slope normal
303const WP_L_MAXB: i64 = 340 // brightness ceiling (overbright allowed; channels clamp at 255)
304const WP_L_MINB: i64 = 96 // brightness floor (shadow side never crushes to black)
305const WP_L_JIT: i64 = 14 // per-cell albedo jitter amplitude (small: variation, not noise)
306const WP_L_CELL: i64 = 96 // albedo cell size (matches the feature grid feel)

functions

44func wp_init(seed: i64) -> i64 { WP_SEED = seed; WP_CARVE = 1; WP_FEAT = 1; WP_TEMP_BIAS = 0; WP_CONT_BIAS = 0; WP_MOUNT_SCALE = WP_MAGIC_1400; WP_LIGHT = 1; return 0 }
45func wp_set_carve(v: i64) -> i64 { WP_CARVE = v; return 0 }
called by 1: main
46func wp_set_feat(v: i64) -> i64 { WP_FEAT = v; return 0 }
47func wp_set_temp_bias(v: i64) -> i64 { WP_TEMP_BIAS = v; return 0 }
called by 1: ag_parse
48func wp_set_cont_bias(v: i64) -> i64 { WP_CONT_BIAS = v; return 0 }
called by 1: ag_parse
49func wp_set_mount_scale(v: i64) -> i64 { WP_MOUNT_SCALE = v; return 0 }
called by 1: ag_parse
50func wp_iabs(v: i64) -> i64 { if v < 0 { return 0-v } return v }
51func wp_clamp(v: i64, lo: i64, hi: i64) -> i64 { if v<lo {return lo} if v>hi {return hi} return v }
55func wp_param(x: i64, z: i64, k: i64) -> i64
70func wp_spline(c: i64) -> i64
called by 2: wp_height_coremain
82func wp_height_core(cont: i64, ero: i64, weird: i64, x: i64, z: i64) -> i64
92func wp_height_params(cont: i64, ero: i64, weird: i64, x: i64, z: i64) -> i64
97func wp_flow_h(x: i64, z: i64) -> i64
104func wp_height_raw(x: i64, z: i64) -> i64
122func wp_hyd_stamp(g: *i64, x: i64, z: i64, bed: i64, rad: i64) -> i64
called by 1: wp_hydro_bake
140func wp_hydro_bake() -> i64
225func wp_hyd_n() -> i64 { return WP_HYN }
called by 1: main
226func wp_hyd_stat(i: i64, k: i64) -> i64 { let st: *i64 = WP_HYSTATS as *i64; return st[i*4+k] }
called by 1: main
227func wp_hyd_bed(x: i64, z: i64) -> i64
called by 2: wp_heightwp_biome
240func wp_height(x: i64, z: i64) -> i64
251func wp_biome(x: i64, z: i64) -> i64
276func wp_surface(x: i64, z: i64, h: i64, slope: i64) -> i64
307func wp_set_light(v: i64) -> i64 { WP_LIGHT = v; return 0 }
called by 1: main
308func wp_shade(x: i64, z: i64, h: i64, slope: i64) -> i64
335func wp_feature(cx: i64, cz: i64) -> i64
called by 1: main calls 3: wp_heightwp_biometm_hash3
350func wp_spawn(out: *i64) -> i64
called by 1: main calls 3: wp_heightwp_iabswp_biome