I used BSP algorithm to split my map into subsections. Each subsections has 1 room inside.
I cant figure out how to connect all these rooms. Currently i have randomly selected rooms and then hallway made between them, but this creates a problem where there can be 3 or more halls side by side and halls that connect 2 rooms goes through other rooms.
I removed some of the repetition by checking current connections between rooms, but this doesent solve all the problems.(only 1 level deep, if i go deeper i get stack overflow)
http://tinypic.com/r/jhq7tg/8 current output. Some boxes are hard to see because colors are also randomly generated.
I found another solution for the problem. But i think i have gotten something wrong.
I wrote a code that just goes over the hallway vector and removes any vector where 2 are next to each other, shorter one will be removed. But now i get unreachable rooms.
I think i have gotten something wrong or some idea wrong.
X1 and Y1 is hte starting point and X2 and Y2 is the ending point of a hall.
If i need a 90degree hall i just crate 2 halls one horisontal, 1 vertical.