Interface PlaceGenerator
- All Known Implementing Classes:
ConnectingMapGenerator, DungeonProcessor, FlowingCaveGenerator, GrowingTreeMazeGenerator, MixedGenerator, OrganicConnectingMapGenerator, PacMazeGenerator, SerpentMapGenerator, SlashMazeGenerator, SymmetryDungeonGenerator, WildernessGenerator, WildernessGenerator.MixedWildernessGenerator
public interface PlaceGenerator
Standardizes an interface for classes that generate 2D char arrays to be used as place maps.
-
Method Summary
Modifier and TypeMethodDescriptionchar[][]generate()Generates a dungeon or other place as a 2D char array.int[][]Gets the most recently-produced place's environment as a 2D int array, where each int is typically a bit-flag fromDungeonToolslikeDungeonTools.NATURAL_WALLorDungeonTools.ROOM_FLOOR.char[][]Gets the most recently-produced place as a 2D char array, usually produced by callinggenerate()or some similar method present in a specific implementation.
-
Method Details
-
generate
char[][] generate()Generates a dungeon or other place as a 2D char array. Any implementation may allow its own configuration and customization of how dungeons are generated, but each must provide this as a sane default. Most implementations should use the convention of '#' representing a blocking cell such as a wall and '.' representing a bare floor, but beyond that, anything could be present in the char array.- Returns:
- a 2D char array representing some kind of map, probably using standard conventions for walls/floors
-
getPlaceGrid
char[][] getPlaceGrid()Gets the most recently-produced place as a 2D char array, usually produced by callinggenerate()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 IPlaceGenerator.- Returns:
- the most recently-produced dungeon/place as a 2D char array
-
getEnvironment
int[][] getEnvironment()Gets the most recently-produced place's environment as a 2D int array, where each int is typically a bit-flag fromDungeonToolslikeDungeonTools.NATURAL_WALLorDungeonTools.ROOM_FLOOR. Use methods from DungeonTools, such asDungeonTools.isFloor(int)orDungeonTools.isRoom(int), to check if an environment int represents specific parts of a dungeon map. If you just check environment ints for equality, you may get incorrect results if that int represents any cell using the optional lock-and-key system. You can also use DungeonTools to check for locks, usingDungeonTools.checkLock(int, int)and a constant such asDungeonTools.LOCK_NEEDS_HAND(for areas inaccessible to animals) orDungeonTools.LOCK_DEEP_WATER(for areas that require being able to swim). All lock values are defined inDungeonTools.LOCKS, which allows accessing any of the 20 locks by an index 0-19.- Returns:
- the environment of the most recently-produced place, as a 2D int array
-