Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DungeonExplorer: organic generator strategy #31

Open
barrybecker4 opened this issue Jan 5, 2022 · 1 comment
Open

DungeonExplorer: organic generator strategy #31

barrybecker4 opened this issue Jan 5, 2022 · 1 comment

Comments

@barrybecker4
Copy link
Member

barrybecker4 commented Jan 5, 2022

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.
@barrybecker4
Copy link
Member Author

Initial implementation done.
Still things to do:

  • maybe expand until max size reached
  • add more corridors if high connectivity
  • don't draw rooms sometimes if percentFilled low
  • limit aspect ratio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant