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 calling IDungeonGenerator.generate() or some similar method present in a specific implementation.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 horizontally
      verticalRooms - How many rooms will be made vertically
      dungeonWidth - How wide the total dungeon will be
      dungeonHeight - How high the total dungeon will be
      minRoomWidth - The minimum width a room can be
      maxRoomWidth - The maximum width a room can be
      minRoomHeight - The minimum height a room can be
      maxRoomHeight - 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 horizontally
      verticalRooms - How many rooms will be made vertically
      dungeonWidth - How wide the total dungeon will be
      dungeonHeight - How high the total dungeon will be
      minRoomWidth - The minimum width a room can be
      maxRoomWidth - The maximum width a room can be
      minRoomHeight - The minimum height a room can be
      maxRoomHeight - The maximum height a room can be
  • Method Details

    • generate

      public char[][] 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 interface IDungeonGenerator
      Returns:
      a 2D char array version of the map
    • getDungeon

      public char[][] getDungeon()
      Description copied from interface: IDungeonGenerator
      Gets the most recently-produced dungeon as a 2D char array, usually produced by calling IDungeonGenerator.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 interface IDungeonGenerator
      Returns:
      the most recently-produced dungeon/map as a 2D char array