code wiki / (root) / nx_procgen_biome.nx

nx_procgen_biome.nx

buildroot/runtime/nx_procgen_biome.nx

5813 B145 linesdepth 3pulls 3 transitivereach 10 importersview sourcekind librarytopic procgen
docsdependenciesstructsconstsfunctions

about

nx_procgen_biome.nx -- biome map as a CAUSAL DERIVATION from elevation + moisture (PROCGEN arc P2 = EXCEED10 ladder R1; the composed-primitives cardinal: biomes are LAW, not paint). The grader's BIOME_COHERENCE axis (nx_world_quality_grader) was structurally ABSENT (=0) because no generator ever produced a biome map. This module produces one the only honest way: each cell's biome follows from WHERE it is -- elevation band = the SAME quartile law the grader checks (low / mid / high / peak over observed range) moisture = a second perlin-fbm field (independent seed stream) picks the biome WITHIN the band, Whittaker-style Band law (must stay in lockstep with _wqg_biome_expected_band): LOW : DESERT (dry) | TUNDRA (wet) MID : GRASSLAND < BOREAL_FOREST < TEMPERATE_FOREST < TROPICAL_RAINFOREST (driest -> wettest) HIGH : SNOW PEAK : ICE Coherence is lawful BY CONSTRUCTION; the grader is the independent instrument that proves the law holds (and catches any future drift between this table and the grader's). Moisture creates the within-band variety that the render/material rung (B4) will consume as color bands. Deterministic per (heightmap, seed): same inputs -> byte-identical map. license_tier: ORIGINAL

dependencies 3 imports · 6 importers

nx_syscalls.nx nx_tier.nx nx_perlin.nx nx_procgen_biome.nx _ft_diag.nx nx_procgen_biome_test.nx nx_procgen_features.nx nx_procgen_features_test.nx nx_procgen_water_test.nx nx_worldgen_tunelib.nx

imports: nx_syscalls.nxnx_tier.nxnx_perlin.nx

imported by: _ft_diag.nxnx_procgen_biome_test.nxnx_procgen_features.nxnx_procgen_features_test.nxnx_procgen_water_test.nxnx_worldgen_tunelib.nx

structs

none

consts

35const NX_BIOME_TUNDRA: nx_int = 0
36const NX_BIOME_BOREAL: nx_int = 1
37const NX_BIOME_GRASSLAND: nx_int = 4
38const NX_BIOME_TEMPERATE: nx_int = 5
39const NX_BIOME_DESERT: nx_int = 8
40const NX_BIOME_TROPICAL: nx_int = 11
41const NX_BIOME_SNOW: nx_int = 12
42const NX_BIOME_ICE: nx_int = 13
44const NX_BIOME_ID_SPAN: nx_int = 14
47const NX_BIOME_MOIST_DRY: nx_int = 0 - 256
48const NX_BIOME_MOIST_MID: nx_int = 0
49const NX_BIOME_MOIST_WET: nx_int = 256
54const NX_BIOME_MOISTURE_SEED_OFF: nx_int = 9173
58const NX_BIOME_MOIST_STEP_Q10: nx_int = 102
59const NX_BIOME_MOIST_OCTAVES: nx_int = 3
60const NX_BIOME_MOIST_PERSIST: nx_int = 512

functions

62func nx_biome_is_valid(b: nx_int) -> nx_int
called by 1: main
76func nx_biome_band(v: nx_int, hmin: nx_int, range: nx_int) -> nx_int
89func nx_biome_pick(band: nx_int, moisture_q10: nx_int) -> nx_int
called by 1: nx_biome_map_build
108func nx_biome_map_build(heightmap: *i64, w: nx_int, h: nx_int,