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:
Start with an initial randomly sized and placed room. Add 4 corridor points to a queue corresponding to the 4 sides.
pop a sprout point off of the queue until there are none or the space is filled.
find a space for a connected min sized + 2 room next to it.
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.
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.
If there is not even space for a min-sized room, depending on the connectivity thresh, create a corridor if possible.
repeat from step 2 until nothing left in the queue.
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:
Here is the general approach: