Class Placement

java.lang.Object
com.github.yellowstonegames.place.Placement

public class Placement extends Object
Helps find areas where game-specific terrain features might be suitable to place. Example placement for getAlongStraightWalls(), using all regions where there's an extended straight wall in a room to place a rack of bows (as curly braces): here. You can use getHidingPlaces(Radius, float) to place stealthy enemies in locations that are not easily visible from doors or other narrow entry points (as evaluated by FOV).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected com.github.yellowstonegames.grid.Region
     
    protected com.github.yellowstonegames.grid.Region
     
    protected com.github.yellowstonegames.grid.Region
     
    protected com.github.yellowstonegames.grid.Region
     
    protected com.github.tommyettinger.ds.ObjectOrderedSet<com.github.yellowstonegames.grid.CoordOrderedSet>
     
    protected com.github.tommyettinger.ds.ObjectOrderedSet<com.github.yellowstonegames.grid.CoordOrderedSet>
     
    protected com.github.tommyettinger.ds.ObjectOrderedSet<com.github.yellowstonegames.grid.CoordOrderedSet>
     
    protected RoomFinder
    The RoomFinder this uses internally to find placement areas only where they are appropriate.
    protected com.github.yellowstonegames.grid.CoordOrderedSet
     
    protected com.github.yellowstonegames.grid.Region
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a Placement using the given RoomFinder, which will have collections of rooms, corridors, and caves.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.github.yellowstonegames.grid.Region
     
    com.github.yellowstonegames.grid.Region
     
    com.github.yellowstonegames.grid.Region
     
    com.github.yellowstonegames.grid.Region
     
    com.github.tommyettinger.ds.ObjectOrderedSet<com.github.yellowstonegames.grid.CoordOrderedSet>
    Gets an ObjectOrderedSet of CoordOrderedSet, where each inner CoordOrderedSet refers to a placement region along a straight wall with length 3 or more, not including corners.
    com.github.tommyettinger.ds.ObjectOrderedSet<com.github.yellowstonegames.grid.CoordOrderedSet>
    Gets an ObjectOrderedSet of CoordOrderedSet, where each inner CoordOrderedSet refers to a room's cells that are furthest from the walls, and each Coord is one of those central positions.
    com.github.tommyettinger.ds.ObjectOrderedSet<com.github.yellowstonegames.grid.CoordOrderedSet>
    Gets an ObjectOrderedSet of CoordOrderedSet, where each inner CoordOrderedSet refers to a room's corners, and each Coord is one of those corners.
     
    com.github.yellowstonegames.grid.CoordOrderedSet
    getHidingPlaces(com.github.yellowstonegames.grid.Radius radiusStrategy, float range)
    Gets an CoordOrderedSet, where each Coord is hidden (using the given radiusStrategy and range for FOV calculations) from any doorways or similar narrow choke-points where a character might be easily ambushed.
    com.github.yellowstonegames.grid.Region
     
     

    Methods inherited from class Object

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

    • finder

      protected RoomFinder finder
      The RoomFinder this uses internally to find placement areas only where they are appropriate.
    • allRooms

      protected com.github.yellowstonegames.grid.Region allRooms
    • allCorridors

      protected com.github.yellowstonegames.grid.Region allCorridors
    • allCaves

      protected com.github.yellowstonegames.grid.Region allCaves
    • allFloors

      protected com.github.yellowstonegames.grid.Region allFloors
    • nonRoom

      protected com.github.yellowstonegames.grid.Region nonRoom
    • alongStraightWalls

      protected com.github.tommyettinger.ds.ObjectOrderedSet<com.github.yellowstonegames.grid.CoordOrderedSet> alongStraightWalls
    • corners

      protected com.github.tommyettinger.ds.ObjectOrderedSet<com.github.yellowstonegames.grid.CoordOrderedSet> corners
    • centers

      protected com.github.tommyettinger.ds.ObjectOrderedSet<com.github.yellowstonegames.grid.CoordOrderedSet> centers
    • hidingPlaces

      protected com.github.yellowstonegames.grid.CoordOrderedSet hidingPlaces
  • Constructor Details

    • Placement

      public Placement(RoomFinder finder)
      Constructs a Placement using the given RoomFinder, which will have collections of rooms, corridors, and caves. A common use case for this class involves the Placement field that is constructed in a SectionDungeonGenerator when generate() or generateRespectingStairs() in that class is called; if you use SectionDungeonGenerator, there isn't much need for this constructor, since you can normally use the one created as a field in that class.
      Parameters:
      finder - a RoomFinder that must not be null.
  • Method Details

    • getAlongStraightWalls

      public com.github.tommyettinger.ds.ObjectOrderedSet<com.github.yellowstonegames.grid.CoordOrderedSet> getAlongStraightWalls()
      Gets an ObjectOrderedSet of CoordOrderedSet, where each inner CoordOrderedSet refers to a placement region along a straight wall with length 3 or more, not including corners. Each Coord refers to a single cell along the straight wall. This could be useful for placing weapon racks in armories, chalkboards in schoolrooms (tutorial missions, perhaps?), or even large paintings/murals in palaces.
      Returns:
      a set of sets of Coord where each set of Coord is a wall's viable placement for long things along it
    • getCorners

      public com.github.tommyettinger.ds.ObjectOrderedSet<com.github.yellowstonegames.grid.CoordOrderedSet> getCorners()
      Gets an ObjectOrderedSet of CoordOrderedSet, where each inner CoordOrderedSet refers to a room's corners, and each Coord is one of those corners. There are more uses for corner placement than I can list. This doesn't always identify all corners, since it only finds ones in rooms, and a cave too close to a corner can cause that corner to be ignored.
      Returns:
      a set of sets of Coord where each set of Coord is a room's corners
    • getCenters

      public com.github.tommyettinger.ds.ObjectOrderedSet<com.github.yellowstonegames.grid.CoordOrderedSet> getCenters()
      Gets an ObjectOrderedSet of CoordOrderedSet, where each inner CoordOrderedSet refers to a room's cells that are furthest from the walls, and each Coord is one of those central positions. There are many uses for this, like finding a position to place a throne or shrine in a large room where it should be visible from all around. This doesn't always identify all centers, since it only finds ones in rooms, and it can also find multiple central points if they are all the same distance from a wall (common in something like a 3x7 room, where it will find a 1x5 column as the centers of that room).
      Returns:
      a set of sets of Coord where each set of Coord contains a room's cells that are furthest from the walls.
    • getHidingPlaces

      public com.github.yellowstonegames.grid.CoordOrderedSet getHidingPlaces(com.github.yellowstonegames.grid.Radius radiusStrategy, float range)
      Gets an CoordOrderedSet, where each Coord is hidden (using the given radiusStrategy and range for FOV calculations) from any doorways or similar narrow choke-points where a character might be easily ambushed. If multiple choke-points can see a cell (using shadow-casting FOV, which is asymmetrical), then the cell is very unlikely to be included in the returned Coords, but if a cell is visible from one or no choke-points and is far enough away, then it is more likely to be included.
      Parameters:
      radiusStrategy - a Radius object that will be used to determine visibility.
      range - the minimum distance things are expected to hide at; often related to player FOV range
      Returns:
      a Set of Coord where each Coord is either far away from or is concealed from a door-like area
    • getFinder

      public RoomFinder getFinder()
    • getAllRooms

      public com.github.yellowstonegames.grid.Region getAllRooms()
    • getAllCorridors

      public com.github.yellowstonegames.grid.Region getAllCorridors()
    • getAllCaves

      public com.github.yellowstonegames.grid.Region getAllCaves()
    • getAllFloors

      public com.github.yellowstonegames.grid.Region getAllFloors()
    • getNonRoom

      public com.github.yellowstonegames.grid.Region getNonRoom()
    • toString

      public String toString()
      Overrides:
      toString in class Object