Struct DoorPlacementSettings
Immutable settings for the door placement post-processor.
Inherited Members
Namespace: Scylla.Core.Util.ProceduralMapGen
Assembly: ScyllaCore.dll
Syntax
public readonly struct DoorPlacementSettings
Remarks
The door placement post-processor scans the boundary between room cells and corridor cells in a generated map. Each valid candidate location - a room-edge cell adjacent to a corridor cell - is considered for door placement. Whether a candidate actually receives a door is governed by three parameters:
- PlacementProbability - a per-candidate random roll.
- MaxDoorsPerRoom - a hard cap on how many doors any single room may receive (0 = unlimited).
- MinDoorSpacing - a minimum cell distance between any two doors on the same room's boundary.
Pass a DoorPlacementSettings instance to the appropriate ProceduralMapPostProcessor door-placement method. Door cells are written using the DoorValue configured in the shared generation settings.
Constructors
DoorPlacementSettings(float, int, int)
Initializes a new DoorPlacementSettings with the specified parameters.
Declaration
public DoorPlacementSettings(float placementProbability = 0.3, int maxDoorsPerRoom = 0, int minDoorSpacing = 2)
Parameters
| Type | Name | Description |
|---|---|---|
| float | placementProbability | Per-candidate door placement probability in [0.0, 1.0]. A value of |
| int | maxDoorsPerRoom | Maximum number of doors per room. Pass |
| int | minDoorSpacing | Minimum cell distance between consecutive doors on the same room boundary.
A value of |
Fields
Default
Default preset: 30 % placement probability, unlimited doors per room, and a minimum spacing of 2 cells. Produces a moderate door density suitable for most dungeon types.
Declaration
public static readonly DoorPlacementSettings Default
Field Value
| Type | Description |
|---|---|
| DoorPlacementSettings |
Dense
Dense preset: 60 % placement probability, unlimited doors per room, and a minimum spacing of 1 cell. Produces heavily gated layouts where most room-corridor boundaries receive a door.
Declaration
public static readonly DoorPlacementSettings Dense
Field Value
| Type | Description |
|---|---|
| DoorPlacementSettings |
MaxDoorsPerRoom
Maximum number of doors allowed per room. A value of 0 is a sentinel
meaning "unlimited" - no per-room cap is enforced.
Declaration
public readonly int MaxDoorsPerRoom
Field Value
| Type | Description |
|---|---|
| int |
Remarks
When set to a positive integer, the post-processor stops placing doors for a room once it reaches this count, regardless of how many valid candidates remain on that room's boundary.
Lerp(DoorPlacementSettings, DoorPlacementSettings, float) preserves the sentinel semantics: when either operand has
a value of 0, the result is determined by a step switch at t = 0.5
rather than numeric interpolation, so the sentinel meaning is never lost through
rounding.
MinDoorSpacing
Minimum cell distance required between any two doors placed along the same room's boundary.
Declaration
public readonly int MinDoorSpacing
Field Value
| Type | Description |
|---|---|
| int |
Remarks
After a door is placed at a candidate cell, subsequent candidates within
MinDoorSpacing cells of that door (measured along the room boundary)
are skipped. A value of 1 allows doors to be placed in adjacent cells.
A value of 2 or higher enforces a gap of at least that many cells between
consecutive doors. A value of 0 applies no spacing restriction.
PlacementProbability
Probability in the range [0.0, 1.0] that a valid door candidate location receives a door during post-processing.
Declaration
public readonly float PlacementProbability
Field Value
| Type | Description |
|---|---|
| float |
Remarks
Each eligible boundary cell between a room and a corridor is independently tested
against this value using a uniform random roll. A value of 0.0 places no
doors; a value of 1.0 places a door at every valid candidate (subject to
MaxDoorsPerRoom and MinDoorSpacing). A value of
0.3 places a door at roughly 30 % of all candidates.
Sparse
Sparse preset: 15 % placement probability, at most 2 doors per room, and a minimum spacing of 3 cells. Produces lightly gated rooms where most room entrances have no door, and those that do are well separated.
Declaration
public static readonly DoorPlacementSettings Sparse
Field Value
| Type | Description |
|---|---|
| DoorPlacementSettings |
Methods
Lerp(DoorPlacementSettings, DoorPlacementSettings, float)
Linearly interpolates between two DoorPlacementSettings instances and returns a new blended settings struct.
Declaration
public static DoorPlacementSettings Lerp(DoorPlacementSettings a, DoorPlacementSettings b, float t)
Parameters
| Type | Name | Description |
|---|---|---|
| DoorPlacementSettings | a | Start settings returned when |
| DoorPlacementSettings | b | End settings returned when |
| float | t | Interpolation factor. Values outside [0, 1] are clamped before use. |
Returns
| Type | Description |
|---|---|
| DoorPlacementSettings | A new DoorPlacementSettings with numerically blended fields,
respecting the |
Remarks
PlacementProbability and MinDoorSpacing are interpolated numerically. MinDoorSpacing is rounded to the nearest integer.
MaxDoorsPerRoom uses 0 as a sentinel meaning "unlimited".
To preserve this semantics, numeric interpolation is only applied when both
a and b have non-zero values. When
either operand is 0, the result switches at t = 0.5 (taking
a's value below 0.5 and b's value at
or above 0.5) so the unlimited sentinel is never lost through rounding.