Download

Needing help with a procedural room system

Hey there,

i have a hard time getting my procedural room system planned.

What am i planning to do?

I want to have a gridlike system, so that we have a total mapsize of, for example, 32x32 tiles.
A tile would be something like 100x100 Units big.

A room can use multiple tiles and is premade.

I am planning to have an array for each room type with different versions of the rooms.
The rooms can be something like 3x3, 4x3, 4x4 etc. The corridors should be at aleast 1x2.
They can be straight, L, T and + form.

The biggest problem is:

I want to have an array of rooms that i want to have in the every generated map.

For the beginning this should be the Spawn and a Boss room.
The Spawn for this example is 2x3 and the Boss room is 4x4.

They are premade, so i will just spawn an actor that takes 2x3 or 4x4 tiles
and mark the tiles as used in an array. The two rooms have 1 door.

So if spawn them at the beginning (without any other rooms) i have the 2 doors that i need to
hit with the other corridors :/. If i only create the Spawn first and move from the door on, i would
need to know when to spawn the Boss room.

My last attempt was to just create the Spawn and create a corridor, then decide if we can build a room
now (enough space etc) or another corridor. Than take a random room or corridor that fits and move along.

But then i would need to know when i need to spawn the Boss room.

It look somewhat like this:

http://puu.sh/h2vWo/f578a3211c.png

That doesn’t work at all and i can’t get this figured out.

I want to tell the system that i need x amount of rooms 100% in my map, and then he spawns them
and filles the rest randomly.

The System from the stream works differently and is no use here, since he creates the rooms all from scratch
by spawning every wall, floor and door while creating the map. He can freely move the doors…

But i need the premade rooms.

Does someone have an idea? ):