code wiki / (root) / nx_procgen_features.nx

nx_procgen_features.nx

buildroot/runtime/nx_procgen_features.nx

6951 B163 linesdepth 4pulls 5 transitivereach 8 importersview sourcekind librarytopic procgen
docsdependenciesstructsconstsfunctions

about

nx_procgen_features.nx -- feature KINDS assigned by biome law (PROCGEN arc P3 = EXCEED10 ladder R2; seeds bucket B6 structures). The grader's FEATURE_VARIETY axis (Shannon entropy over a kind histogram) was structurally ABSENT (=0): the landscape's poisson points had positions but no KINDS. This module gives each feature a kind the causal way -- the biome it stands in decides what can grow there, and a seeded jitter stream picks within the biome's mix: TREE -- forests dominant; grassland scatter; treeline thins them ROCK -- deserts, tundra, snowfields, ice; outcrops elsewhere SHRUB -- the understory mix everywhere green WATER -- rare: oasis (desert), melt pond (tundra), swamp pool (tropical) -- placed where water causally collects The mix table is the law (build-intelligence cardinal: a biome with bad features gets a BETTER mix row, never a stripped one). No TREE in DESERT is a tested invariant, not a comment. Deterministic per (features, biome_map, seed): byte-identical kinds. license_tier: ORIGINAL

dependencies 4 imports · 4 importers

nx_syscalls.nx nx_tier.nx nx_prng.nx nx_procgen_biome.nx nx_procgen_features.nx _ft_diag.nx nx_procgen_features_test.nx nx_procgen_water_test.nx nx_worldgen_tunelib.nx

imports: nx_syscalls.nxnx_tier.nxnx_prng.nxnx_procgen_biome.nx

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

structs

none

consts

27const NX_MAGIC_1024: i64 = 1024
30const NX_FEAT_TREE: nx_int = 0
31const NX_FEAT_ROCK: nx_int = 1
32const NX_FEAT_SHRUB: nx_int = 2
33const NX_FEAT_WATER: nx_int = 3
34const NX_FEAT_N_KINDS: nx_int = 4
38const NX_FEAT_SEED_OFF: nx_int = 24107

functions

40func nx_feature_kind_is_valid(k: nx_int) -> nx_int
55func nx_feature_kind_pick(biome: nx_int, jitter_q10: nx_int) -> nx_int
called by 1: nx_feature_assign
101func nx_feature_assign(xs: *i64, ys: *i64, n: nx_int,
128func nx_feature_assign_with_water(xs: *i64, ys: *i64, n: nx_int,
called by 2: maintl_eval calls 1: nx_feature_assign
151func nx_feature_hist_build(kinds: *i64, n: nx_int, out_hist: *i64) -> nx_int