Class SymmetryDungeonGenerator

java.lang.Object
com.github.yellowstonegames.place.MixedGenerator
com.github.yellowstonegames.place.SymmetryDungeonGenerator
All Implemented Interfaces:
PlaceGenerator

public class SymmetryDungeonGenerator extends MixedGenerator
A variant on MixedGenerator that creates bi-radially symmetric maps (basically a yin-yang shape). Useful for strategy games and possibly competitive multi-player games. The Coords passed to constructors as room positions do not necessarily need to be symmetrical already; they will be duplicated in their mirror position in the dungeon.
  • Field Summary

  • Constructor Summary

    Constructors
    Constructor
    Description
    This prepares a map generator that will generate a map with width 80 and height 80, using a random seed.
    SymmetryDungeonGenerator(int width, int height, com.github.tommyettinger.random.EnhancedRandom rng)
    This prepares a map generator that will generate a map with the given width and height, using the given RNG.
    SymmetryDungeonGenerator(int width, int height, com.github.tommyettinger.random.EnhancedRandom rng, com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord> sequence)
    This prepares a map generator that will generate a map with the given width and height, using the given RNG.
    SymmetryDungeonGenerator(int width, int height, com.github.tommyettinger.random.EnhancedRandom rng, com.github.tommyettinger.ds.ObjectObjectOrderedMap<com.github.yellowstonegames.grid.Coord, com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>> connections)
    This prepares a map generator that will generate a map with the given width and height, using the given RNG.
    SymmetryDungeonGenerator(int width, int height, com.github.tommyettinger.random.EnhancedRandom rng, com.github.tommyettinger.ds.ObjectObjectOrderedMap<com.github.yellowstonegames.grid.Coord, com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>> connections, float roomSizeMultiplier)
    This prepares a map generator that will generate a map with the given width and height, using the given RNG.
    SymmetryDungeonGenerator(int width, int height, com.github.tommyettinger.random.EnhancedRandom rng, com.github.tommyettinger.ds.Ordered<com.github.yellowstonegames.grid.Coord> sequence)
    This prepares a map generator that will generate a map with the given width and height, using the given RNG.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected static com.github.tommyettinger.ds.ObjectObjectOrderedMap<com.github.yellowstonegames.grid.Coord, com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>>
    crossConnect(int width, int height, Map<com.github.yellowstonegames.grid.Coord, com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>> connections)
     
    protected static com.github.tommyettinger.ds.ObjectObjectOrderedMap<com.github.yellowstonegames.grid.Coord, com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>>
    listToMap(com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord> sequence)
     
    protected boolean
    mark(int x, int y)
    Internal use.
    protected void
    markEnvironment(int x, int y, int kind)
    Internal use.
    protected void
    markPiercing(int x, int y)
    Internal use.
    static com.github.tommyettinger.ds.ObjectObjectOrderedMap<com.github.yellowstonegames.grid.Coord, com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>>
    removeSomeOverlap(int width, int height, com.github.tommyettinger.ds.ObjectObjectOrderedMap<com.github.yellowstonegames.grid.Coord, com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>> connections)
     
    static com.github.tommyettinger.ds.ObjectObjectOrderedMap<com.github.yellowstonegames.grid.Coord, com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>>
    removeSomeOverlap(int width, int height, Collection<com.github.yellowstonegames.grid.Coord> sequence)
     
    protected static com.github.tommyettinger.ds.ObjectObjectOrderedMap<com.github.yellowstonegames.grid.Coord, com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>>
    setToMap(com.github.tommyettinger.ds.Ordered<com.github.yellowstonegames.grid.Coord> sequence)
     
     
    protected void
    wallOff(int x, int y)
    Internal use.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SymmetryDungeonGenerator

      public SymmetryDungeonGenerator()
      This prepares a map generator that will generate a map with width 80 and height 80, using a random seed. This version of the constructor uses Poisson Disk sampling to generate the points it will draw caves and corridors between, ensuring a minimum distance between points, but it does not ensure that paths between points will avoid overlapping with rooms or other paths. You call the different carver-adding methods to affect what the dungeon will look like, putCaveCarvers(), putBoxRoomCarvers(), and putRoundRoomCarvers(), defaulting to only caves if none are called. You call generate() after adding carvers, which returns a char[][] for a map.
      See Also:
      • used to ensure spacing for the points.
    • SymmetryDungeonGenerator

      public SymmetryDungeonGenerator(int width, int height, com.github.tommyettinger.random.EnhancedRandom rng)
      This prepares a map generator that will generate a map with the given width and height, using the given RNG. This version of the constructor uses Poisson Disk sampling to generate the points it will draw caves and corridors between, ensuring a minimum distance between points, but it does not ensure that paths between points will avoid overlapping with rooms or other paths. You call the different carver-adding methods to affect what the dungeon will look like, putCaveCarvers(), putBoxRoomCarvers(), and putRoundRoomCarvers(), defaulting to only caves if none are called. You call generate() after adding carvers, which returns a char[][] for a map.
      Parameters:
      width - the width of the final map in cells
      height - the height of the final map in cells
      rng - an RNG object to use for random choices; this make a lot of random choices.
      See Also:
      • used to ensure spacing for the points.
    • SymmetryDungeonGenerator

      public SymmetryDungeonGenerator(int width, int height, com.github.tommyettinger.random.EnhancedRandom rng, com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord> sequence)
      This prepares a map generator that will generate a map with the given width and height, using the given RNG. This version of the constructor uses a ObjectList of Coord points from some other source to determine the path to add rooms or caves to and then connect. You call the different carver-adding methods to affect what the dungeon will look like, putCaveCarvers(), putBoxRoomCarvers(), and putRoundRoomCarvers(), defaulting to only caves if none are called. You call generate() after adding carvers, which returns a char[][] for a map.
      Parameters:
      width - the width of the final map in cells
      height - the height of the final map in cells
      rng - an EnhancedRandom, such as a WhiskerRandom, to use for random choices; this make a lot of random choices.
      sequence - a ObjectList of Coord to connect in order; index 0 is the start, index size() - 1 is the end.
      See Also:
    • SymmetryDungeonGenerator

      public SymmetryDungeonGenerator(int width, int height, com.github.tommyettinger.random.EnhancedRandom rng, com.github.tommyettinger.ds.Ordered<com.github.yellowstonegames.grid.Coord> sequence)
      This prepares a map generator that will generate a map with the given width and height, using the given RNG. This version of the constructor uses a ObjectList of Coord points from some other source to determine the path to add rooms or caves to and then connect. You call the different carver-adding methods to affect what the dungeon will look like, putCaveCarvers(), putBoxRoomCarvers(), and putRoundRoomCarvers(), defaulting to only caves if none are called. You call generate() after adding carvers, which returns a char[][] for a map.
      Parameters:
      width - the width of the final map in cells
      height - the height of the final map in cells
      rng - an EnhancedRandom, such as a WhiskerRandom, to use for random choices; this make a lot of random choices.
      sequence - a ObjectList of Coord to connect in order; index 0 is the start, index size() - 1 is the end.
      See Also:
    • SymmetryDungeonGenerator

      public SymmetryDungeonGenerator(int width, int height, com.github.tommyettinger.random.EnhancedRandom rng, com.github.tommyettinger.ds.ObjectObjectOrderedMap<com.github.yellowstonegames.grid.Coord, com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>> connections)
      This prepares a map generator that will generate a map with the given width and height, using the given RNG. This version of the constructor uses a LinkedHashMap with Coord keys and Coord array values to determine a branching path for the dungeon to take; each key will connect once to each of the Coords in its value, and you usually don't want to connect in both directions. You call the different carver-adding methods to affect what the dungeon will look like, putCaveCarvers(), putBoxRoomCarvers(), and putRoundRoomCarvers(), defaulting to only caves if none are called. You call generate() after adding carvers, which returns a char[][] for a map.
      Parameters:
      width - the width of the final map in cells
      height - the height of the final map in cells
      rng - an EnhancedRandom object to use for random choices; this makes a lot of random choices.
      connections - a Map of Coord keys to arrays of Coord to connect to next; shouldn't connect both ways
      See Also:
    • SymmetryDungeonGenerator

      public SymmetryDungeonGenerator(int width, int height, com.github.tommyettinger.random.EnhancedRandom rng, com.github.tommyettinger.ds.ObjectObjectOrderedMap<com.github.yellowstonegames.grid.Coord, com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>> connections, float roomSizeMultiplier)
      This prepares a map generator that will generate a map with the given width and height, using the given RNG. This version of the constructor uses a ObjectObjectOrderedMap with Coord keys and Coord array values to determine a branching path for the dungeon to take; each key will connect once to each of the Coords in its value, and you usually don't want to connect in both directions. You call the different carver-adding methods to affect what the dungeon will look like, putCaveCarvers(), putBoxRoomCarvers(), and putRoundRoomCarvers(), defaulting to only caves if none are called. You call generate() after adding carvers, which returns a char[][] for a map.
      Parameters:
      width - the width of the final map in cells
      height - the height of the final map in cells
      rng - an EnhancedRandom object to use for random choices; this makes a lot of random choices.
      connections - a Map of Coord keys to arrays of Coord to connect to next; shouldn't connect both ways
      roomSizeMultiplier - a float multiplier that will be applied to each room's width and height
      See Also:
  • Method Details

    • removeSomeOverlap

      public static com.github.tommyettinger.ds.ObjectObjectOrderedMap<com.github.yellowstonegames.grid.Coord, com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>> removeSomeOverlap(int width, int height, Collection<com.github.yellowstonegames.grid.Coord> sequence)
    • removeSomeOverlap

      public static com.github.tommyettinger.ds.ObjectObjectOrderedMap<com.github.yellowstonegames.grid.Coord, com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>> removeSomeOverlap(int width, int height, com.github.tommyettinger.ds.ObjectObjectOrderedMap<com.github.yellowstonegames.grid.Coord, com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>> connections)
    • listToMap

      protected static com.github.tommyettinger.ds.ObjectObjectOrderedMap<com.github.yellowstonegames.grid.Coord, com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>> listToMap(com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord> sequence)
    • setToMap

      protected static com.github.tommyettinger.ds.ObjectObjectOrderedMap<com.github.yellowstonegames.grid.Coord, com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>> setToMap(com.github.tommyettinger.ds.Ordered<com.github.yellowstonegames.grid.Coord> sequence)
    • crossConnect

      protected static com.github.tommyettinger.ds.ObjectObjectOrderedMap<com.github.yellowstonegames.grid.Coord, com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>> crossConnect(int width, int height, Map<com.github.yellowstonegames.grid.Coord, com.github.tommyettinger.ds.ObjectList<com.github.yellowstonegames.grid.Coord>> connections)
    • mark

      protected boolean mark(int x, int y)
      Internal use. Marks a point to be made into floor.
      Overrides:
      mark in class MixedGenerator
      Parameters:
      x - x position to mark
      y - y position to mark
      Returns:
      false if everything is normal, true if and only if this failed to mark because the position is walled
    • markPiercing

      protected void markPiercing(int x, int y)
      Internal use. Marks a point to be made into floor.
      Overrides:
      markPiercing in class MixedGenerator
      Parameters:
      x - x position to mark
      y - y position to mark
    • wallOff

      protected void wallOff(int x, int y)
      Internal use. Marks a point to be made into floor.
      Overrides:
      wallOff in class MixedGenerator
      Parameters:
      x - x position to mark
      y - y position to mark
    • markEnvironment

      protected void markEnvironment(int x, int y, int kind)
      Internal use. Marks a point's environment type as the appropriate kind of environment.
      Overrides:
      markEnvironment in class MixedGenerator
      Parameters:
      x - x position to mark
      y - y position to mark
      kind - an int that should be one of the constants in MixedGenerator for environment types.
    • toString

      public String toString()
      Overrides:
      toString in class MixedGenerator