Package squidpony.squidgrid.mapping
Class ThinDungeonGenerator
java.lang.Object
squidpony.squidgrid.mapping.SectionDungeonGenerator
squidpony.squidgrid.mapping.ThinDungeonGenerator
- All Implemented Interfaces:
IDungeonGenerator
public class ThinDungeonGenerator extends SectionDungeonGenerator
Created by Tommy Ettinger on 8/7/2016.
-
Nested Class Summary
Nested classes/interfaces inherited from class squidpony.squidgrid.mapping.SectionDungeonGenerator
SectionDungeonGenerator.FillEffect
-
Field Summary
Fields Modifier and Type Field Description static int
CAVE_WALL_CHAOTIC
static int
CAVE_WALL_EXPAND
static int
CAVE_WALL_NORMAL
static int
CAVE_WALL_RETRACT
static int
CORRIDOR_WALL_CHAOTIC
static int
CORRIDOR_WALL_EXPAND
static int
CORRIDOR_WALL_NORMAL
static int
CORRIDOR_WALL_RETRACT
static int
ROOM_WALL_CHAOTIC
static int
ROOM_WALL_EXPAND
static int
ROOM_WALL_NORMAL
static int
ROOM_WALL_RETRACT
int
wallShapes
Fields inherited from class squidpony.squidgrid.mapping.SectionDungeonGenerator
ALL, CAVE, caveFX, CORRIDOR, corridorFX, deepLakeGlyph, doorFX, dungeon, environmentType, finder, height, lakeFX, mazeFX, placement, rebuildSeed, rng, ROOM, roomFX, seedFixed, shallowLakeGlyph, stairsDown, stairsUp, utility, width
-
Constructor Summary
Constructors Constructor Description ThinDungeonGenerator()
Make a DungeonGenerator with a LightRNG using a random seed, height 40, and width 40.ThinDungeonGenerator(int width, int height)
Make a DungeonGenerator with the given height and width; the RNG used for generating a dungeon and adding features will be a LightRNG using a random seed.ThinDungeonGenerator(int width, int height, int roomShape, int corridorShape, int caveShape)
Make a DungeonGenerator with the given height and width; the RNG used for generating a dungeon and adding features will be a LightRNG using a random seed.ThinDungeonGenerator(int width, int height, IRNG rng)
Make a DungeonGenerator with the given height, width, and RNG.ThinDungeonGenerator(int width, int height, IRNG rng, int roomShape, int corridorShape, int caveShape)
Make a DungeonGenerator with the given height, width, and RNG for generating random features.ThinDungeonGenerator(ThinDungeonGenerator copying)
Copies all fields from copying and makes a new DungeonGenerator. -
Method Summary
Modifier and Type Method Description SectionDungeonGenerator
addDoors(int percentage, boolean doubleDoors)
Doors are not supported by this class.protected char[][]
innerGenerate()
char[][]
makeThin()
void
removeHardCorners()
Modifies this ThinDungeonGenerator to remove corners between thin walls (truncating the corners, effectively).String
toString()
Provides a string representation of the latest generated dungeon.Methods inherited from class squidpony.squidgrid.mapping.SectionDungeonGenerator
addBoulders, addGrass, addLake, addLake, addMaze, addTraps, addWater, addWater, clearEffects, generate, generate, generate, generateRespectingStairs, getBareDungeon, getDungeon, getHeight, getRebuildSeed, getWidth, innerGenerate, makeDoors, makeLake, removeAdjacent, removeAdjacent, removeNearby, setDungeon, viableDoorways
-
Field Details
-
ROOM_WALL_RETRACT
- See Also:
- Constant Field Values
-
ROOM_WALL_NORMAL
- See Also:
- Constant Field Values
-
ROOM_WALL_EXPAND
- See Also:
- Constant Field Values
-
ROOM_WALL_CHAOTIC
- See Also:
- Constant Field Values
-
CORRIDOR_WALL_RETRACT
- See Also:
- Constant Field Values
-
CORRIDOR_WALL_NORMAL
- See Also:
- Constant Field Values
-
CORRIDOR_WALL_EXPAND
- See Also:
- Constant Field Values
-
CORRIDOR_WALL_CHAOTIC
- See Also:
- Constant Field Values
-
CAVE_WALL_RETRACT
- See Also:
- Constant Field Values
-
CAVE_WALL_NORMAL
- See Also:
- Constant Field Values
-
CAVE_WALL_EXPAND
- See Also:
- Constant Field Values
-
CAVE_WALL_CHAOTIC
- See Also:
- Constant Field Values
-
wallShapes
-
-
Constructor Details
-
ThinDungeonGenerator
public ThinDungeonGenerator()Make a DungeonGenerator with a LightRNG using a random seed, height 40, and width 40. -
ThinDungeonGenerator
Make a DungeonGenerator with the given height and width; the RNG used for generating a dungeon and adding features will be a LightRNG using a random seed.- Parameters:
width
- The width of the dungeon in cellsheight
- The height of the dungeon in cells
-
ThinDungeonGenerator
Make a DungeonGenerator with the given height, width, and RNG. Use this if you want to seed the RNG.- Parameters:
width
- The width of the dungeon in cellsheight
- The height of the dungeon in cellsrng
- The RNG to use for all purposes in this class; if it is a StatefulRNG, then it will be used as-is,
-
ThinDungeonGenerator
public ThinDungeonGenerator(int width, int height, int roomShape, int corridorShape, int caveShape)Make a DungeonGenerator with the given height and width; the RNG used for generating a dungeon and adding features will be a LightRNG using a random seed. You can give the static fields of this class as arguments to roomShape, corridorShape and caveShape. For clarity, the 3 fields should each be given a constant corresponding to the same kind of area, e.g. ROOM_WALL_EXPAND or ROOM_WALL_RETRACT could be given to roomShape but preferably would not be given to the others. If the combination of arguments is invalid, such as if they are all 0, this uses the default shapes: expanded room and corridor walls, and chaotic cave walls controlled bySeededNoise
.
Though there's no constructor that takes a single int which merges roomShape, corridorShape, and caveShape, the internal representation of those shapes is one int. If you have one of those ints, or you made one yourself (such as with bitwise OR on three different constants), you can pass it to any of the three shape arguments and 0 to the other two shapes; it will be processed in the same way.- Parameters:
width
- The width of the dungeon in cellsheight
- The height of the dungeon in cellsroomShape
- expected to be an int constant: ROOM_WALL_EXPAND, ROOM_WALL_RETRACT, or ROOM_WALL_CHAOTICcorridorShape
- expected to be an int constant: CORRIDOR_WALL_EXPAND, CORRIDOR_WALL_RETRACT, or CORRIDOR_WALL_CHAOTICcaveShape
- expected to be an int constant: CAVE_WALL_EXPAND, CAVE_WALL_RETRACT, or CAVE_WALL_CHAOTIC
-
ThinDungeonGenerator
public ThinDungeonGenerator(int width, int height, IRNG rng, int roomShape, int corridorShape, int caveShape)Make a DungeonGenerator with the given height, width, and RNG for generating random features. You can give the static fields of this class as arguments to roomShape, corridorShape and caveShape. For clarity, the 3 fields should each be given a constant corresponding to the same kind of area, e.g. ROOM_WALL_EXPAND or ROOM_WALL_RETRACT could be given to roomShape but preferably would not be given to the others. If the combination of arguments is invalid, such as if they are all 0, this uses the default shapes: expanded room and corridor walls, and chaotic cave walls controlled bySeededNoise
.
Though there's no constructor that takes a single int which merges roomShape, corridorShape, and caveShape, the internal representation of those shapes is one int. If you have one of those ints, or you made one yourself (such as with bitwise OR on three different constants), you can pass it to any of the three shape arguments and 0 to the other two shapes; it will be processed in the same way.- Parameters:
width
- The width of the dungeon in cellsheight
- The height of the dungeon in cellsroomShape
- expected to be an int constant: ROOM_WALL_EXPAND, ROOM_WALL_RETRACT, or ROOM_WALL_CHAOTICcorridorShape
- expected to be an int constant: CORRIDOR_WALL_EXPAND, CORRIDOR_WALL_RETRACT, or CORRIDOR_WALL_CHAOTICcaveShape
- expected to be an int constant: CAVE_WALL_EXPAND, CAVE_WALL_RETRACT, or CAVE_WALL_CHAOTICrng
- The RNG to use for all purposes in this class; if it is a StatefulRNG, then it will be used as-is,
-
ThinDungeonGenerator
Copies all fields from copying and makes a new DungeonGenerator.- Parameters:
copying
- the DungeonGenerator to copy
-
-
Method Details
-
addDoors
Doors are not supported by this class. There's a lot of confusing and ambiguous situations that can easily result from trying to automatically place doors when any given map could need doors on walkable cells, prefer doors between walkable cells aligned to walls, have mixes of "expanded", "retracted", and "normal" wall change modes, or any number of other issues. There are also some very confusing cases where automatically-placed doors, if this class tries to reposition them in retracted-wall mode (or in any case where rooms and corridors don't have the same change mode), wind up hanging in the middle of a room or with partial connecting walls but not any sensible layout. If you want doors here, you should assign them yourself how you see fit.- Overrides:
addDoors
in classSectionDungeonGenerator
- Parameters:
percentage
- ignored.doubleDoors
- ignored.- Returns:
- this for chaining.
-
makeThin
-
innerGenerate
- Overrides:
innerGenerate
in classSectionDungeonGenerator
-
removeHardCorners
Modifies this ThinDungeonGenerator to remove corners between thin walls (truncating the corners, effectively). Regenerates the RoomFinder and Placement objects this uses. -
toString
Provides a string representation of the latest generated dungeon. Because the spaces between occupy-able cells, when walkable, use the control character U+0006 to indicate that they're not meant to be displayed, this replaces any instances of that character in the printable output with ordinary space characters, while keeping the internal representation as the control character.- Overrides:
toString
in classSectionDungeonGenerator
- Returns:
- a printable string version of the latest generated dungeon.
-