Jorge Hurtado

Game Developer

Artificial Intelligence

Unity

C#

UE4

Machine Learning

Jorge Hurtado

Game Developer

Artificial Intelligence

Unity

C#

UE4

Machine Learning

Blog Post

Procedural Level Generation – Part 1

Procedural Level Generation – Part 1

I am really excited to write the first of what will be a series of blog post that will show the progress of my new Project.

I am really excited to write the first of what will be a series of blog post that will show the progress of my new Project.

Today I will show how the generation of the Levels are done.

For the generation of any level we need to follow the next steps: In the first step we need to add different rooms and halls, next step will be adding the walls and make sure that all rooms are connected with a door, in the last step the furniture will be added.

Generation of rooms:

At the moment I started thinking how my levels would look, I searched different ways to approach to the problem. I choose Binary space partition, using a predefined size we will divide the space in different rooms and halls.

Dividing the space:

  • Divide the space in different chunks of rooms with halls (One or two nodes of width) until the chunks are small enough. Slice in vertical and horizontal the space.
  • Split the chunks of rooms in different rooms until they are small enough while you leave some bigger rooms.

Using binary space partition in spaces like the following one are really easy to divide and they look great.

Once I had the rooms and halls generated the next step is to make sure that all the rooms are connected to a hall or an reachable room.

Connecting rooms:

Starting with a list of unreachable rooms and a list of reachable rooms, we add to the second list the halls that we have. (We want to connect all rooms to the halls.

While the unreachable list is not empty we check if each room is connected to a reachable room, if the room is connected we create a door in between and move from one list to the other. This is a quick solution for the problem, in the next post we will check a safer solution.

Continue to part 2->

Taggs:
Write a comment