Procedural Generation is quite a challenge. But I managed to get at least the room generator working over the past few weeks, it has a dynamic size adjustment and the room numbers are variable.
I am now trying to get corridor generation to work, it is... quite tricky to say the least.
I am trying to generate the corridors by getting a random position from within each room. I take the x value of one room and the y value of another to define a point. Using that point I want to draw a floor between the three points. Quite tricky indeed.
After a long hassle I finally managed to combine two pieces as seen above.
Here I have multiple rooms connected to a single room.
Now I have every room connected to a random other one. The worst that could happen is that room end up in two islands, so, I had to revise my method, a more organised, maybe less random one at that. I simply connect each number of the room toward their next one. Since rooms are already random that shouldn't make it far less random.
After some overlapping preventions in place it now looks quite tidy.