Class SectionDungeonGenerator

java.lang.Object
squidpony.squidgrid.mapping.SectionDungeonGenerator
All Implemented Interfaces:
IDungeonGenerator
Direct Known Subclasses:
ThinDungeonGenerator

public class SectionDungeonGenerator
extends Object
implements IDungeonGenerator
A good way to create a more-complete dungeon, layering different effects and modifications on top of a dungeon produced by DungeonBoneGen or another dungeon without such effects. Unlike DungeonGenerator, this class uses environment information for the dungeons it is given (or quickly generates such information if using DungeonBoneGen), and uses that information to only place effects like grass or water where you specify, like "only in caves", or "doors should never be in caves". Ensures only connected regions of the map are used by filling unreachable areas with walls, and can find far-apart staircase positions if generate() is used or can keep existing staircases in a map if generateRespectingStairs() is used.
The main technique for using this is simple: Construct a DungeonGenerator, usually with the desired width and height, then call any feature adding methods that you want in the dungeon, like addWater(), addTraps, addGrass(), or addDoors(). All of these methods except addDoors() take an int argument that corresponds to a constant in this class, CAVE, CORRIDOR, or ROOM, or ALL, and they will only cause the requested feature to show up in that environment. Some of these take different parameters, like addDoors() which needs to know if it should check openings that are two cells wide to add a door and a wall to, or whether it should only add doors to single-cell openings. In the case of addDoors(), it doesn't take an environment argument since doors almost always are between environments (rooms and corridors), so placing them only within one or the other doesn't make sense. This class, unlike the normal DungeonGenerator, also has an addLake() method, which, like addDoors(), doesn't take an environment parameter. It can be used to turn a large section of what would otherwise be walls into a lake (of some character for deep lake cells and some character for shallow lake cells), and corridors that cross the lake become bridges, shown as ':'. It should be noted that because the lake fills walls, it doesn't change the connectivity of the map unless you can cross the lake. There's also addMaze(), which does change the connectivity by replacing sections of impassable walls with twisty, maze-like passages.
Once you've added any features to the generator's effects list, call generate() to get a char[][] with the desired dungeon map, using a fixed repertoire of chars to represent the different features, with the exception of the customization that can be requested from addLake(). If you use the libGDX text-based display module, you can change what chars are shown by using addSwap() in TextCellFactory. After calling generate(), you can safely get the values from the stairsUp and stairsDown fields, which are Coords that should be a long distance from each other but connected in the dungeon. You may want to change those to staircase characters, but there's no requirement to do anything with them. It's recommended that you keep the resulting char[][] maps in some collection that can be saved, since SectionDungeonGenerator only stores a temporary copy of the most recently-generated map. The DungeonUtility field of this class, utility, is a convenient way of accessing the non-static methods in that class, such as randomFloor(), without needing to create another DungeonUtility (this class creates one, so you don't have to). Similarly, the Placement field of this class, placement, can be used to find parts of a dungeon that fit certain qualities for the placement of items, terrain features, or NPCs.
Example map with a custom-representation lake: https://gist.github.com/tommyettinger/0055075f9de59c452d25
Author:
Eben Howard - http://squidpony.com - howard@squidpony.com, Tommy Ettinger - https://github.com/tommyettinger
See Also:
this class exposes a DungeonUtility member; DungeonUtility also has many useful static methods, for a slightly simpler alternative that does not recognize different sections of dungeon
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  SectionDungeonGenerator.FillEffect
    The effects that can be applied to this dungeon.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static int ALL
    Constant for features being added to all environment types.
    static int CAVE
    Constant for features being added to all environment types.
    EnumMap<SectionDungeonGenerator.FillEffect,​Integer> caveFX
    The effects that will be applied when generate is called.
    static int CORRIDOR
    Constant for features being added to all environment types.
    EnumMap<SectionDungeonGenerator.FillEffect,​Integer> corridorFX
    The effects that will be applied when generate is called.
    char deepLakeGlyph
    The char to use for deep lake cells.
    int doorFX
    Percentage of viable positions to fill with doors, represented by '+' for east-to-west connections or '/' for north-to-south ones; this number will be negative if filling two-cell wide positions but will be made positive when needed.
    protected char[][] dungeon  
    protected int environmentType  
    RoomFinder finder
    Potentially important if you need to identify specific rooms, corridors, or cave areas in a map.
    protected int height  
    int lakeFX
    The approximate percentage of non-room, non-cave, non-edge-of-map wall cells to try to fill with lake.
    int mazeFX
    The approximate percentage of non-room, non-cave, non-edge-of-map wall cells to try to fill with maze.
    Placement placement
    Configured by this class after you call generate(), this Placement can be used to locate areas of the dungeon that fit certain properties, like "out of sight from a door" or "a large flat section of wall that could be used to place a straight-line object." You can use this as-needed; it does only a small amount of work at the start, and does the calculations for what areas have certain properties on request.
    protected long rebuildSeed  
    StatefulRNG rng  
    static int ROOM
    Constant for features being added to all environment types.
    EnumMap<SectionDungeonGenerator.FillEffect,​Integer> roomFX
    The effects that will be applied when generate is called.
    protected boolean seedFixed  
    char shallowLakeGlyph
    The char to use for shallow lake cells.
    Coord stairsDown  
    Coord stairsUp  
    DungeonUtility utility  
    protected int width  
  • Constructor Summary

    Constructors 
    Constructor Description
    SectionDungeonGenerator()
    Make a SectionDungeonGenerator with a LightRNG using a random seed, height 40, and width 40.
    SectionDungeonGenerator​(int width, int height)
    Make a SectionDungeonGenerator with the given height and width; the RNG used for generating a dungeon and adding features will be a LightRNG using a random seed.
    SectionDungeonGenerator​(int width, int height, IRNG rng)
    Make a SectionDungeonGenerator with the given height, width, and RNG.
    SectionDungeonGenerator​(SectionDungeonGenerator copying)
    Copies all fields from copying and makes a new DungeonGenerator.
  • Method Summary

    Modifier and Type Method Description
    SectionDungeonGenerator addBoulders​(int env, int percentage)
    Turns the given percentage of floor cells not already adjacent to walls into wall cells, represented by '#'.
    SectionDungeonGenerator addDoors​(int percentage, boolean doubleDoors)
    Turns the given percentage of viable doorways into doors, represented by '+' for doors that allow travel along the x-axis and '/' for doors that allow travel along the y-axis.
    SectionDungeonGenerator addGrass​(int env, int percentage)
    Turns the majority of the given percentage of floor cells into grass cells, represented by '"'.
    SectionDungeonGenerator addLake​(int percentage)
    Instructs the generator to add a lake (here, of water) into a large area that can be filled without overwriting rooms, caves, or the edge of the map; wall cells will become the deep lake glyph (here, '~'), unless they are close to an existing room or cave, in which case they become the shallow lake glyph (here, ','), and corridors that are "covered" by a lake will become bridges, the glyph ':'.
    SectionDungeonGenerator addLake​(int percentage, char deepLake, char shallowLake)
    Instructs the generator to add a lake into a large area that can be filled without overwriting rooms, caves, or the edge of the map; wall cells will become the char deepLake, unless they are close to an existing room or cave, in which case they become the char shallowLake, and corridors that are "covered" by a lake will become bridges, the glyph ':'.
    SectionDungeonGenerator addMaze​(int percentage)
    Instructs the generator to add a winding section of corridors into a large area that can be filled without overwriting rooms, caves, or the edge of the map; wall cells will become either '#' or '.' and corridors will be overwritten.
    SectionDungeonGenerator addTraps​(int env, int percentage)
    Turns the given percentage of open area floor cells into trap cells, represented by '^'.
    SectionDungeonGenerator addWater​(int env, int percentage)
    Turns the majority of the given percentage of floor cells into water cells, represented by '~'.
    SectionDungeonGenerator addWater​(int env, int percentage, int islandSpacing)
    Turns the majority of the given percentage of floor cells into water cells, represented by '~'.
    SectionDungeonGenerator clearEffects()
    Removes any door, water, or trap insertion effects that this DungeonGenerator would put in future dungeons.
    char[][] generate()
    Generate a char[][] dungeon using TilesetType.DEFAULT_DUNGEON; this produces a dungeon appropriate for a level of ruins or a partially constructed dungeon.
    char[][] generate​(char[][] baseDungeon, int[][] environment)
    Generate a char[][] dungeon with extra features given a baseDungeon that has already been generated and an environment as an int[][], which can often be obtained from MixedGenerator or classes that use it, like SerpentMapGenerator, with their getEnvironment method.
    char[][] generate​(TilesetType kind)
    Generate a char[][] dungeon given a TilesetType; the comments in that class provide some opinions on what each TilesetType value could be used for in a game.
    char[][] generateRespectingStairs​(char[][] baseDungeon, int[][] environment)
    Generate a char[][] dungeon with extra features given a baseDungeon that has already been generated, with staircases represented by greater than and less than signs, and an environment as an int[][], which can often be obtained from MixedGenerator or classes that use it, like SerpentMapGenerator, with their getEnvironment method.
    char[][] getBareDungeon()
    Get the most recently generated char[][] dungeon out of this class without any chars other than '#' or '.', for walls and floors respectively.
    char[][] getDungeon()
    Get the most recently generated char[][] dungeon out of this class.
    int getHeight()
    Height of the dungeon in cells.
    long getRebuildSeed()
    Gets the seed that can be used to rebuild an identical dungeon to the latest one generated (or the seed that will be used to generate the first dungeon if none has been made yet).
    int getWidth()
    Width of the dungeon in cells.
    protected char[][] innerGenerate()  
    protected char[][] innerGenerate​(char[][] map, EnumMap<SectionDungeonGenerator.FillEffect,​Integer> fx)  
    protected char[][] makeDoors​(ArrayList<char[][]> rooms, ArrayList<char[][]> corridors, char[][] allCaves, char[][] allCorridors)  
    protected char[][][] makeLake​(ArrayList<char[][]> rooms, ArrayList<char[][]> caves)  
    protected OrderedSet<Coord> removeAdjacent​(OrderedSet<Coord> coll, Coord pt)  
    protected OrderedSet<Coord> removeAdjacent​(OrderedSet<Coord> coll, Coord pt1, Coord pt2)  
    protected OrderedSet<Coord> removeNearby​(OrderedSet<Coord> coll, char[][] disallowed)  
    void setDungeon​(char[][] dungeon)
    Change the underlying char[][]; only affects the toString method, and of course getDungeon.
    String toString()
    Provides a string representation of the latest generated dungeon.
    protected OrderedSet<Coord> viableDoorways​(boolean doubleDoors, char[][] map, char[][] allCaves, char[][] allCorridors)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • SectionDungeonGenerator

      Make a SectionDungeonGenerator with a LightRNG using a random seed, height 40, and width 40.
    • SectionDungeonGenerator

      public SectionDungeonGenerator​(int width, int height)
      Make a SectionDungeonGenerator with the given height and width; the RNG used for generating a dungeon and adding features will be a LightRNG using a random seed. If width or height is greater than 256, then this will expand the Coord pool from its 256x256 default so it stores a reference to each Coord that might be used in the creation of the dungeon (if width and height are 300 and 300, the Coord pool will be 300x300; if width and height are 500 and 100, the Coord pool will be 500x256 because it won't shrink below the default size of 256x256).
      Parameters:
      width - The width of the dungeon in cells
      height - The height of the dungeon in cells
    • SectionDungeonGenerator

      public SectionDungeonGenerator​(int width, int height, IRNG rng)
      Make a SectionDungeonGenerator with the given height, width, and RNG. Use this if you want to seed the RNG. If width or height is greater than 256, then this will expand the Coord pool from its 256x256 default so it stores a reference to each Coord that might be used in the creation of the dungeon (if width and height are 300 and 300, the Coord pool will be 300x300; if width and height are 500 and 100, the Coord pool will be 500x256 because it won't shrink below the default size of 256x256).
      Parameters:
      width - The width of the dungeon in cells
      height - The height of the dungeon in cells
      rng - The RNG to use for all purposes in this class; if it is a StatefulRNG, then it will be used as-is, but if it is not a StatefulRNG, a new StatefulRNG will be used, randomly seeded by this parameter
    • SectionDungeonGenerator

      Copies all fields from copying and makes a new DungeonGenerator.
      Parameters:
      copying - the DungeonGenerator to copy
  • Method Details

    • getDungeon

      public char[][] getDungeon()
      Get the most recently generated char[][] dungeon out of this class. The dungeon may be null if generate() or setDungeon() have not been called.
      Specified by:
      getDungeon in interface IDungeonGenerator
      Returns:
      a char[][] dungeon, or null.
    • getBareDungeon

      public char[][] getBareDungeon()
      Get the most recently generated char[][] dungeon out of this class without any chars other than '#' or '.', for walls and floors respectively. The dungeon may be null if generate() or setDungeon() have not been called.
      Returns:
      a char[][] dungeon with only '#' for walls and '.' for floors, or null.
    • setDungeon

      public void setDungeon​(char[][] dungeon)
      Change the underlying char[][]; only affects the toString method, and of course getDungeon.
      Parameters:
      dungeon - a char[][], probably produced by an earlier call to this class and then modified.
    • getHeight

      public int getHeight()
      Height of the dungeon in cells.
      Returns:
      Height of the dungeon in cells.
    • getWidth

      public int getWidth()
      Width of the dungeon in cells.
      Returns:
      Width of the dungeon in cells.
    • addWater

      public SectionDungeonGenerator addWater​(int env, int percentage)
      Turns the majority of the given percentage of floor cells into water cells, represented by '~'. Water will be clustered into a random number of pools, with more appearing if needed to fill the percentage. Each pool will have randomized volume that should fill or get very close to filling the requested percentage, unless the pools encounter too much tight space. If this DungeonGenerator previously had addWater called, the latest call will take precedence. No islands will be placed with this variant, but the edge of the water will be shallow, represented by ','.
      Parameters:
      env - the environment to apply this to; uses MixedGenerator's constants, or 0 for "all environments"
      percentage - the percentage of floor cells to fill with water
      Returns:
      this DungeonGenerator; can be chained
    • addWater

      public SectionDungeonGenerator addWater​(int env, int percentage, int islandSpacing)
      Turns the majority of the given percentage of floor cells into water cells, represented by '~'. Water will be clustered into a random number of pools, with more appearing if needed to fill the percentage. Each pool will have randomized volume that should fill or get very close to filling the requested percentage, unless the pools encounter too much tight space. If this DungeonGenerator previously had addWater called, the latest call will take precedence. If islandSpacing is greater than 1, then this will place islands of floor, '.', surrounded by shallow water, ',', at about the specified distance with Euclidean measurement.
      Parameters:
      env - the environment to apply this to; uses MixedGenerator's constants, or 0 for "all environments"
      percentage - the percentage of floor cells to fill with water
      islandSpacing - if greater than 1, islands will be placed randomly this many cells apart.
      Returns:
      this DungeonGenerator; can be chained
    • addGrass

      public SectionDungeonGenerator addGrass​(int env, int percentage)
      Turns the majority of the given percentage of floor cells into grass cells, represented by '"'. Grass will be clustered into a random number of patches, with more appearing if needed to fill the percentage. Each area will have randomized volume that should fill or get very close to filling (two thirds of) the requested percentage, unless the patches encounter too much tight space. If this DungeonGenerator previously had addGrass called, the latest call will take precedence.
      Parameters:
      env - the environment to apply this to; uses MixedGenerator's constants, or 0 for "all environments"
      percentage - the percentage of floor cells to fill with grass; this can vary quite a lot. It may be difficult to fill very high (over 66%) percentages of map with grass, though you can do this by giving a percentage of between 100 and 150.
      Returns:
      this DungeonGenerator; can be chained
    • addBoulders

      public SectionDungeonGenerator addBoulders​(int env, int percentage)
      Turns the given percentage of floor cells not already adjacent to walls into wall cells, represented by '#'. If this DungeonGenerator previously had addBoulders called, the latest call will take precedence.
      Parameters:
      env - the environment to apply this to; uses MixedGenerator's constants, or 0 for "all environments"
      percentage - the percentage of floor cells not adjacent to walls to fill with boulders.
      Returns:
      this DungeonGenerator; can be chained
    • addDoors

      public SectionDungeonGenerator addDoors​(int percentage, boolean doubleDoors)
      Turns the given percentage of viable doorways into doors, represented by '+' for doors that allow travel along the x-axis and '/' for doors that allow travel along the y-axis. If doubleDoors is true, 2-cell-wide openings will be considered viable doorways and will fill one cell with a wall, the other a door. If this DungeonGenerator previously had addDoors called, the latest call will take precedence.
      Parameters:
      percentage - the percentage of valid openings to corridors to fill with doors; should be between 10 and 20 if you want doors to appear more than a few times, but not fill every possible opening.
      doubleDoors - true if you want two-cell-wide openings to receive a door and a wall; false if only one-cell-wide openings should receive doors. Usually, this should be true.
      Returns:
      this DungeonGenerator; can be chained
    • addMaze

      public SectionDungeonGenerator addMaze​(int percentage)
      Instructs the generator to add a winding section of corridors into a large area that can be filled without overwriting rooms, caves, or the edge of the map; wall cells will become either '#' or '.' and corridors will be overwritten. If the percentage is too high (40% is probably too high to adequately fill), this will fill less than the requested percentage rather than fill multiple mazes.
      Parameters:
      percentage - The percentage of non-room, non-cave, non-edge-of-map wall cells to try to fill with maze.
      Returns:
      this for chaining
    • addLake

      public SectionDungeonGenerator addLake​(int percentage)
      Instructs the generator to add a lake (here, of water) into a large area that can be filled without overwriting rooms, caves, or the edge of the map; wall cells will become the deep lake glyph (here, '~'), unless they are close to an existing room or cave, in which case they become the shallow lake glyph (here, ','), and corridors that are "covered" by a lake will become bridges, the glyph ':'. If the percentage is too high (40% is probably too high to adequately fill), this will fill less than the requested percentage rather than fill multiple lakes.
      Parameters:
      percentage - The percentage of non-room, non-cave, non-edge-of-map wall cells to try to fill with lake.
      Returns:
      this for chaining
    • addLake

      public SectionDungeonGenerator addLake​(int percentage, char deepLake, char shallowLake)
      Instructs the generator to add a lake into a large area that can be filled without overwriting rooms, caves, or the edge of the map; wall cells will become the char deepLake, unless they are close to an existing room or cave, in which case they become the char shallowLake, and corridors that are "covered" by a lake will become bridges, the glyph ':'. If the percentage is too high (40% is probably too high to adequately fill), this will fill less than the requested percentage rather than fill multiple lakes.
      Parameters:
      percentage - The percentage of non-room, non-cave, non-edge-of-map wall cells to try to fill with lake.
      deepLake - the char to use for deep lake cells, such as '~'
      shallowLake - the char to use for shallow lake cells, such as ','
      Returns:
      this for chaining
    • addTraps

      public SectionDungeonGenerator addTraps​(int env, int percentage)
      Turns the given percentage of open area floor cells into trap cells, represented by '^'. Corridors that have no possible way to move around a trap will not receive traps, ever. If this DungeonGenerator previously had addTraps called, the latest call will take precedence.
      Parameters:
      env - the environment to apply this to; uses MixedGenerator's constants, or 0 for "all environments"
      percentage - the percentage of valid cells to fill with traps; should be no higher than 5 unless the dungeon floor is meant to be a kill screen or minefield.
      Returns:
      this DungeonGenerator; can be chained
    • clearEffects

      Removes any door, water, or trap insertion effects that this DungeonGenerator would put in future dungeons.
      Returns:
      this DungeonGenerator, with all effects removed. Can be chained.
    • removeAdjacent

      protected OrderedSet<Coord> removeAdjacent​(OrderedSet<Coord> coll, Coord pt)
    • removeAdjacent

      protected OrderedSet<Coord> removeAdjacent​(OrderedSet<Coord> coll, Coord pt1, Coord pt2)
    • removeNearby

      protected OrderedSet<Coord> removeNearby​(OrderedSet<Coord> coll, char[][] disallowed)
    • viableDoorways

      protected OrderedSet<Coord> viableDoorways​(boolean doubleDoors, char[][] map, char[][] allCaves, char[][] allCorridors)
    • generate

      public char[][] generate()
      Generate a char[][] dungeon using TilesetType.DEFAULT_DUNGEON; this produces a dungeon appropriate for a level of ruins or a partially constructed dungeon. This uses '#' for walls, '.' for floors, '~' for deep water, ',' for shallow water, '^' for traps, '+' for doors that provide horizontal passage, and '/' for doors that provide vertical passage. Use the addDoors, addWater, addGrass, and addTraps methods of this class to request these in the generated map. Also sets the fields stairsUp and stairsDown to two randomly chosen, distant, connected, walkable cells.
      Specified by:
      generate in interface IDungeonGenerator
      Returns:
      a char[][] dungeon
    • generate

      public char[][] generate​(TilesetType kind)
      Generate a char[][] dungeon given a TilesetType; the comments in that class provide some opinions on what each TilesetType value could be used for in a game. This uses '#' for walls, '.' for floors, '~' for deep water, ',' for shallow water, '^' for traps, '+' for doors that provide horizontal passage, and '/' for doors that provide vertical passage. Use the addDoors, addWater, addGrass, and addTraps methods of this class to request these in the generated map. Also sets the fields stairsUp and stairsDown to two randomly chosen, distant, connected, walkable cells.
      Parameters:
      kind - a TilesetType enum value, such as TilesetType.DEFAULT_DUNGEON
      Returns:
      a char[][] dungeon
      See Also:
      TilesetType
    • generate

      public char[][] generate​(char[][] baseDungeon, int[][] environment)
      Generate a char[][] dungeon with extra features given a baseDungeon that has already been generated and an environment as an int[][], which can often be obtained from MixedGenerator or classes that use it, like SerpentMapGenerator, with their getEnvironment method. Typically, you want to call generate with a TilesetType or no argument for the easiest generation; this method is meant for adding features like water and doors to existing maps while avoiding placing incongruous features in areas where they don't fit, like a door in a cave or moss in a room. This uses '#' for walls, '.' for floors, '~' for deep water, ',' for shallow water, '^' for traps, '+' for doors that provide horizontal passage, and '/' for doors that provide vertical passage. Use the addDoors, addWater, addGrass, and addTraps methods of this class to request these in the generated map. Also sets the fields stairsUp and stairsDown to two randomly chosen, distant, connected, walkable cells.
      Special behavior here: If tab characters are present in the 2D char array, they will be replaced with '.' in the final dungeon, but will also be tried first as valid staircase locations (with a high distance possible to travel away from the starting staircase). If no tab characters are present this will search for '.' floors to place stairs on, as normal. This tab-first behavior is useful in conjunction with some methods that establish a good path in an existing dungeon; an example is DungeonUtility.ensurePath(dungeon, rng, '\t', '#'); then passing dungeon (which that code modifies) in as baseDungeon to this method. Because tabs will always be replaced by floors ('.'), this considers any tabs that overlap with what the environment considers a wall (cave wall, room wall, corridor wall, or untouched) to really refer to a corridor floor, but doesn't reconsider tabs that overlap with floors already (it keeps the state of actual room, cave, and corridor floors). This is useful so you only have to call ensurePath or a similar method on the 2D char array and can leave the 2D int array alone.
      Parameters:
      baseDungeon - a pre-made dungeon consisting of '#' for walls and '.' for floors; may be modified in-place
      environment - stores whether a cell is room, corridor, or cave; getEnvironment() typically gives this
      Returns:
      a char[][] dungeon
    • generateRespectingStairs

      public char[][] generateRespectingStairs​(char[][] baseDungeon, int[][] environment)
      Generate a char[][] dungeon with extra features given a baseDungeon that has already been generated, with staircases represented by greater than and less than signs, and an environment as an int[][], which can often be obtained from MixedGenerator or classes that use it, like SerpentMapGenerator, with their getEnvironment method. Typically, you want to call generate with a TilesetType or no argument for the easiest generation; this method is meant for adding features like water and doors to existing maps while avoiding placing incongruous features in areas where they don't fit, like a door in a cave or moss in a room. This uses '#' for walls, '.' for floors, '~' for deep water, ',' for shallow water, '^' for traps, '+' for doors that provide horizontal passage, and '/' for doors that provide vertical passage. Use the addDoors, addWater, addGrass, and addTraps methods of this class to request these in the generated map. Also sets the fields stairsUp and stairsDown to null, and expects stairs to be already handled.
      Parameters:
      baseDungeon - a pre-made dungeon consisting of '#' for walls and '.' for floors, with stairs already in; may be modified in-place
      environment - stores whether a cell is room, corridor, or cave; getEnvironment() typically gives this
      Returns:
      a char[][] dungeon
    • innerGenerate

      protected char[][] innerGenerate()
    • makeDoors

      protected char[][] makeDoors​(ArrayList<char[][]> rooms, ArrayList<char[][]> corridors, char[][] allCaves, char[][] allCorridors)
    • makeLake

      protected char[][][] makeLake​(ArrayList<char[][]> rooms, ArrayList<char[][]> caves)
    • innerGenerate

      protected char[][] innerGenerate​(char[][] map, EnumMap<SectionDungeonGenerator.FillEffect,​Integer> fx)
    • getRebuildSeed

      public long getRebuildSeed()
      Gets the seed that can be used to rebuild an identical dungeon to the latest one generated (or the seed that will be used to generate the first dungeon if none has been made yet). You can pass the long this returns to the setState() method on this class' rng field, which assuming all other calls to generate a dungeon are identical, will ensure generate() or generateRespectingStairs() will produce the same dungeon output as the dungeon originally generated with the seed this returned.
      You can also call getState() on the rng field yourself immediately before generating a dungeon, but this method handles some complexities of when the state is actually used to generate a dungeon; since StatefulRNG objects can be shared between different classes that use random numbers, the state could change between when you call getState() and when this class generates a dungeon. Using getRebuildSeed() eliminates that confusion.
      Returns:
      a seed as a long that can be passed to setState() on this class' rng field to recreate a dungeon
    • toString

      public String toString()
      Provides a string representation of the latest generated dungeon.
      Overrides:
      toString in class Object
      Returns:
      a printable string version of the latest generated dungeon.