| Crates.io | terrain-forge |
| lib.rs | terrain-forge |
| version | 0.6.0 |
| created_at | 2026-01-10 09:52:19.19111+00 |
| updated_at | 2026-01-25 19:00:38.181915+00 |
| description | A modular procedural generation engine for terrain, dungeons, and maps |
| homepage | |
| repository | https://github.com/EliasVahlberg/terrain-forge |
| max_upload_size | |
| id | 2033972 |
| size | 906,408 |

A comprehensive Rust library for procedural terrain and dungeon generation with semantic analysis capabilities.
Crates.io: https://crates.io/crates/terrain-forge
Migration: v0.6.0 guide
[dependencies]
terrain-forge = "0.6"
use terrain_forge::{Grid, ops};
fn main() {
let mut grid = Grid::new(80, 60);
ops::generate("bsp", &mut grid, Some(12345), None).unwrap();
println!("Generated {} floor tiles", grid.count(|t| t.is_floor()));
}
The Glass Seam Bridging Algorithm is a novel connectivity algorithm designed specifically for TerrainForge. It ensures map connectivity by finding the optimal set of tunnels to connect disconnected floor regions while minimizing total tunnel length.
📄 Read the full algorithm specification
📄 Download the research paper (PDF)
Key features:
| Before GSB | After GSB |
|---|---|
![]() |
![]() |
| 97 disconnected regions (highly fragmented) | 23 connected regions (76% reduction) |
| 0.21 connectivity • 29.1% floors | 0.78 connectivity • 31.2% floors |
Color-coded semantic analysis showing dramatic connectivity improvement (+0.57 connectivity, +2.1% floors) on cellular automata caves (160×120 grid)
| Algorithm | Description | Semantic Support |
|---|---|---|
bsp |
Binary Space Partitioning - structured rooms | ✅ for_rooms() |
cellular |
Cellular Automata - organic caves | ✅ for_caves() |
dla |
Diffusion Limited Aggregation | ✅ default() |
drunkard |
Drunkard Walk - winding passages | ✅ default() |
maze |
Perfect maze generation | ✅ for_mazes() |
rooms |
Simple room placement | ✅ for_rooms() |
voronoi |
Voronoi diagram regions | ✅ default() |
wfc |
Wave Function Collapse | ✅ default() |
percolation |
Physics-based generation | ✅ default() |
diamond_square |
Fractal heightmaps | ✅ default() |
fractal |
Fractal terrain | ✅ default() |
noise_fill |
Noise-driven threshold fill | ✅ default() |
agent |
Multi-agent carving | ✅ default() |
glass_seam |
Region connector | ✅ default() |
room_accretion |
Brogue-style organic dungeons | ✅ for_rooms() |
# Generate basic terrain
cargo run --bin demo -- gen bsp -s 12345 -o output.png
# Semantic generation with visualization
cargo run --bin demo -- gen room_accretion --semantic --text -o semantic.txt
# Compare algorithms
cargo run --bin demo -- compare bsp cellular maze -s 12345
Licensed under the MIT License. See LICENSE for details.