My roguelike generates a number of circular rooms. I quite like the current results, which look something like this:
It's generated by carving out random circles in a filled space.
I have one main problem with it: several circles are completely unconnected. I cna't quite figure out what algorithm to use to connect them.
I tried "for each circle, find the nearest circle, and tunnel to its center (horizontally then vertically)," but I get something horrible instead (same map as above):
What seems to be the right fit is something like "for each self-enclosed space, find the nearest empty space and tunnel to it." That seems complexity-hard though (for each circular enclosed space, compute the distance to every other space) and will probably be slow (running on Ruby too)
Is there a simple solution to this problem?