Show / Hide Table of Contents

Class RoomsGenerator

Carves out non-overlapping rooms in a map. Rooms generated will not overlap with themselves, or any existing open areas on the given map. Rooms will not be connected -- for automatic connection of rooms generated by this generator, see GenerateDungeonMazeMap(ISettableMapView<Boolean>, Int32, Int32, Int32, Int32, Single, Single, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32, Int32) and overloads.

Inheritance
System.Object
RoomsGenerator
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: GoRogue.MapGeneration.Generators
Assembly: GoRogue.dll
Syntax
public static class RoomsGenerator

Methods

| Improve this Doc View Source

Generate(ISettableMapView<Boolean>, Int32, Int32, Int32, Int32, Single, Single, Int32, Int32)

Carves random rectangles out of the map, setting the interior of the room to true. Does not set the wall of the rooms to false.

Declaration
public static IEnumerable<Rectangle> Generate(ISettableMapView<bool> map, int minRooms, int maxRooms, int roomMinSize, int roomMaxSize, float roomSizeRatioX = 1F, float roomSizeRatioY = 1F, int maxCreationAttempts = 10, int maxPlacementAttempts = 10)
Parameters
Type Name Description
ISettableMapView<System.Boolean> map

The map to modify.

System.Int32 minRooms

Minimum amount of rooms to generate.

System.Int32 maxRooms

Maximum amount of rooms to generate.

System.Int32 roomMinSize

The minimum size of the room. Forces an odd number.

System.Int32 roomMaxSize

The maximum size of the room. Forces an odd number.

System.Single roomSizeRatioX

The ratio of the room width to the height. Defaults to 1.0.

System.Single roomSizeRatioY

The ratio of the room height to the width. Defaults to 1.0.

System.Int32 maxCreationAttempts

The max times to re-generate a room that cannot be placed before giving up on placing that room. Defaults to 10.

System.Int32 maxPlacementAttempts

The max times to attempt to place a room in a map without intersection, before giving up and re-generating that room. Defaults to 10.

Returns
Type Description
System.Collections.Generic.IEnumerable<Rectangle>

A collection of rectangles representing the interior of the rooms that were added to the map.

| Improve this Doc View Source

Generate(ISettableMapView<Boolean>, IGenerator, Int32, Int32, Int32, Int32, Single, Single, Int32, Int32)

Carves random rectangles out of the map, placing rooms at odd x and y positions, with odd width/height. Sets the interior of the room to true. Does not set the wall of the rooms to false.

Declaration
public static IEnumerable<Rectangle> Generate(ISettableMapView<bool> map, IGenerator rng, int minRooms, int maxRooms, int roomMinSize, int roomMaxSize, float roomSizeRatioX = 1F, float roomSizeRatioY = 1F, int maxCreationAttempts = 10, int maxPlacementAttempts = 10)
Parameters
Type Name Description
ISettableMapView<System.Boolean> map

The map to modify.

Troschuetz.Random.IGenerator rng

RNG to use.

System.Int32 minRooms

Minimum amount of rooms to generate.

System.Int32 maxRooms

Maximum amount of rooms to generate.

System.Int32 roomMinSize

The minimum size of the room. Forces an odd number.

System.Int32 roomMaxSize

The maximum size of the room. Forces an odd number.

System.Single roomSizeRatioX

The ratio of the room width to the height. Defaults to 1.0.

System.Single roomSizeRatioY

The ratio of the room height to the width. Defaults to 1.0.

System.Int32 maxCreationAttempts

The max times to re-generate a room that cannot be placed before giving up on placing that room. Defaults to 10.

System.Int32 maxPlacementAttempts

The max times to attempt to place a room in a map without intersection, before giving up and re-generating that room. Defaults to 10.

Returns
Type Description
System.Collections.Generic.IEnumerable<Rectangle>

A collection of rectangles representing the interior of the rooms that were added to the map.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX