World Generation¶
The world is generated by WorldGenerator using WorldSettings.
Main Assets¶
Assets/PixitGames/BlockWorld/WorldSettings/DefaultWorldSettings.asset
Assets/PixitGames/BlockWorld/Scripts/WorldGenerator.cs
Assets/PixitGames/BlockWorld/Scripts/Chunk.cs
World Settings¶
| Setting | Meaning |
|---|---|
| Chunk Size X/Y/Z | Size of each generated chunk |
| World Size Chunks X/Z | Initial world size in chunks |
| Min/Max Ground Height | Base terrain height range |
| Max World Height | Clamp for generated terrain height |
| Mountain Threshold | Noise threshold where mountains begin |
| Mountain Max Extra Height | Added height for mountain areas |
| Base Noise Scale | Base terrain noise frequency |
| Mountain Noise Scale | Mountain noise frequency |
| Seed | Deterministic generation seed |
| Biomes | List of available biome assets |
| Biome Size X/Z | Region size used when assigning biomes |
| Blocks | Registry of all block IDs used by the world |
Chunk Building¶
Each chunk stores a 3D byte array of block IDs. The mesh builder skips air and fully surrounded blocks, then combines visible block prefab meshes by material.
This keeps runtime rendering simpler while still allowing custom block prefabs.
Runtime Chunk Expansion¶
WorldGenerator.allowRuntimeChunkExpansion allows missing neighbor chunks to be created when the player places blocks beyond the initial world edge.
Disable it if your game should be bounded to the starting world size.
Regenerating¶
In the editor, use the context menu on WorldGenerator:
Regenerate World
At runtime, SaveManager.NewGame() can randomize the seed and call GenerateWorld().