Expand description
§Oku
PCB-inspired procedural city generation — a domain-specific facade over ogun.
§Quick start
use oku::*;
let catalog = AgentCatalog {
templates: vec![
BuildingTemplate {
name: "market".into(),
category: Category::Commercial,
radius: 2,
priority: 0.8,
connections: vec![],
material: Material::Stone,
},
BuildingTemplate {
name: "house".into(),
category: Category::Residential,
radius: 1,
priority: 0.3,
connections: vec![],
material: Material::Wood,
},
],
};
let spec = CitySpec {
width: 40,
height: 40,
city_type: CityType::TradeHub,
era: Era::Growth,
beta: 2.0,
seed: 42,
erosion: None,
};
let city = generate(&spec, &catalog);
let tilemap = city.to_tilemap();Structs§
- Agent
Catalog - Collection of building templates available for placement.
- Building
Template - A building type that can be placed in the city.
- City
Layout - A fully generated city layout with urban semantics.
- City
Spec - Top-level specification for a city generation request.
- Connection
Demand - A demand for connection to another category.
- Erosion
Spec - Erosion parameters.
- Interaction
Fn - Describes the spatial relationship between two building categories.
- Interaction
Matrix - Matrix of pairwise category interactions, loaded from JSON.
- Phase
- A named generation phase filtering by category.
- Placed
Building - A building placed at a specific position.
- Road
- A routed road between two buildings.
- Score
Breakdown - Per-metric breakdown of the composite layout score.
- Semantic
Cell - Semantic information for a single grid cell.
- Semantic
Grid - A semantic grid with richer per-cell information.
- TileMap
- A 2D tile map suitable for rendering.
Enums§
- Arrival
Strategy - Strategy for ordering agent placement.
- Category
- Functional category of a building.
- City
Type - The kind of settlement to generate.
- Era
- The temporal era — influences agent availability and arrival order.
- Material
- Building material — affects erosion durability.
- Tile
- A single tile in the output map.
Functions§
- generate
- Generate a city layout from a specification and agent catalog.