code wiki / (root) / nx_world_seed.nx

nx_world_seed.nx

buildroot/runtime/nx_world_seed.nx

4265 B132 linesdepth 4pulls 6 transitivereach 3 importersview sourcekind librarytopic world
docsdependenciesstructsconstsfunctions

about

nx_world_seed.nx -- deterministic worldgen for voxel tissue. xorshift64 PRNG + procedural worldgen. Same seed = same world, byte-for-byte. Foundation for Minecraft-equivalent procedural terrain on T1/MCU — no float, no allocation, MCU-compatible. V1 generates a simple terrain: z=0..2 : stone (palette idx 1) z=3..h : dirt (idx 2) where h is per-column Q14 noise z=h+1..z_max : air (idx 0) The "Q14 noise" is a cheap pseudo-Perlin: hash (x, y, seed) into a height in [3, z_max). Not smooth, but deterministic + repeatable. Composes: nx_tissue -- the world being filled nx_palette -- voxel indices (0=air, 1=stone, 2=dirt, 3=grass) nx_q14_math -- sin lookup for cheap noise

dependencies 4 imports · 3 importers

nx_syscalls.nx nx_tier.nx nx_tissue.nx nx_palette.nx nx_world_seed.nx nx_game_engine_compose_test.nx nx_voxel_native.nx nx_world_seed_test.nx

imports: nx_syscalls.nxnx_tier.nxnx_tissue.nxnx_palette.nx

imported by: nx_game_engine_compose_test.nxnx_voxel_native.nxnx_world_seed_test.nx

structs

38struct NxWorldSeedState

consts

24const NX_MAGIC_73856093: i64 = 73856093
25const NX_MAGIC_19349663: i64 = 19349663
27const NX_WS_PAL_AIR: nx_int = 0
28const NX_WS_PAL_STONE: nx_int = 1
29const NX_WS_PAL_DIRT: nx_int = 2
30const NX_WS_PAL_GRASS: nx_int = 3
31const NX_WS_PAL_WATER: nx_int = 4
33const NX_WS_OK: nx_int = 0
34const NX_WS_ERR_BAD_TISSUE: nx_int = 1

functions

49func nx_xorshift64(state: nx_size) -> nx_size
60func nx_world_seed_state_new(seed: nx_size) -> *NxWorldSeedState
called by 1: main calls 1: sys_mmap
69func nx_world_seed_next(s: *NxWorldSeedState) -> nx_size
called by 1: main calls 1: nx_xorshift64
80func _height_at(seed: nx_size, x: nx_size, y: nx_size,
93func nx_world_seed_generate(world: *NxTissue, seed: nx_size) -> nx_int
called by 3: mainvx_buildmain calls 1: _height_at