Wow, been a while since I posted something. I started fiddling with a Unity game project recently, and I wanted to come up with a way of cutting up space into rooms (so they kind of look like offices).
I had this idea that if I created walls that didn't intersect existing walls, and gave each one a door, all the rooms would be connected.
The results are decent, but the algorithm will probably work better with some pre-defined hallway patterns (so the room slicing only happens in the space around those hallways).
I also expiremented with a different way of storing wall information. Each cell of the wall array only stores information about wall segements that point Down or Right:
o--
|
00 = No walls
10 = Wall projected Down only
01 = Wall projected Right only
11 = Walls projected both Down and Right
Instead of really thick walls, like you'd see in a game like Minecraft, these are thin walls that are meant to encapsulate a grid.
Here's a simulation of how it works: