Package squidpony.squidgrid.mapping
Class DenseRoomMapGenerator
java.lang.Object
squidpony.squidgrid.mapping.DenseRoomMapGenerator
- All Implemented Interfaces:
IDungeonGenerator
public class DenseRoomMapGenerator extends Object implements IDungeonGenerator
Map generator that constructs a large number of overlapping rectangular rooms.
Meant for the kind of crowded architecture that might fit the dungeon equivalent of urban areas.
Likely to have many dead-end sections with only one door-like area, similar to hotel rooms or closets depending on
size, and the distance required to reach a particular room may be... cruel and/or unusual. Whole winding areas of a
large map may only be accessible from outside by one door, for instance.
An example of what this outputs: https://gist.github.com/tommyettinger/3144b56a3a8e5bbe5ee401c1a93989f4 Created by Tommy Ettinger on 5/4/2016.
An example of what this outputs: https://gist.github.com/tommyettinger/3144b56a3a8e5bbe5ee401c1a93989f4 Created by Tommy Ettinger on 5/4/2016.
-
Field Summary
-
Constructor Summary
Constructors Constructor Description DenseRoomMapGenerator()
DenseRoomMapGenerator(int width, int height)
DenseRoomMapGenerator(int width, int height, IRNG rng)
-
Method Summary
Modifier and Type Method Description char[][]
generate()
Generate a map as a 2D char array using the width and height specified in the constructor.char[][]
getDungeon()
Gets the most recently-produced dungeon as a 2D char array, usually produced by callingIDungeonGenerator.generate()
or some similar method present in a specific implementation.int[][]
getEnvironment()
Gets a 2D array of int constants, each representing a type of environment corresponding to a static field of MixedGenerator.
-
Field Details
-
Constructor Details
-
Method Details
-
getDungeon
Description copied from interface:IDungeonGenerator
Gets the most recently-produced dungeon as a 2D char array, usually produced by callingIDungeonGenerator.generate()
or some similar method present in a specific implementation. This normally passes a direct reference and not a copy, so you can normally modify the returned array to propagate changes back into this IDungeonGenerator.- Specified by:
getDungeon
in interfaceIDungeonGenerator
- Returns:
- the most recently-produced dungeon/map as a 2D char array
-
generate
Generate a map as a 2D char array using the width and height specified in the constructor. Should produce a crowded arrangement of rectangular rooms that overlap with each other.- Specified by:
generate
in interfaceIDungeonGenerator
- Returns:
- a 2D char array for the map of densely-packed rectangular rooms.
-
getEnvironment
Gets a 2D array of int constants, each representing a type of environment corresponding to a static field of MixedGenerator. This array will have the same size as the last char 2D array produced by generate(); the value of this method if called before generate() is undefined, but probably will be a 2D array of all 0 (UNTOUCHED).- MixedGenerator.UNTOUCHED, equal to 0, is used for any cells that aren't near a floor.
- MixedGenerator.ROOM_FLOOR, equal to 1, is used for floor cells inside wide room areas.
- MixedGenerator.ROOM_WALL, equal to 2, is used for wall cells around wide room areas.
- MixedGenerator.CAVE_FLOOR, equal to 3, is used for floor cells inside rough cave areas.
- MixedGenerator.CAVE_WALL, equal to 4, is used for wall cells around rough cave areas.
- MixedGenerator.CORRIDOR_FLOOR, equal to 5, is used for floor cells inside narrow corridor areas.
- MixedGenerator.CORRIDOR_WALL, equal to 6, is used for wall cells around narrow corridor areas.
- Returns:
- a 2D int array where each element is an environment type constant in MixedGenerator
-