@Beta public class ModularMapGenerator extends java.lang.Object implements IDungeonGenerator
MapModule
and ModularMapGenerator need improvement to be actually usable,
but it might be a while before there's a clear pathway towards how they can be improved.
Modifier and Type | Field and Description |
---|---|
OrderedMap<Coord,MapModule> |
displacement |
protected int[][] |
environment |
protected int |
height |
RegionMap<MapModule> |
layout |
protected char[][] |
map |
OrderedMap<java.lang.Integer,java.util.ArrayList<MapModule>> |
modules |
protected long |
rebuildSeed |
IStatefulRNG |
rng |
DungeonUtility |
utility |
protected int |
width |
Constructor and Description |
---|
ModularMapGenerator()
Make a ModularMapGenerator with a GWTRNG using a random seed, height 30, and width 60.
|
ModularMapGenerator(int width,
int height)
Make a ModularMapGenerator with the given height and width; the RNG used for generating a dungeon and
adding features will be a GWTRNG using a random seed.
|
ModularMapGenerator(int width,
int height,
IRNG rng)
Make a ModularMapGenerator with the given height, width, and RNG.
|
ModularMapGenerator(ModularMapGenerator copying)
Copies all fields from copying and makes a new DungeonGenerator.
|
Modifier and Type | Method and Description |
---|---|
char[][] |
generate()
Generates a dungeon or other map as a 2D char array.
|
char[][] |
getBareMap()
Get the most recently generated char[][] map out of this class without any chars other than '#' or '.', for
walls and floors respectively.
|
char[][] |
getDungeon()
Get the most recently generated char[][] map out of this class.
|
int[][] |
getEnvironment()
Gets the environment int 2D array for use with classes like RoomFinder.
|
int |
getHeight()
Height of the map in cells.
|
char[][] |
getMap()
Get the most recently generated char[][] map out of this class.
|
int |
getWidth()
Width of the map in cells.
|
void |
setEnvironment(int[][] environment)
Sets the environment int 2D array.
|
void |
setMap(char[][] map)
Change the underlying char[][]; only affects the toString method, and of course getMap
|
public DungeonUtility utility
protected int height
protected int width
public IStatefulRNG rng
protected long rebuildSeed
protected char[][] map
protected int[][] environment
public OrderedMap<java.lang.Integer,java.util.ArrayList<MapModule>> modules
public OrderedMap<Coord,MapModule> displacement
public ModularMapGenerator()
public ModularMapGenerator(int width, int height)
width
- The width of the dungeon in cellsheight
- The height of the dungeon in cellspublic ModularMapGenerator(int width, int height, IRNG rng)
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 any kind of IStatefulRNG, then it will be
used as-is; otherwise, a new GWTRNG will be used, randomly seeded by this parameterpublic ModularMapGenerator(ModularMapGenerator copying)
copying
- the DungeonGenerator to copypublic char[][] getMap()
public char[][] getDungeon()
getDungeon
in interface IDungeonGenerator
public char[][] getBareMap()
public char[][] generate()
IDungeonGenerator
generate
in interface IDungeonGenerator
public void setMap(char[][] map)
map
- a char[][], probably produced by an earlier call to this class and then modified.public int getHeight()
public int getWidth()
public int[][] getEnvironment()
public void setEnvironment(int[][] environment)
environment
- a 2D array of int, where each int corresponds to a constant in MixedGenerator.Copyright © Eben Howard 2012–2022. All rights reserved.