code wiki / (root) / nx_biome_classifier.nx

nx_biome_classifier.nx

buildroot/runtime/nx_biome_classifier.nx

14512 B336 linesdepth 2pulls 2 transitivereach 11 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_biome_classifier.nx -- Whittaker / Holdridge biome classifier. Cross-cutting Substrate C primitive per nxc2/docs/NISHI_GAME_ENGINE_ROADMAP.md. The foundational LOGIC layer for guided / god procgen -- where pure noise samples uniformly, this primitive routes climate + elevation through a biome decision table so downstream generators (vegetation density, species spawn, settlement growth) get to place features WHERE THEY MAKE SENSE. "Forest near a river, desert where it's dry" -- this is the primitive that says so. Inputs (all Q14): temperature_c_q14: mean annual temperature in degrees C rainfall_mm_q14: mean annual rainfall in mm elevation_m_q14: elevation above sea level in metres Output: sealed-enum biome kind (13 values). Use the classifier-driven downstream primitive `nx_growth_field` (queued) to spawn the actual vegetation / ores / settlements per biome. Classification scheme: Whittaker 1975 simplified 2D (temp x rain) + Holdridge altitudinal adjustment. Reasonable cuts at standard climate boundaries (frost line at 0 C; treeline at ~3000 m; tropical/temperate cutoff at 18 C). Per cardinal `feedback-no-third-party-trust-native-or-nothing`, classification thresholds are derived from public-domain climate science, never copied from a proprietary engine. Loss audit: classification is BAND-DECISION; no continuous information lost beyond Q14-quantised inputs. Downstream generators read the sealed-enum verdict and apply their own continuous biases (e.g. forest density tapers within the TEMPERATE_FOREST band toward the band's edges). genealogy_id: whittaker_1975_community_ecology + holdridge_1947_life_zones lineage_id: nx_biome_classifier_whittaker_holdridge_2d_q14 nx_safety_envelope:

dependencies 2 imports · 5 importers

nx_syscalls.nx nx_tier.nx nx_biome_classifier.nx nx_decl_random_environment.nx nx_decl_random_environment_test.nx nx_decl_simple_scene.nx nx_decl_simple_scene_test.nx nx_decl_townscape.nx

imports: nx_syscalls.nxnx_tier.nx

imported by: nx_decl_random_environment.nxnx_decl_random_environment_test.nxnx_decl_simple_scene.nxnx_decl_simple_scene_test.nxnx_decl_townscape.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_biome_classify_q14 nx_biome_lushness_q14 nx_biome_is_valid

structs

none

consts

64const NX_MAGIC_2048: i64 = 2048
65const NX_MAGIC_6144: i64 = 6144
66const NX_MAGIC_1024: i64 = 1024
67const NX_MAGIC_5120: i64 = 5120
68const NX_MAGIC_10240: i64 = 10240
69const NX_MAGIC_12288: i64 = 12288
70const NX_MAGIC_3072: i64 = 3072
71const NX_MAGIC_13312: i64 = 13312
72const NX_MAGIC_16384: i64 = 16384
73const NX_MAGIC_1200: i64 = 1200
74const NX_MAGIC_2500: i64 = 2500
75const NX_MAGIC_1800: i64 = 1800
76const NX_MAGIC_3000: i64 = 3000
77const NX_MAGIC_3500: i64 = 3500
78const NX_MAGIC_1500: i64 = 1500
81const NX_BIOME_Q: nx_int = 16384
85const NX_BIOME_T_ARCTIC: nx_int = -163840 // -10 C (Q14)
86const NX_BIOME_T_FREEZE: nx_int = 0 // 0 C
87const NX_BIOME_T_BOREAL_TOP: nx_int = 81920 // 5 C
88const NX_BIOME_T_TROPICAL: nx_int = 294912 // 18 C
89const NX_BIOME_T_SAVANNA_MIN: nx_int = 327680 // 20 C
91const NX_BIOME_P_HYPER_ARID: nx_int = 1638400 // 100 mm
92const NX_BIOME_P_SEMI_ARID: nx_int = 4096000 // 250 mm
93const NX_BIOME_P_DRY: nx_int = 6553600 // 400 mm
94const NX_BIOME_P_MODERATE: nx_int = 9830400 // 600 mm
95const NX_BIOME_P_WET: nx_int = 24576000 // 1500 mm
96const NX_BIOME_P_VERY_WET: nx_int = 32768000 // 2000 mm
97const NX_BIOME_P_EXTREME_WET: nx_int = 40960000 // 2500 mm
99const NX_BIOME_E_ALPINE: nx_int = 49152000 // 3000 m (treeline)
100const NX_BIOME_E_HIGH_MOUNTAIN: nx_int = 65536000 // 4000 m
106const NX_BIOME_ARCTIC_ICE: nx_int = 0
107const NX_BIOME_TUNDRA: nx_int = 1
108const NX_BIOME_TAIGA: nx_int = 2
109const NX_BIOME_COLD_DESERT: nx_int = 3
110const NX_BIOME_TEMPERATE_GRASSLAND: nx_int = 4
111const NX_BIOME_TEMPERATE_FOREST: nx_int = 5
112const NX_BIOME_TEMPERATE_RAINFOREST: nx_int = 6
113const NX_BIOME_CHAPARRAL: nx_int = 7
114const NX_BIOME_DESERT: nx_int = 8
115const NX_BIOME_SAVANNA: nx_int = 9
116const NX_BIOME_TROPICAL_FOREST: nx_int = 10
117const NX_BIOME_TROPICAL_RAINFOREST: nx_int = 11
118const NX_BIOME_ALPINE: nx_int = 12
120const NX_BIOME_COUNT: nx_int = 13

functions

123func nx_biome_is_valid(b: nx_int) -> nx_int
called by 3: mainmainmain
144func nx_biome_lushness_q14(b: nx_int) -> nx_int
176func nx_biome_classify_q14(
called by 1: main
232func main() -> i64