wyvern.kernel.dungeon
Class CaveGenerator

java.lang.Object
  extended bywyvern.kernel.dungeon.AbstractLevelGenerator
      extended bywyvern.kernel.dungeon.CaveGenerator

public class CaveGenerator
extends AbstractLevelGenerator

This file will create a random dungeon of arbitrary size and attributes. It will create tunnels between the various rooms and otherwise emulate a simple "net-hack" style dungeon maker. The symbols used are: # <- The wall around a room. Used only for representation, here. In the final version, players will see all of the empty squares as solid stone as well. + <- A door. If white, a secret door. . <- Open square. Either inside a room, or part of a tunnel. < <- The stairwell up to the previous level. > <- The stairwell down to the next level.

Version:
1.0, May 25, 1998
Author:
Kiz

Field Summary
static java.lang.String DEFAULT_CAVE_FLOOR
           
static int DEFAULT_CAVE_HEIGHT
           
static java.lang.String DEFAULT_CAVE_WALL
           
static int DEFAULT_CAVE_WIDTH
           
static int DEFAULT_DENSITY
           
static int DEFAULT_HIDDEN_CHANCE
           
static int DEFAULT_MIN_ROOMS
           
static int DEFAULT_SECRET_CHANCE
           
 
Fields inherited from class wyvern.kernel.dungeon.AbstractLevelGenerator
DEFAULT_HEIGHT, DEFAULT_WIDTH, floor_, height_, oobTerrain_, stairsDown_, stairsUp_, terrain_, width_
 
Constructor Summary
CaveGenerator()
           
 
Method Summary
 GameMap generate(java.lang.Class mapclass)
          Generates a GameMap.
 void generateCaves()
          Generates the caverns and connects them.
 int getDensity()
           
 int getMinRooms()
           
 int getSecretChance()
           
static void main(java.lang.String[] argv)
           
 void setDensity(int density)
          Sets the number of attempts it makes to create random new rooms.
 void setMinRooms(int rooms)
          Sets the minimum number of rooms.
 void setSecretChance(int chance)
          The odds, 0-100, that a given door is a secret door.
 
Methods inherited from class wyvern.kernel.dungeon.AbstractLevelGenerator
getDefaultTerrain, getDownstairArchetype, getFloorArchetype, getHeight, getOOBTerrain, getUpstairArchetype, getWidth, instantiateFloor, instantiateObject, rand, setDefaultTerrain, setDownstairArchetype, setFloorArchetype, setHeight, setOOBTerrain, setUpstairArchetype, setWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CAVE_WIDTH

public static final int DEFAULT_CAVE_WIDTH
See Also:
Constant Field Values

DEFAULT_CAVE_HEIGHT

public static final int DEFAULT_CAVE_HEIGHT
See Also:
Constant Field Values

DEFAULT_DENSITY

public static final int DEFAULT_DENSITY
See Also:
Constant Field Values

DEFAULT_HIDDEN_CHANCE

public static final int DEFAULT_HIDDEN_CHANCE
See Also:
Constant Field Values

DEFAULT_SECRET_CHANCE

public static final int DEFAULT_SECRET_CHANCE
See Also:
Constant Field Values

DEFAULT_MIN_ROOMS

public static final int DEFAULT_MIN_ROOMS
See Also:
Constant Field Values

DEFAULT_CAVE_WALL

public static final java.lang.String DEFAULT_CAVE_WALL
See Also:
Constant Field Values

DEFAULT_CAVE_FLOOR

public static final java.lang.String DEFAULT_CAVE_FLOOR
See Also:
Constant Field Values
Constructor Detail

CaveGenerator

public CaveGenerator()
Method Detail

setDensity

public void setDensity(int density)
Sets the number of attempts it makes to create random new rooms. Increasing the value will bump up the average number of rooms without changing the minimum number. Range: 1-1000.


getDensity

public int getDensity()

setSecretChance

public void setSecretChance(int chance)
The odds, 0-100, that a given door is a secret door.


getSecretChance

public int getSecretChance()

setMinRooms

public void setMinRooms(int rooms)
Sets the minimum number of rooms.


getMinRooms

public int getMinRooms()

generate

public GameMap generate(java.lang.Class mapclass)
                 throws java.lang.Exception
Generates a GameMap.

Specified by:
generate in class AbstractLevelGenerator
Parameters:
mapclass - the class to instantiate
Throws:
java.lang.Exception

generateCaves

public void generateCaves()
Generates the caverns and connects them.


main

public static void main(java.lang.String[] argv)