Terrain
Rule-based 3D terrain generator, hydraulic erosion engine, prop scatterer, and placement validator.
Generates Unity/Godot-compatible 16-bit heightmaps, eroded valleys, least-cost roads, rivers, flat building pads, and splat maps from JSON specs, then scatters and physics-checks props against slopes and corridors.
git clone https://github.com/BestRoiMedia/bestroi-game-tools.gitWhy we built it
Sculpting terrains by hand makes iterating on road grades, river channels, and building pads painful. Terrain lets agents author landscapes declaratively and catch floating, buried, or colliding props before opening an engine.
Architecture & how it works
Synthesizes layered FBM/ridged/billow noise, applies hand-authored shapes and stream-power/hydraulic/thermal erosion, routes grade-limited roads and downhill rivers via least-cost paths, runs Poisson-disk rule-based prop scattering, and validates placements.
Key capabilities
- Deterministic heightmap generation (16-bit little-endian .raw, .png, .glb, .fbx with LOD0–LOD2)
- Stream-power, hydraulic droplet, and thermal talus erosion with terracing and painted mask ops
- Least-cost auto-routed rivers and grade-limited roads with carved building pads and splat masks
- Rule-based Poisson-disk scatterer (scatter) respecting slope, road/water distance, and clustering
- Placement sanity checker (placecheck) for both instances.json and arbitrary .blend/.glb/.fbx scenes
Usage example
python3 terrain/terrain.py gen ./spec.json --out ./out/hollow
python3 terrain/terrain.py scatter ./out/hollow ./scatter.json
python3 terrain/terrain.py placecheck ./out/hollow/instances.json --terrain ./out/hollow