terrain_forge/lib.rs
1//! # TerrainForge
2//!
3//! A modular procedural generation engine for terrain, dungeons, and maps.
4//!
5//! ## Quick Start
6//!
7//! ```rust
8//! use terrain_forge::{Grid, Tile, algorithms};
9//!
10//! let mut grid = Grid::new(80, 60);
11//! let algo = algorithms::get("bsp").unwrap();
12//! algo.generate(&mut grid, 12345);
13//!
14//! println!("Generated {} floor tiles", grid.count(|t| t.is_floor()));
15//! ```
16//!
17//! ## Algorithms
18//!
19//! 13 generation algorithms available via [`algorithms::get`]:
20//! - `bsp` - Binary Space Partitioning for structured rooms
21//! - `cellular` - Cellular automata for organic caves
22//! - `drunkard` - Random walk for winding corridors
23//! - `maze` - Perfect maze generation
24//! - `rooms` - Simple rectangular rooms
25//! - `voronoi` - Voronoi-based regions
26//! - `dla` - Diffusion-limited aggregation
27//! - `wfc` - Wave Function Collapse
28//! - `percolation` - Connected cluster generation
29//! - `diamond_square` - Heightmap terrain
30//! - `fractal` - Fractal noise terrain
31//! - `agent` - Multi-agent carving
32//! - `glass_seam` - Region connector
33//!
34//! ## Composition
35//!
36//! Chain algorithms with [`compose::Pipeline`] or layer with [`compose::LayeredGenerator`]:
37//!
38//! ```rust
39//! use terrain_forge::{Grid, Tile, Algorithm, algorithms};
40//! use terrain_forge::compose::Pipeline;
41//!
42//! let mut grid = Grid::new(80, 60);
43//! let pipeline = Pipeline::new()
44//! .add(algorithms::get("rooms").unwrap())
45//! .add(algorithms::get("cellular").unwrap());
46//! pipeline.generate(&mut grid, 12345);
47//! ```
48//!
49//! ## Effects
50//!
51//! Post-process with [`effects`]: morphology, connectivity, filters, transforms.
52//!
53//! ## Noise
54//!
55//! [`noise`] module provides Perlin, Simplex, Value, Worley with FBM and modifiers.
56
57mod grid;
58mod rng;
59mod algorithm;
60
61pub mod algorithms;
62pub mod noise;
63pub mod effects;
64pub mod compose;
65pub mod constraints;
66
67pub use grid::{Grid, Cell, Tile};
68pub use rng::Rng;
69pub use algorithm::Algorithm;