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