Class ThinDungeonGenerator

java.lang.Object
squidpony.squidgrid.mapping.SectionDungeonGenerator
squidpony.squidgrid.mapping.ThinDungeonGenerator
All Implemented Interfaces:
IDungeonGenerator

public class ThinDungeonGenerator
extends SectionDungeonGenerator
Created by Tommy Ettinger on 8/7/2016.
  • Field Details

  • Constructor Details

    • ThinDungeonGenerator

      Make a DungeonGenerator with a LightRNG using a random seed, height 40, and width 40.
    • ThinDungeonGenerator

      public ThinDungeonGenerator​(int width, int height)
      Make a DungeonGenerator with the given height and width; the RNG used for generating a dungeon and adding features will be a LightRNG using a random seed.
      Parameters:
      width - The width of the dungeon in cells
      height - The height of the dungeon in cells
    • ThinDungeonGenerator

      public ThinDungeonGenerator​(int width, int height, IRNG rng)
      Make a DungeonGenerator with the given height, width, and RNG. Use this if you want to seed the RNG.
      Parameters:
      width - The width of the dungeon in cells
      height - The height of the dungeon in cells
      rng - The RNG to use for all purposes in this class; if it is a StatefulRNG, then it will be used as-is,
    • ThinDungeonGenerator

      public ThinDungeonGenerator​(int width, int height, int roomShape, int corridorShape, int caveShape)
      Make a DungeonGenerator with the given height and width; the RNG used for generating a dungeon and adding features will be a LightRNG using a random seed. You can give the static fields of this class as arguments to roomShape, corridorShape and caveShape. For clarity, the 3 fields should each be given a constant corresponding to the same kind of area, e.g. ROOM_WALL_EXPAND or ROOM_WALL_RETRACT could be given to roomShape but preferably would not be given to the others. If the combination of arguments is invalid, such as if they are all 0, this uses the default shapes: expanded room and corridor walls, and chaotic cave walls controlled by SeededNoise.
      Though there's no constructor that takes a single int which merges roomShape, corridorShape, and caveShape, the internal representation of those shapes is one int. If you have one of those ints, or you made one yourself (such as with bitwise OR on three different constants), you can pass it to any of the three shape arguments and 0 to the other two shapes; it will be processed in the same way.
      Parameters:
      width - The width of the dungeon in cells
      height - The height of the dungeon in cells
      roomShape - expected to be an int constant: ROOM_WALL_EXPAND, ROOM_WALL_RETRACT, or ROOM_WALL_CHAOTIC
      corridorShape - expected to be an int constant: CORRIDOR_WALL_EXPAND, CORRIDOR_WALL_RETRACT, or CORRIDOR_WALL_CHAOTIC
      caveShape - expected to be an int constant: CAVE_WALL_EXPAND, CAVE_WALL_RETRACT, or CAVE_WALL_CHAOTIC
    • ThinDungeonGenerator

      public ThinDungeonGenerator​(int width, int height, IRNG rng, int roomShape, int corridorShape, int caveShape)
      Make a DungeonGenerator with the given height, width, and RNG for generating random features. You can give the static fields of this class as arguments to roomShape, corridorShape and caveShape. For clarity, the 3 fields should each be given a constant corresponding to the same kind of area, e.g. ROOM_WALL_EXPAND or ROOM_WALL_RETRACT could be given to roomShape but preferably would not be given to the others. If the combination of arguments is invalid, such as if they are all 0, this uses the default shapes: expanded room and corridor walls, and chaotic cave walls controlled by SeededNoise.
      Though there's no constructor that takes a single int which merges roomShape, corridorShape, and caveShape, the internal representation of those shapes is one int. If you have one of those ints, or you made one yourself (such as with bitwise OR on three different constants), you can pass it to any of the three shape arguments and 0 to the other two shapes; it will be processed in the same way.
      Parameters:
      width - The width of the dungeon in cells
      height - The height of the dungeon in cells
      roomShape - expected to be an int constant: ROOM_WALL_EXPAND, ROOM_WALL_RETRACT, or ROOM_WALL_CHAOTIC
      corridorShape - expected to be an int constant: CORRIDOR_WALL_EXPAND, CORRIDOR_WALL_RETRACT, or CORRIDOR_WALL_CHAOTIC
      caveShape - expected to be an int constant: CAVE_WALL_EXPAND, CAVE_WALL_RETRACT, or CAVE_WALL_CHAOTIC
      rng - The RNG to use for all purposes in this class; if it is a StatefulRNG, then it will be used as-is,
    • ThinDungeonGenerator

      Copies all fields from copying and makes a new DungeonGenerator.
      Parameters:
      copying - the DungeonGenerator to copy
  • Method Details

    • addDoors

      public SectionDungeonGenerator addDoors​(int percentage, boolean doubleDoors)
      Doors are not supported by this class. There's a lot of confusing and ambiguous situations that can easily result from trying to automatically place doors when any given map could need doors on walkable cells, prefer doors between walkable cells aligned to walls, have mixes of "expanded", "retracted", and "normal" wall change modes, or any number of other issues. There are also some very confusing cases where automatically-placed doors, if this class tries to reposition them in retracted-wall mode (or in any case where rooms and corridors don't have the same change mode), wind up hanging in the middle of a room or with partial connecting walls but not any sensible layout. If you want doors here, you should assign them yourself how you see fit.
      Overrides:
      addDoors in class SectionDungeonGenerator
      Parameters:
      percentage - ignored.
      doubleDoors - ignored.
      Returns:
      this for chaining.
    • makeThin

      public char[][] makeThin()
    • innerGenerate

      protected char[][] innerGenerate()
      Overrides:
      innerGenerate in class SectionDungeonGenerator
    • removeHardCorners

      public void removeHardCorners()
      Modifies this ThinDungeonGenerator to remove corners between thin walls (truncating the corners, effectively). Regenerates the RoomFinder and Placement objects this uses.
    • toString

      public String toString()
      Provides a string representation of the latest generated dungeon. Because the spaces between occupy-able cells, when walkable, use the control character U+0006 to indicate that they're not meant to be displayed, this replaces any instances of that character in the printable output with ordinary space characters, while keeping the internal representation as the control character.
      Overrides:
      toString in class SectionDungeonGenerator
      Returns:
      a printable string version of the latest generated dungeon.