Class RandomRoomsMapCreationStrategy<T>
The RandomRoomsMapCreationStrategy creates a Map of the specified type by placing rooms randomly and then connecting them with cooridors
Inheritance
Inherited Members
Namespace: RogueSharp.MapCreation
Assembly: RogueSharp.dll
Syntax
public class RandomRoomsMapCreationStrategy<T> : IMapCreationStrategy<T> where T : IMap, new()
Type Parameters
Name | Description |
---|---|
T | The type of IMap that will be created |
Constructors
| Improve this Doc View SourceRandomRoomsMapCreationStrategy(Int32, Int32, Int32, Int32, Int32)
Constructs a new RandomRoomsMapCreationStrategy with the specified parameters
Declaration
public RandomRoomsMapCreationStrategy(int width, int height, int maxRooms, int roomMaxSize, int roomMinSize)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width of the Map to be created |
System.Int32 | height | The height of the Map to be created |
System.Int32 | maxRooms | The maximum number of rooms that will exist in the generated Map |
System.Int32 | roomMaxSize | The maximum width and height of each room that will be generated in the Map |
System.Int32 | roomMinSize | The minimum width and height of each room that will be generated in the Map |
Remarks
Uses DotNetRandom as its RNG
RandomRoomsMapCreationStrategy(Int32, Int32, Int32, Int32, Int32, IRandom)
Constructs a new RandomRoomsMapCreationStrategy with the specified parameters
Declaration
public RandomRoomsMapCreationStrategy(int width, int height, int maxRooms, int roomMaxSize, int roomMinSize, IRandom random)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | width | The width of the Map to be created |
System.Int32 | height | The height of the Map to be created |
System.Int32 | maxRooms | The maximum number of rooms that will exist in the generated Map |
System.Int32 | roomMaxSize | The maximum width and height of each room that will be generated in the Map |
System.Int32 | roomMinSize | The minimum width and height of each room that will be generated in the Map |
IRandom | random | A class implementing IRandom that will be used to generate pseudo-random numbers necessary to create the Map |
Methods
| Improve this Doc View SourceCreateMap()
Creates a new IMap of the specified type.
Declaration
public T CreateMap()
Returns
Type | Description |
---|---|
T | An IMap of the specified type |
Remarks
The Map will be generated by trying to place rooms up to the maximum number specified in random locations around the Map. Each room will have a height and width between the minimum and maximum room size. If a room would be placed in such a way that it overlaps another room, it will not be placed. Once all rooms have have been placed, or thrown out because they overlap, corridors will be created between rooms in a random manner.