Skip to main content

Crate oku

Crate oku 

Source
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§

AgentCatalog
Collection of building templates available for placement.
BuildingTemplate
A building type that can be placed in the city.
CityLayout
A fully generated city layout with urban semantics.
CitySpec
Top-level specification for a city generation request.
ConnectionDemand
A demand for connection to another category.
ErosionSpec
Erosion parameters.
InteractionFn
Describes the spatial relationship between two building categories.
InteractionMatrix
Matrix of pairwise category interactions, loaded from JSON.
Phase
A named generation phase filtering by category.
PlacedBuilding
A building placed at a specific position.
Road
A routed road between two buildings.
ScoreBreakdown
Per-metric breakdown of the composite layout score.
SemanticCell
Semantic information for a single grid cell.
SemanticGrid
A semantic grid with richer per-cell information.
TileMap
A 2D tile map suitable for rendering.

Enums§

ArrivalStrategy
Strategy for ordering agent placement.
Category
Functional category of a building.
CityType
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.