nx_decl_random_environment.nx
buildroot/runtime/nx_decl_random_environment.nx
about
nx_decl_random_environment.nx -- declarative environment generator.
license_tier: ORIGINAL
First substrate primitive in the "#tag" ergonomic family: one
substrate call produces a fully-specified procedural environment
from a single MODIFIER + SEED. Equivalent of TypeScript
`#random_environment real` -- the substrate fills in everything
(size, biome, river count, forest count, settlement, decoration
density) with sensible defaults seeded by the modifier.
Mission cardinal: declarative > imperative for scene authoring.
Game authors write one line, substrate composes from
nx_biome_classifier + nx_forest_layout + nx_river_carve + sealed
enums. Per the user's S-class roadmap directive 2026-05-16.
Usage:
let env: NxRandomEnvironment
nx_decl_random_environment(&env, NX_RE_MODIFIER_REAL, 0xC0FFEE)
// env is now fully populated.
dependencies 4 imports · 10 importers
imports: nx_syscalls.nxnx_types.nxnx_tier.nxnx_biome_classifier.nx
imported by: nx_decl_combat_arena.nxnx_decl_combat_arena_test.nxnx_decl_dungeon_floor.nxnx_decl_dungeon_floor_test.nxnx_decl_random_environment_test.nxnx_decl_reflection_test.nxnx_decl_simple_scene.nxnx_decl_simple_scene_test.nxnx_decl_townscape.nxnx_decl_townscape_test.nx
structs
| 57 | struct NxRandomEnvironment |
consts
| 35 | const NX_RE_MODIFIER_REAL: nx_int = 0 // Earth-like physics + biomes |
| 36 | const NX_RE_MODIFIER_FANTASY: nx_int = 1 // exaggerated scale, magic biomes |
| 37 | const NX_RE_MODIFIER_SCI_FI: nx_int = 2 // alien biomes, large scale |
| 38 | const NX_RE_MODIFIER_N: nx_int = 3 |
functions
| 40 | func nx_re_modifier_is_valid(m: nx_int) -> nx_int |
| 49 | func nx_re_modifier_name(m: nx_int) -> *u8 |
| 73 | func _re_hash_mod(seed: nx_int, salt: nx_int, modulus: nx_int) -> nx_int |
| 82 | func _re_default_size(modifier: nx_int) -> nx_int called by 1: nx_decl_random_environment |
| 89 | func _re_default_river_count(modifier: nx_int, biome: nx_int) -> nx_int |
| 102 | func _re_default_forest_count(modifier: nx_int, biome: nx_int) -> nx_int |
| 117 | func _re_default_decoration_density(modifier: nx_int, biome: nx_int) -> nx_int |
| 128 | func _re_default_elevation_max(modifier: nx_int, biome: nx_int) -> nx_int called by 1: nx_decl_random_environment |
| 142 | func nx_decl_random_environment(out: *NxRandomEnvironment, modifier: nx_int, seed: nx_int) -> nx_int |
| 176 | func nx_re_alloc() -> *NxRandomEnvironment |