code wiki / (root) / nx_procgen_signature.nx

nx_procgen_signature.nx

buildroot/runtime/nx_procgen_signature.nx

16387 B397 linesdepth 4pulls 5 transitivereach 16 importersview sourcekind librarytopic procgen
docsdependenciesstructsconstsfunctions

about

nx_procgen_signature.nx -- signature terrain features as COMPOSED PRIMITIVES placed by CONSTRAINT, not noise (PROCGEN arc P1, the composed-primitives cardinal). Noise (perlin fbm) gives texture but provably cannot move the grader's EXTREMES axis past D: top/bottom-10% mass needs DELIBERATE landmarks. This module adds them as visible Tier-2 geometry primitives: nx_sig_peak -- radial quadratic bump (positive landmark mass) nx_sig_ridge -- elevated line segment (links peaks; positive mass) nx_sig_valley -- carved line segment (negative mass; = ridge, amp<0) nx_sig_cliff -- signed step across a segment (sharp relief) and ONE composition entry the preset recipe calls: nx_sig_compose(heightmap, w, h, seed, preset) CONSTRAINT placement (causal, not sampled): peak sites = nx_poisson_disk_sample with a min-separation radius (the poisson constraint IS the placement rule) ridge = connects the two strongest peaks (structure follows landmarks, the way real ranges link summits) valley = carved from the pre-feature LOWEST cell toward the nearest map edge (water leaves by the low ground) cliff = perpendicular to the ridge at its midpoint (fault line across the range), mountain/coast only All math integer Q10; deterministic per (seed, preset): same inputs -> byte-identical heightmap (replayability is the seedable-worlds law). license_tier: ORIGINAL

dependencies 4 imports · 3 importers

nx_syscalls.nx nx_tier.nx nx_perlin.nx nx_poisson_disk.nx nx_procgen_signature.nx nx_procgen_preset.nx nx_procgen_signature_test.nx nx_procgen_water.nx

imports: nx_syscalls.nxnx_tier.nxnx_perlin.nxnx_poisson_disk.nx

imported by: nx_procgen_preset.nxnx_procgen_signature_test.nxnx_procgen_water.nx

structs

none

consts

81const NX_SIG_CORE_Q10: nx_int = 614 // ~0.6 of radius
255const NX_SIG_DETAIL_STEP_Q10: nx_int = 410 // ~4x the base cell step
256const NX_SIG_DETAIL_SEED_OFF: nx_int = 60913

functions

43func _sig_n_peaks(p: nx_int) -> nx_int
49func _sig_peak_radius(p: nx_int, w: nx_int, h: nx_int) -> nx_int
56func _sig_peak_amp(p: nx_int) -> nx_int
62func _sig_valley_amp(p: nx_int) -> nx_int
67func _sig_cliff_drop(p: nx_int) -> nx_int
95func nx_sig_peak_t(hm: *nx_int, w: nx_int, h: nx_int,
139func nx_sig_peak(hm: *nx_int, w: nx_int, h: nx_int,
called by 2: nx_sig_basinmain calls 1: nx_sig_peak_t
146func nx_sig_basin(hm: *nx_int, w: nx_int, h: nx_int,
153func _sig_seg_d2(px: nx_int, py: nx_int, ax: nx_int, ay: nx_int,
176func nx_sig_ridge_t(hm: *nx_int, w: nx_int, h: nx_int,
209func nx_sig_ridge(hm: *nx_int, w: nx_int, h: nx_int,
called by 2: nx_sig_valleymain calls 1: nx_sig_ridge_t
215func nx_sig_valley(hm: *nx_int, w: nx_int, h: nx_int,
called by 2: nx_sig_compose_cfgmain calls 1: nx_sig_ridge
225func nx_sig_cliff(hm: *nx_int, w: nx_int, h: nx_int,
called by 2: nx_sig_compose_cfgmain calls 1: _sig_seg_d2
258func nx_sig_detail(hm: *nx_int, w: nx_int, h: nx_int,
279func _sig_argmin(hm: *nx_int, n: nx_int) -> nx_int
called by 1: nx_sig_compose_cfg
298func nx_sig_default_n_peaks(p: nx_int) -> nx_int { return _sig_n_peaks(p) }
calls 1: _sig_n_peaks
299func nx_sig_default_peak_radius(p: nx_int, w: nx_int, h: nx_int) -> nx_int { return _sig_peak_radius(p, w, h) }
300func nx_sig_default_peak_amp(p: nx_int) -> nx_int { return _sig_peak_amp(p) }
calls 1: _sig_peak_amp
301func nx_sig_default_valley_amp(p: nx_int) -> nx_int { return _sig_valley_amp(p) }
calls 1: _sig_valley_amp
302func nx_sig_default_cliff_drop(p: nx_int) -> nx_int { return _sig_cliff_drop(p) }
calls 1: _sig_cliff_drop
308func nx_sig_compose_cfg(hm: *nx_int, w: nx_int, h: nx_int,
394func nx_sig_compose(hm: *nx_int, w: nx_int, h: nx_int,