Skip to content

DungeonExplorer: organic generator strategy #31

@barrybecker4

Description

@barrybecker4

So far I have "bsp" and "unionGraph".
The next idea to implement is "organic".
For this approach, we will start with one room and then sprout other connected rooms out from it until the available dungeon area is completely filled. Additional connections, besides just those to the root, can be added as we go depending on the value of the connectivity param. This approach will have a couple of advantages:

  • it can fill any available space, not just a rectangle
  • its guaranteed to be linear time with the number of rooms
  • it should fill gaps very well, however, not sure how to handle the percentFilled param yet

Here is the general approach:

  1. Start with an initial randomly sized and placed room. Add 4 corridor points to a queue corresponding to the 4 sides.
  2. pop a sprout point off of the queue until there are none or the space is filled.
  3. find a space for a connected min sized + 2 room next to it.
  4. Determine a target size for that adjacent room. Grow that adjacent min-sized room until it reaches that target size +2 or hits a block (another room or corridor. Once one of those 2 things happens, backup by 2 cells to establish the new room dimensions.
  5. If a room was established, add 3 sprout points corresponding to 3 remaining sides to the queue. If a dimension is long, maybe add more than one connection point.
  6. If there is not even space for a min-sized room, depending on the connectivity thresh, create a corridor if possible.
  7. repeat from step 2 until nothing left in the queue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions