Namespace GrindFest.Editor.DungeonBuilding.Fluent
Classes
- Cells
Composable cell selectors. Each selector resolves to a concrete set of cells (Vector2Int) given a room's shape, OR maps to a PGG SR_CellPosition rule when no explicit shape is known (procgen-time placement).
Static API mirrors design intent:
Cells.Center Cells.Corners Cells.WallEdges Cells.WallEdges.North Cells.Row(z: 1) Cells.Row(z: 1).Between(x: 1, 5) Cells.Column(x: 2) Cells.Cross // horizontal + vertical center axes Cells.All Cells.At(2, 3) Cells.AtMany((1,2), (3,2), (2,1), (2,3)) Cells.Where((x, z) => x == z)
- ColumnSelector
Column selector with optional z-range constraint.
- Dungeon
Entry point for fluent dungeon authoring. Produces PGG assets (FieldSetup / ModificatorsPack / RoomShape) from a high-level, intent-based description.
Usage:
var shell = Dungeon.Shell("ChurchShell") .StoneWalls() .StoneFloors() .WallProps(ChurchPropPalette.CandleWall, tag: "Light", minSpacing: 2) .Save(); Dungeon.Room("ChurchOssuary").Size(5, 4) .Shell(shell) .DressCorners(ChurchPropPalette.SkullPiles) .DressWalls(ChurchPropPalette.BonePiles, probability: 0.65f) .DressFloor(ChurchPropPalette.Skulls, probability: 0.18f) .Save();Each
.Save()writes/overwrites a PGG FieldSetup asset underAssets/_GrindFest/Dungeons/Fields/and a backing ModificatorsPack underAssets/_GrindFest/Dungeons/Mods/. Validation runs before save and reports missing prefabs, conflicting rules, and selectors that match zero cells.
- DungeonAuthoringException
Thrown by the fluent compiler when validation fails.
- DungeonDefBuilder
Top-level dungeon definition: ties a BuildPlanner (layout algorithm) to a roster of rooms with placement rules (counts, roles, weights).
Common usage:
Dungeon.Define("ChurchCrypt") .Plan(PlanPresets.GridCorridors(roomCount: 6)) .Entrance(churchEntranceRoom) .Use(ossuary).Count(2) .Use(reliquary).Count(1).Role(Role.Center) .Use(priestsTomb).Count(1).Role(Role.Endpoint) .ConnectWith(stoneDoor) .Save();
- PlacementBuilder
Fluent configuration of a single dressing placement: where it goes, how many, with what variation. Compiles to one FieldModification + FieldSpawner + appropriate SpawnRules.
Selector chain (one of):
.At(selector)— one prop per matched cell..Along(selector)— props snapped to a feature (typically walls)..AtCell(x, z)— single exact cell shortcut..AtCells(...)— multiple exact cells shortcut..AlongRow(z, ...)— row shortcut.
Quantity (modifies the chain):
.Single()— exactly one across all matched cells..MaxCount(n)— at most n..Probability(p)— per-cell chance.
Variation:
.RotateY(deg)— fixed yaw..RandomYaw(maxDeg)— random yaw in [-maxDeg, +maxDeg]..Jitter(amount)— random position offset within cell..MinDistanceFrom(tag, dist)— spacing from other tagged props..Tag(t)— assign a tag for other rules to reference.
- RoomBuilder
Fluent builder for a single dungeon room. Compiles to one FieldSetupWithShape asset + accompanying RoomShape + ModificatorsPack for its dressing.
Three shape modes:
.Size(w, h)— simple rectangular room (most common)..Shape(c => c.Rect(...).Cells(...))— custom multi-cell shape (cruciform, L, etc.)..PlannerShape()— let the BuildPlanner choose the shape at generation time.
- RoomUsageBuilder
Per-room placement constraints inside a dungeon definition.
- RowSelector
Row selector with optional x-range constraint.
- ShapeBuilder
Custom cell-list builder for non-rectangular rooms (cruciform, L-shape, hex approximations, etc.). Used inside Shape(Action<ShapeBuilder>).
Composable additive grammar:
.Shape(c => c .Rect(0, 4, 2, 2) // horizontal arm of cross .Cells((2,0), (2,1), (2,3), (2,4))) // vertical arm.Shape(c => c .Rect(0, 6, 0, 2) // base 7x3 .RemoveCells((3, 1))) // dig out center for pit</code></pre>
- ShellBuilder
Fluent builder for a shared room shell — walls, floors, pillars, ambient lighting. Compiles to one reusable FIMSpace.Generating.ModificatorsPack that multiple rooms can reference via Shell(ShellBuilder).
Common preset usage:
var shell = Dungeon.Shell("ChurchShell") .StoneWalls() .StoneFloors() .StonePillars() .WallProps(CandleWallPrefab, tag: "Light", minSpacing: 2) .Save();
- WallEdgesSelector
Wall-edge selector with directional sub-selectors.
Interfaces
- ICellSelector
Resolves to a concrete set of cells given a room's bounding box.