Class CaveMapCreationStrategy<T>
The CaveMapCreationStrategy creates a Map of the specified type by using a cellular automata algorithm for creating a cave-like map.
Inheritance
Inherited Members
Namespace: RogueSharp.MapCreation
Assembly: RogueSharp.dll
Syntax
public class CaveMapCreationStrategy<T> : IMapCreationStrategy<T> where T : class, IMap, new()
Type Parameters
Name | Description |
---|---|
T | The type of IMap that will be created |
Constructors
| Improve this Doc View SourceCaveMapCreationStrategy(Int32, Int32, Int32, Int32, Int32)
Constructs a new CaveMapCreationStrategy with the specified parameters
Declaration
public CaveMapCreationStrategy(int width, int height, int fillProbability, int totalIterations, int cutoffOfBigAreaFill)
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 | fillProbability | Recommend int between 40 and 60. Percent chance that a given cell will be a floor when randomizing all cells. |
System.Int32 | totalIterations | Recommend int between 2 and 5. Number of times to execute the cellular automata algorithm. |
System.Int32 | cutoffOfBigAreaFill | Recommend int less than 4. The iteration number to switch from the large area fill algorithm to a nearest neighbor algorithm |
Remarks
Uses DotNetRandom as its RNG
CaveMapCreationStrategy(Int32, Int32, Int32, Int32, Int32, IRandom)
Constructs a new CaveMapCreationStrategy with the specified parameters
Declaration
public CaveMapCreationStrategy(int width, int height, int fillProbability, int totalIterations, int cutoffOfBigAreaFill, 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 | fillProbability | Recommend int between 40 and 60. Percent chance that a given cell will be a floor when randomizing all cells. |
System.Int32 | totalIterations | Recommend int between 2 and 5. Number of times to execute the cellular automata algorithm. |
System.Int32 | cutoffOfBigAreaFill | Recommend int less than 4. The iteration number to switch from the large area fill algorithm to a nearest neighbor algorithm |
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 using cellular automata. First each cell in the map will be set to a floor or wall randomly based on the specified fillProbability. Next each cell will be examined a number of times, and in each iteration it may be turned into a wall if there are enough other walls near it. Once finished iterating and examining neighboring cells, any isolated map regions will be connected with paths.