terrain_gen
Core procedural terrain and biome generation mechanics.
This module utilizes high-performance @njit (Numba) compilation to execute complex 3D Simplex noise and fractional Brownian motion calculations across the CPU. It dictates the shaping of landmasses, continentalness modifiers, biome distributions (sand, snow, grass), cave carving logic, and structural tree generation entirely lock-free to prevent main-thread latency.
- terrain_gen.random() x in the interval [0, 1).
- terrain_gen.get_biome(x, z, perm_array)[source]
Evaluates Simplex noise to determine the overarching temperature and moisture levels of a specific vertical column, shaping its respective biome.
- terrain_gen.get_height(x, z, perm_array)[source]
Calculates the absolute maximum surface elevation of the terrain at a specific X,Z coordinate using fractional Brownian motion and continentalness modifiers.
- terrain_gen.get_index(x, y, z)[source]
Translates a localized 3D chunk coordinate (x, y, z) into a flattened 1D array index for highly optimized, contiguous memory access.
- terrain_gen.set_voxel_column(voxels, x, z, chunk_x, chunk_y, chunk_z, perm_array, perm_grad_array)[source]
Procedurally generates a single vertical column of blocks within a chunk. Applies complex biome mapping, depth stratification, and 3D cave carving logic.
- terrain_gen.place_tree(voxels, x, y, z, voxel_id, tree_prob)[source]
Constructs a localized tree structure (wood trunk and spherical leaf crown) within the chunk volume if probability and physical boundaries allow for it.