reikhelm/reikhelm-core/src/passes/mod.rs
Parley Hatch 93c32a652f fix(core): pierce-aware DoorPlacer with configurable door_chance
Corridors carve center-to-center and pierce room walls, so the old
wall-threshold rule placed almost no doors. Detect the pierced-wall
threshold (corridor floor outside a room, room on one side, corridor on
the opposite) and mark it Door with probability door_chance (default
0.5), else leave it an open archway. Connectivity is via corridor floor,
independent of doors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-28 22:19:59 -06:00

39 lines
1.9 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//! The vocabulary of generation [`crate::pass::Pass`] implementations.
//!
//! Each concrete pass is its own submodule, added by Tasks 711. Passes never
//! call each other; they communicate **only** through the
//! [`crate::pass::GenContext`] fields (`tiles`, `regions`, `graph`,
//! `blackboard`). This module's job is to host them and to document the
//! integration contract below.
//!
//! # Inter-Pass Data Contract (v1 dungeon)
//!
//! This is the integration contract for the v1 dungeon recipe. Each pass reads
//! certain `GenContext` state and writes others; the table is the single source
//! of truth so the five passes can be implemented and unit-tested in parallel,
//! each by constructing a `GenContext` in its required input state.
//!
//! | Pass | Reads | Writes |
//! |------|-------|--------|
//! | `BspPartition` | (empty grid) | `ctx.regions`: one placeholder `Region { kind: Room, bounds: <leaf rect>, cells: [] }` per BSP leaf |
//! | `RoomCarver` | `ctx.regions` (placeholder Rooms) | carves `Floor` into `ctx.tiles`; shrinks each Room's `bounds` to its actual room rect and fills `cells` |
//! | `MstConnect` | `ctx.regions` (kind=Room, non-empty `cells`) centers | `ctx.graph`: edges `{ a, b, at: None }` forming an MST over rooms + a few extra loop edges |
//! | `CorridorCarver` | `ctx.graph` edges + Room region bounds/centers | carves L-shaped `Floor` corridors into `ctx.tiles`; appends `Region { kind: Corridor, .. }` per corridor |
//! | `DoorPlacer` | `ctx.tiles` + `ctx.regions` + `ctx.graph` | converts boundary `Wall` cells (room↔corridor) to `Door`; sets the corresponding `edge.at = Some(point)` |
//!
//! Submodule declarations are appended here by Tasks 711.
pub mod bsp;
pub use bsp::{BspConfig, BspPartition};
pub mod room;
pub use room::{RoomCarver, RoomConfig};
pub mod connect;
pub use connect::{ConnectConfig, MstConnect};
pub mod corridor;
pub use corridor::CorridorCarver;
pub mod door;
pub use door::{DoorConfig, DoorPlacer};