Package squidpony.squidgrid.mapping
Class ClassicRogueMapGenerator
java.lang.Object
squidpony.squidgrid.mapping.ClassicRogueMapGenerator
- All Implemented Interfaces:
IDungeonGenerator
public class ClassicRogueMapGenerator extends Object implements IDungeonGenerator
Creates a dungeon in the style of the original Rogue game. It will always
make a grid style of rooms where there are a certain number horizontally and
vertically and it will link them only next to each other.
This dungeon generator is based on a port of the rot.js version.
- Author:
- hyakugei, Eben Howard - http://squidpony.com - howard@squidpony.com
-
Constructor Summary
Constructors Constructor Description ClassicRogueMapGenerator(int horizontalRooms, int verticalRooms, int dungeonWidth, int dungeonHeight, int minRoomWidth, int maxRoomWidth, int minRoomHeight, int maxRoomHeight)
Initializes the generator to turn out random dungeons within the specific parameters.ClassicRogueMapGenerator(int horizontalRooms, int verticalRooms, int dungeonWidth, int dungeonHeight, int minRoomWidth, int maxRoomWidth, int minRoomHeight, int maxRoomHeight, IRNG rng)
Initializes the generator to turn out random dungeons within the specific parameters. -
Method Summary
Modifier and Type Method Description char[][]
generate()
Builds and returns a map in the Classic Rogue style, returned as a 2D char array.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.
-
Constructor Details
-
ClassicRogueMapGenerator
public ClassicRogueMapGenerator(int horizontalRooms, int verticalRooms, int dungeonWidth, int dungeonHeight, int minRoomWidth, int maxRoomWidth, int minRoomHeight, int maxRoomHeight)Initializes the generator to turn out random dungeons within the specific parameters. Will size down the room width and height parameters if needed to ensure the desired number of rooms will fit both horizontally and vertically.- Parameters:
horizontalRooms
- How many rooms will be made horizontallyverticalRooms
- How many rooms will be made verticallydungeonWidth
- How wide the total dungeon will bedungeonHeight
- How high the total dungeon will beminRoomWidth
- The minimum width a room can bemaxRoomWidth
- The maximum width a room can beminRoomHeight
- The minimum height a room can bemaxRoomHeight
- The maximum height a room can be
-
ClassicRogueMapGenerator
public ClassicRogueMapGenerator(int horizontalRooms, int verticalRooms, int dungeonWidth, int dungeonHeight, int minRoomWidth, int maxRoomWidth, int minRoomHeight, int maxRoomHeight, IRNG rng)Initializes the generator to turn out random dungeons within the specific parameters. Will size down the room width and height parameters if needed to ensure the desired number of rooms will fit both horizontally and vertically.- Parameters:
horizontalRooms
- How many rooms will be made horizontallyverticalRooms
- How many rooms will be made verticallydungeonWidth
- How wide the total dungeon will bedungeonHeight
- How high the total dungeon will beminRoomWidth
- The minimum width a room can bemaxRoomWidth
- The maximum width a room can beminRoomHeight
- The minimum height a room can bemaxRoomHeight
- The maximum height a room can be
-
-
Method Details
-
generate
Builds and returns a map in the Classic Rogue style, returned as a 2D char array. Only includes rooms ('.' for floor and '#' for walls), corridors (using the same chars as rooms) and doors ('+' for closed doors, does not generate open doors).- Specified by:
generate
in interfaceIDungeonGenerator
- Returns:
- a 2D char array version of the map
-
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
-