# Random room placement?

I have been playing around with the idea or making a horror game for a while now, and after watching a few tutorials I decided I want to do it on BGE (mostly because I am familiar with blender) I already made some of the character models and figured out some of the mechanics, but I ran into a sang…

The game revolves around the player running around a creepy house trying to survive until the night ends (there are a total of 7 nights). However to increases the replay value I want the house to be randomly generated each night so each play through is different…. Well maybe “generated” is the wrong word. More like randomly placed.

I am making this distinction because randomly generated is typically procedurally generated rooms and corridors to make a dungeon. I don’t want it to make the rooms, I want it to place the ones I already made.

My idea is I will have 20+ premade rooms of varying sizes and door placement that will be randomly arranged onto a three 10 by 10 grids stacked to create a new layout for each phase, or night. (The house is three storys high, so it would looks something like this http://gyazo.com/9e90d5ff61848a647a29707579a70a3e )

The way the computer would figure out what room to place where is determined by how much space is available and the location of unconnected doors… gaaa let me show you an example of what I am thinking xD

So here is a sample grid, and on this sample grid you can see there is already two rooms placed and there are two doors leading to nowhere.

There is a 3 by 3 space available adjacent to the open doors

So the computer picks a room that would not only fit in that space, but has the correct door placement to put there….

Is this making any sense? xD

A different option would be if the problem cannot be solved with one room, it would use two.

Another thing I would have to put in is some sort of code to prevent the placement of doors leading off the edge of the grid, and at least two 2 story “stair room” to be placed on each level so that you can go up and down. And though this is not a priority I would like some way to prevent rooms with windows spawning right next to another rooms wall.

I got a basic idea of HOW I want to do this, but have no idea how to code it and I am pretty sure you can’t do this with logic bricks…

So do you guys have any advice? Maybe some tutorials or something? xD
I am kinda grasping at straws here ;-;

Smoking_mirror has been working on this.