Class RoomDoorConnection
Selects and opens walls of rectangular rooms to connect them to adjacent open spaces (typically mazes/tunnels). Components Required:
Component | Default Tag |
---|---|
ItemList<TItem> | "Rooms" |
ISettableGridView<T> where T is bool | "WallFloor" |
Component | Default Tag |
---|---|
DoorList | "Doors" |
Inherited Members
Namespace: GoRogue.MapGeneration.Steps
Assembly: GoRogue.dll
Syntax
public class RoomDoorConnection : GenerationStep
Remarks
This algorithm goes through each room specified in the ItemList<TItem> context component, and selects a random number of sides to place connections on (within the parameters specified). For each side, it then selects randomly from the valid connection points on that side, and carves out the selected location by setting its value to true in the "WallFloor" map view, and adding it to the list of doors associated with the appropriate room in the DoorList context component. It continues to select connection points on a side until the CancelConnectionPlacementChance succeeds. CancelConnectionPlacementChance is increased by CancelConnectionPlacementChanceIncrease each time a point is selected. The algorithm will never select two adjacent points on a side as connection points. Similarly, it will never break through the edges of the map. If an existing DoorList component exists on the map context with the proper tag, that component is used to record the doors generated; if not, a new one is created.
Constructors
View SourceRoomDoorConnection(string?, string?, string?, string?)
Creates a new maze generation step.
Declaration
public RoomDoorConnection(string? name = null, string? roomsComponentTag = "Rooms", string? wallFloorComponentTag = "WallFloor", string? doorsListComponentTag = "Doors")
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the generation step. Defaults to RoomDoorConnection. |
string | roomsComponentTag | Optional tag that must be associated with the component that contains the rooms being connected by this algorithm. Defaults to "Rooms". |
string | wallFloorComponentTag | Optional tag that must be associated with the component used to set wall/floor status of tiles changed by this algorithm. Defaults to "WallFloor". |
string | doorsListComponentTag | Optional tag that must be associated with the component created/used to record the locations of doors created by this algorithm. Defaults to "Doors". |
Fields
View SourceCancelConnectionPlacementChance
A chance out of 100 to cancel placing a door on a side after one has been placed (per side). Defaults to 70.
Declaration
public ushort CancelConnectionPlacementChance
Field Value
Type | Description |
---|---|
ushort |
CancelConnectionPlacementChanceIncrease
Increase the CancelConnectionPlacementChance value by this amount each time a door is placed (per side). Defaults to 10.
Declaration
public ushort CancelConnectionPlacementChanceIncrease
Field Value
Type | Description |
---|---|
ushort |
CancelSideConnectionSelectChance
A chance out of 100 to cancel selecting sides to process (per room). Defaults to 50.
Declaration
public ushort CancelSideConnectionSelectChance
Field Value
Type | Description |
---|---|
ushort |
DoorsListComponentTag
Optional tag that must be associated with the component created/used to record the locations of doors created by this algorithm.
Declaration
public readonly string? DoorsListComponentTag
Field Value
Type | Description |
---|---|
string |
MaxSidesToConnect
Maximum sides of each room to process. Defaults to 4.
Declaration
public ushort MaxSidesToConnect
Field Value
Type | Description |
---|---|
ushort |
MinSidesToConnect
Minimum sides of each room to process. Defaults to 1.
Declaration
public ushort MinSidesToConnect
Field Value
Type | Description |
---|---|
ushort |
RNG
The RNG to use for connections.
Declaration
public IEnhancedRandom RNG
Field Value
Type | Description |
---|---|
IEnhancedRandom |
RoomsComponentTag
Optional tag that must be associated with the component that contains the rooms being connected by this algorithm.
Declaration
public readonly string? RoomsComponentTag
Field Value
Type | Description |
---|---|
string |
WallFloorComponentTag
Optional tag that must be associated with the component used to set wall/floor status of tiles changed by this algorithm.
Declaration
public readonly string? WallFloorComponentTag
Field Value
Type | Description |
---|---|
string |
Methods
View SourceOnPerform(GenerationContext)
Implement to perform the actual work of the generation step. Use "yield return null" to indicate the end of a "stage", eg. a point where execution can be paused when using GetStageEnumerator().
Declaration
protected override IEnumerator<object?> OnPerform(GenerationContext context)
Parameters
Type | Name | Description |
---|---|---|
GenerationContext | context | Context to perform the generation step on. |
Returns
Type | Description |
---|---|
IEnumerator<object> |