Package squidpony.squidgrid.mapping
Class SymmetryDungeonGenerator
java.lang.Object
squidpony.squidgrid.mapping.MixedGenerator
squidpony.squidgrid.mapping.SymmetryDungeonGenerator
- All Implemented Interfaces:
IDungeonGenerator
public class SymmetryDungeonGenerator extends MixedGenerator
A variant on
MixedGenerator
that creates bi-radially symmetric maps (basically a yin-yang shape). Useful for
strategy games and possibly competitive multi-player games. The Coords passed to constructors as room positions do
not necessarily need to be
Created by Tommy Ettinger on 11/20/2015.-
Field Summary
Fields inherited from class squidpony.squidgrid.mapping.MixedGenerator
BOX, BOX_WALLED, carvers, carverTable, CAVE, CAVE_FLOOR, CAVE_WALL, CORRIDOR_FLOOR, CORRIDOR_WALL, dungeon, environment, fixedRooms, generated, height, marked, points, rng, ROOM_FLOOR, ROOM_WALL, roomHeight, roomWidth, ROUND, ROUND_WALLED, totalPoints, UNTOUCHED, walled, width
-
Constructor Summary
Constructors Constructor Description SymmetryDungeonGenerator(int width, int height, IRNG rng)
This prepares a map generator that will generate a map with the given width and height, using the given RNG.SymmetryDungeonGenerator(int width, int height, IRNG rng, List<Coord> sequence)
This prepares a map generator that will generate a map with the given width and height, using the given RNG.SymmetryDungeonGenerator(int width, int height, IRNG rng, OrderedMap<Coord,List<Coord>> connections)
This prepares a map generator that will generate a map with the given width and height, using the given RNG.SymmetryDungeonGenerator(int width, int height, IRNG rng, OrderedMap<Coord,List<Coord>> connections, float roomSizeMultiplier)
This prepares a map generator that will generate a map with the given width and height, using the given RNG.SymmetryDungeonGenerator(int width, int height, IRNG rng, OrderedSet<Coord> sequence)
This prepares a map generator that will generate a map with the given width and height, using the given RNG. -
Method Summary
Modifier and Type Method Description protected static OrderedMap<Coord,List<Coord>>
crossConnect(int width, int height, Map<Coord,List<Coord>> connections)
protected static OrderedMap<Coord,List<Coord>>
listToMap(List<Coord> sequence)
protected boolean
mark(int x, int y)
Internal use.protected void
markEnvironment(int x, int y, int kind)
Internal use.protected void
markPiercing(int x, int y)
Internal use.static OrderedMap<Coord,List<Coord>>
removeSomeOverlap(int width, int height, Collection<Coord> sequence)
static OrderedMap<Coord,List<Coord>>
removeSomeOverlap(int width, int height, Map<Coord,List<Coord>> connections)
protected static OrderedMap<Coord,List<Coord>>
setToMap(OrderedSet<Coord> sequence)
protected void
wallOff(int x, int y)
Internal use.Methods inherited from class squidpony.squidgrid.mapping.MixedGenerator
basicPoints, cleanPoints, generate, getDungeon, getEnvironment, getFixedRooms, hasGenerated, mark, markEnvironmentCave, markEnvironmentCorridor, markEnvironmentRoom, markEnvironmentWalls, markPiercing, markPiercingCave, markPiercingRoom, putBoxRoomCarvers, putCaveCarvers, putRoundRoomCarvers, putWalledBoxRoomCarvers, putWalledRoundRoomCarvers, setFixedRooms, store
-
Constructor Details
-
SymmetryDungeonGenerator
This prepares a map generator that will generate a map with the given width and height, using the given RNG. This version of the constructor uses Poisson Disk sampling to generate the points it will draw caves and corridors between, ensuring a minimum distance between points, but it does not ensure that paths between points will avoid overlapping with rooms or other paths. You call the different carver-adding methods to affect what the dungeon will look like, putCaveCarvers(), putBoxRoomCarvers(), and putRoundRoomCarvers(), defaulting to only caves if none are called. You call generate() after adding carvers, which returns a char[][] for a map.- Parameters:
width
- the width of the final map in cellsheight
- the height of the final map in cellsrng
- an RNG object to use for random choices; this make a lot of random choices.- See Also:
used to ensure spacing for the points.
-
SymmetryDungeonGenerator
This prepares a map generator that will generate a map with the given width and height, using the given RNG. This version of the constructor uses a List of Coord points from some other source to determine the path to add rooms or caves to and then connect. You call the different carver-adding methods to affect what the dungeon will look like, putCaveCarvers(), putBoxRoomCarvers(), and putRoundRoomCarvers(), defaulting to only caves if none are called. You call generate() after adding carvers, which returns a char[][] for a map.- Parameters:
width
- the width of the final map in cellsheight
- the height of the final map in cellsrng
- an IRNG, such as an RNG, to use for random choices; this make a lot of random choices.sequence
- a List of Coord to connect in order; index 0 is the start, index size() - 1 is the end.- See Also:
a class that uses this technique
-
SymmetryDungeonGenerator
This prepares a map generator that will generate a map with the given width and height, using the given RNG. This version of the constructor uses a List of Coord points from some other source to determine the path to add rooms or caves to and then connect. You call the different carver-adding methods to affect what the dungeon will look like, putCaveCarvers(), putBoxRoomCarvers(), and putRoundRoomCarvers(), defaulting to only caves if none are called. You call generate() after adding carvers, which returns a char[][] for a map.- Parameters:
width
- the width of the final map in cellsheight
- the height of the final map in cellsrng
- an IRNG, such as an RNG, to use for random choices; this make a lot of random choices.sequence
- a List of Coord to connect in order; index 0 is the start, index size() - 1 is the end.- See Also:
a class that uses this technique
-
SymmetryDungeonGenerator
public SymmetryDungeonGenerator(int width, int height, IRNG rng, OrderedMap<Coord,List<Coord>> connections)This prepares a map generator that will generate a map with the given width and height, using the given RNG. This version of the constructor uses a LinkedHashMap with Coord keys and Coord array values to determine a branching path for the dungeon to take; each key will connect once to each of the Coords in its value, and you usually don't want to connect in both directions. You call the different carver-adding methods to affect what the dungeon will look like, putCaveCarvers(), putBoxRoomCarvers(), and putRoundRoomCarvers(), defaulting to only caves if none are called. You call generate() after adding carvers, which returns a char[][] for a map.- Parameters:
width
- the width of the final map in cellsheight
- the height of the final map in cellsrng
- an RNG object to use for random choices; this make a lot of random choices.connections
- a Map of Coord keys to arrays of Coord to connect to next; shouldn't connect both ways- See Also:
a class that uses this technique
-
SymmetryDungeonGenerator
public SymmetryDungeonGenerator(int width, int height, IRNG rng, OrderedMap<Coord,List<Coord>> connections, float roomSizeMultiplier)This prepares a map generator that will generate a map with the given width and height, using the given RNG. This version of the constructor uses a LinkedHashMap with Coord keys and Coord array values to determine a branching path for the dungeon to take; each key will connect once to each of the Coords in its value, and you usually don't want to connect in both directions. You call the different carver-adding methods to affect what the dungeon will look like, putCaveCarvers(), putBoxRoomCarvers(), and putRoundRoomCarvers(), defaulting to only caves if none are called. You call generate() after adding carvers, which returns a char[][] for a map.- Parameters:
width
- the width of the final map in cellsheight
- the height of the final map in cellsrng
- an RNG object to use for random choices; this make a lot of random choices.connections
- a Map of Coord keys to arrays of Coord to connect to next; shouldn't connect both waysroomSizeMultiplier
- a float multiplier that will be applied to each room's width and height- See Also:
a class that uses this technique
-
-
Method Details
-
removeSomeOverlap
public static OrderedMap<Coord,List<Coord>> removeSomeOverlap(int width, int height, Collection<Coord> sequence) -
removeSomeOverlap
public static OrderedMap<Coord,List<Coord>> removeSomeOverlap(int width, int height, Map<Coord,List<Coord>> connections) -
listToMap
-
setToMap
-
crossConnect
protected static OrderedMap<Coord,List<Coord>> crossConnect(int width, int height, Map<Coord,List<Coord>> connections) -
mark
Internal use. Marks a point to be made into floor.- Overrides:
mark
in classMixedGenerator
- Parameters:
x
- x position to marky
- y position to mark- Returns:
- false if everything is normal, true if and only if this failed to mark because the position is walled
-
markPiercing
Internal use. Marks a point to be made into floor.- Overrides:
markPiercing
in classMixedGenerator
- Parameters:
x
- x position to marky
- y position to mark
-
wallOff
Internal use. Marks a point to be made into floor.- Overrides:
wallOff
in classMixedGenerator
- Parameters:
x
- x position to marky
- y position to mark
-
markEnvironment
Internal use. Marks a point's environment type as the appropriate kind of environment.- Overrides:
markEnvironment
in classMixedGenerator
- Parameters:
x
- x position to marky
- y position to markkind
- an int that should be one of the constants in MixedGenerator for environment types.
-