Show / Hide Table of Contents

Class RoomDoorConnection

Selects and opens walls of rectangular rooms to connect them to adjacent open spaces (typically mazes/tunnels). Components Required:

ComponentDefault Tag
ItemList<TItem> "Rooms"
ISettableGridView<T> where T is bool"WallFloor"
Components Added/Used:
ComponentDefault Tag
DoorList "Doors"
In the case of the DoorsList component, an existing component is used if an appropriate one is present; a new one is added if not.
Inheritance
Object
GenerationStep
RoomDoorConnection
Inherited Members
GenerationStep.Name
GenerationStep.PerformStep(GenerationContext)
GenerationStep.GetStageEnumerator(GenerationContext)
GenerationStep.RequiredComponents
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

RoomDoorConnection(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

CancelConnectionPlacementChance

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
UInt16

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
UInt16

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
UInt16

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
UInt16

MinSidesToConnect

Minimum sides of each room to process. Defaults to 1.

Declaration
public ushort MinSidesToConnect
Field Value
Type Description
UInt16

RNG

The RNG to use for connections.

Declaration
public IEnhancedRandom RNG
Field Value
Type Description
ShaiRandom.Generators.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

OnPerform(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>
Overrides
GenerationStep.OnPerform(GenerationContext)

Extension Methods

Utility.Yield<T>(T)
In This Article
Back to top Generated by DocFX