public class ConnectingMapGenerator extends java.lang.Object implements IDungeonGenerator
roomWidth
and roomHeight
set to 3, and wallThickness
set to 2:
┌────────────────────────────┐┌────────┐┌────────┐┌────────┐
│............................││........││........││........│
│............................││........││........││........│
│............................││........││........││........│
│...┌──────────┐...┌─────┐...││...┌┐...│└────┐...││...┌────┘
│...│┌───┐┌────┘...│┌────┘...└┘...││...└────┐│...││...└────┐
│...││...││........││.............││........││...││........│
│...││...││........││.............││........││...││........│
│...││...││........││.......<.....││........││...││........│
└───┘│...││...┌────┘│...┌─────────┘└────────┘│...│└────┐...│
┌────┘...││...└────┐│...│┌───────────────────┘...└─────┘...│
│........││........││...││.................................│
│.......>││........││...││.................................│
│........││........││...││.................................│
│...┌────┘└────┐...│└───┘│...┌─────────────────────────────┘
│...│┌────────┐│...└─────┘...└────┐┌───┐┌────────┐┌────────┐
│...││........││..................││...││........││........│
│...││........││..................││...││........││........│
│...││........││..................││...││........││........│
│...││...┌┐...│└────┐...┌─────────┘│...│└────┐...│└────┐...│
│...││...││...└─────┘...│┌────────┐│...└────┐│...└─────┘...│
│...││...││.............││........││........││.............│
│...││...││.............││........││........││.............│
│...││...││.............││........││........││.............│
│...││...││...┌─────────┘│...┌┐...││...┌────┘│...┌─────┐...│
│...└┘...││...└──────────┘...││...└┘...└─────┘...│┌────┘...│
│........││..................││..................││........│
│........││..................││..................││........│
│........││..................││..................││........│
└────────┘└──────────────────┘└──────────────────┘└────────┘
roomWidth
, roomHeight
, and wallThickness
all set to 1:
┌───────────────┬─┬───────────┬─────┬───┬─────────┬─┬───┬─┐
│...............│.│...........│.....│...│.........│.│...│.│
│.┌──────────.┌─┘.│.┌──.────┬─┤.┌───┤.│.│.──┐.──┐.│.│.│.│.│
│.│...........│.....│.......│.│.│...│.│.....│...│.│...│...│
├─┘.┌────.┌─┐.└─────┘.┌──.│.│.│.│.┌─┘.│.│.──┼───┤.└─┬─┘.│.│
│...│.....│.│.........│...│.│...│.│...│.│...│...│...│...│.│
│.┌─┴───┬─┘.│.┌──.┌───┤.──┤.│.┌─┤.│.┌─┴─┼─┐.│.│.└───┤.│.└─┤
│.│.....│...│.│...│...│...│.│.│.│...│...│.│...│.....│.│...│
├─┤.│.│.│.──┘.│.│.└─┐.├───┤.│.│.│.──┤.│.│.│.──┤.│.│.│.└─┐.│
│.│.│.│.......│.│...│.│...│.│.......│.│...│...│.│.│.│...│.│
│.│.└─┼────.┌─┘.└───┘.│.│.└─┴─┬─┬──.├─┤.──┴───┼─┤.├─┴─┐.└─┤
│.│...│>....│.........│.│.....│.│...│.│.......│.│.│...│...│
│.└─┐.│.┌───┴────.│.│.│.└─┬───┘.│.┌─┘.├───┐.┌─┘.├─┘.│.│.│<│
│...│.│.│.........│.│.....│.......│...│...│.│...│...│...│.│
├──.├─┼─┴──.│.│.┌─┘.├───┐.└──.──┬─┘.┌─┘.│.│.│.┌─┘.──┴───┤.│
│...│.│.....│.│.│...│...│.......│...│...│...│.│.........│.│
├─┐.│.│.──┬─┘.├─┘.┌─┤.──┼───┐.│.│.│.└──.└───┤.│.│.┌─┐.│.│.│
│.│...│...│...│...│.│...│...│.│.│.│.........│.│.│.│.│.│.│.│
│.│.│.└─┬─┴─┬─┴─┬─┤.├──.│.──┘.│.│.├──────.│.│.└─┤.│.│.└─┤.│
│...│...│...│...│.│.│.........│...│.......│.....│.│.│...│.│
│.┌─┤.│.│.│.│.│.│.│.│.──┐.──┐.├──.└───────┴─────┘.│.├──.├─┤
│.│.│.│.│.│.│.│...│.│...│...│.│...................│.│...│.│
│.│.├─┘.│.│.│.├──.│.└───┴─┐.│.└───────┐.──┐.──┬─┐.│.│.──┘.│
│.│.│.....│.│.│...│.......│.│.........│...│...│.│...│.....│
├─┘.│.┌──.│.└─┘.┌─┴────.│.│.├───────┐.└─┐.├──.│.└─┬─┘.┌──.│
│.....│...│.....│.......│...│.......│...│.│.......│...│...│
│.────┴─┐.├────.│.│.────┤.──┘.┌────.├───┘.│.┌────.├──.│.──┤
│.......│.│.......│.....│.....│.....│.....│.│.....│...│...│
└───────┴─┴───────┴─────┴─────┴─────┴─────┴─┴─────┴───┴───┘
divideRooms
set to 0.65:
┌─────┬───────────┬───────────┬─────┬─────┬─────┬─────┬─────┐
│.....+...........│...........│.....│.....│.....│.....+.....│
│.....│...........│...........│.....+.....│.....│.....│.....│
│.....│...........│...........+.....│.....│.....│.....│.....│
│.....│...........│...........│.....│.....│.....│.....│.....│
│.....│.......................│.....│.....│.....│.....│.....│
│.....│.....┌─────┬───+─┬─────┼─────┼─────┼──+──┼────+┼──+──┤
│.....│.....│.....│.....│.....│.....│.....│.....│.....│.....│
│.....│.....│.....│.....│.....│.....│.....│.....│.....│.....│
│.....│.....│.....│.....│.....│.....+.....│.....│.....│.....│
│.....│.....│.....│.....│.....+.....│.....│.....│.....│.....│
│.....│.....│.....│.....+.....│.....│.....+.....│.....│.....│
├────+┼───+─┼────+┼─────┴─────┴─────┘.....├─────┼─────┤.....│
│.....│.....│.....│.......................│.....│....>│.....│
│.....│.....│.....│.....│.................│.....│.....│.....│
│.....│.....│..<..│.....│.................│.....│.....│.....│
│.....│.....│.....+.....│.................│.....│.....+.....│
│.....│.....│.....│.....│.................│.....│.....│.....│
│.────┼────.├─────┼─────┴───────────┬────.├────.├──+──┼──+──┤
│.....│.....│.....│.................│.....│.....│.....│.....│
│.....│.....│.....│.................│.....│.....│.....│.....│
│.....│.....│.....│.................│.....│.....│.....│.....│
│.....│.....│.....│.................│.....│.....+.....│.....│
│.....│.....+.....│.................│.....│.....│.....│.....│
├───+─┼─────┼───+─┼────+──────┐.....└+────┼─────┼─────┼─.───┤
│.....│.....│.....│...........│...........│.....│.....+.....│
│.....│.....│.....│...........│...........│...........│.....│
│.....│.....│.....│...........│...........+.....│.....│.....│
│.....│.....│.....│...........│...........│.....│.....│.....│
│.....+.....│.....│...........│...........│.....│.....│.....│
└─────┴─────┴─────┴───────────┴───────────┴─────┴─────┴─────┘
Modifier and Type | Field and Description |
---|---|
double |
divideRooms |
char[][] |
dungeon |
int[][] |
environment |
int |
height |
GreasedRegion |
region |
IRNG |
rng |
int |
roomHeight |
int |
roomWidth |
int |
wallThickness |
int |
width |
Constructor and Description |
---|
ConnectingMapGenerator()
Calls
ConnectingMapGenerator(int, int, int, int, IRNG, int) with width 80, height 80, roomWidth 8,
roomHeight 8, a new GWTRNG for random, and wallThickness 2. |
ConnectingMapGenerator(int width,
int height,
int roomWidth,
int roomHeight,
IRNG random)
Exactly like
ConnectingMapGenerator(int, int, int, int, IRNG, int) with wallThickness 2. |
ConnectingMapGenerator(int width,
int height,
int roomWidth,
int roomHeight,
IRNG random,
int wallThickness) |
ConnectingMapGenerator(int width,
int height,
int roomWidth,
int roomHeight,
IRNG random,
int wallThickness,
double divideRooms) |
ConnectingMapGenerator(int width,
int height,
IRNG random)
Determines room width and room height by dividing width or height by 10; wallThickness is 2.
|
Modifier and Type | Method and Description |
---|---|
char[][] |
generate()
Generates a dungeon or other map as a 2D char array.
|
char[][] |
getDungeon()
Gets the most recently-produced dungeon as a 2D char array, usually produced by calling
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
DungeonUtility.
|
public int width
public int height
public int roomWidth
public int roomHeight
public int wallThickness
public char[][] dungeon
public int[][] environment
public GreasedRegion region
public double divideRooms
public IRNG rng
public ConnectingMapGenerator()
ConnectingMapGenerator(int, int, int, int, IRNG, int)
with width 80, height 80, roomWidth 8,
roomHeight 8, a new GWTRNG
for random, and wallThickness 2.public ConnectingMapGenerator(int width, int height, IRNG random)
width
- total width of the map, in cellsheight
- total height of the map, in cellsrandom
- an IRNG to make random choices for connecting roomspublic ConnectingMapGenerator(int width, int height, int roomWidth, int roomHeight, IRNG random)
ConnectingMapGenerator(int, int, int, int, IRNG, int)
with wallThickness 2.width
- total width of the map, in cellsheight
- total height of the map, in cellsroomWidth
- target width of each room, in cells; only counts the center floor area of a roomroomHeight
- target height of each room, in cells; only counts the center floor area of a roomrandom
- an IRNG to make random choices for connecting roomspublic ConnectingMapGenerator(int width, int height, int roomWidth, int roomHeight, IRNG random, int wallThickness)
width
- total width of the map, in cellsheight
- total height of the map, in cellsroomWidth
- target width of each room, in cells; only counts the center floor area of a roomroomHeight
- target height of each room, in cells; only counts the center floor area of a roomrandom
- an IRNG to make random choices for connecting roomswallThickness
- how thick a wall between two rooms should be, in cells; 1 is minimum, and this usually
shouldn't be much more than roomWidth or roomHeightpublic ConnectingMapGenerator(int width, int height, int roomWidth, int roomHeight, IRNG random, int wallThickness, double divideRooms)
width
- total width of the map, in cellsheight
- total height of the map, in cellsroomWidth
- target width of each room, in cells; only counts the center floor area of a roomroomHeight
- target height of each room, in cells; only counts the center floor area of a roomrandom
- an IRNG to make random choices for connecting roomswallThickness
- how thick a wall between two rooms should be, in cells; 1 is minimum, and this usually
shouldn't be much more than roomWidth or roomHeightpublic char[][] generate()
environment
with appropriate constants from DungeonUtility,
like DungeonUtility.ROOM_FLOOR
and DungeonUtility.ROOM_WALL
.generate
in interface IDungeonGenerator
public char[][] getDungeon()
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.getDungeon
in interface IDungeonGenerator
public int[][] getEnvironment()
Copyright © Eben Howard 2012–2022. All rights reserved.