New Series – Procedural Cities!

Now that I have the basic game structure in place, the next fun challenge that I have is to figure out how to generate the environments for the game.

Now, being a single-dev type project (combined with the fact that I’m super lazy at best), the trick to creating enough content to be interesting for a full game is that I’m going to have to rely on procedural content as much as possible.

What is Procedural Content?

The term ‘procedural’ has a ton of baggage associated with it. Games like No Mans Sky and many others have gotten flak after launch due to confusion about what and how the team / game is applying the concept of procedural content in their particular use case.

Now, what do I mean?  In my particular case, I have a library of content that I have licensed from a variety of sources – 3d models, props, etc), and I want to be able to create unique combinations of the assets so that players are presented with unique locations and environments as they explore the game world.

This is a slightly different ‘definition’ of procedural content than some games use – for some games, they are generating literally every asset procedurally – building dynamic meshes, UV’s etc on the fly. There are some amazing examples of this, but is also much lower-level than I want to go.

The way I like to define what I am trying to accomplish is ‘artist-directed procedural content’. So the main elements of the world are created and directed by an artist, but the overall composition of the world or level is procedural.

You can also look at a typical game level in layers or slices, where each slice can have a variety of procedural elements.

For example, an RPG that has randomized loot drops is using procedural content, even if the loot drop locations are the same every time. You could add a second layer of procedural-ness to this by randomizing the placement of the loot boxes in a location – so the placement of chests / lock boxes etc are different each time you play.

The next level up you could randomize which room is placed where in a location – so instead of a single static layout of 4 rooms (living room, bedroom, kitchen, bathroom), you pick from a list of ‘potential’ rooms and then create the layout from that. Even if you have the same 4 rooms listed above, you could randomize the ‘order’ or location of each (as an example), and so on.

A great example of how you can apply a layer of procedural content to your game is the Payday series. The designers wanted to have a set number of maps, but be able to randomize the placement of a variety of elements within the world.

Another great example that was released recently is GTFO – coincidentally created by the same designer as Payday (and a few other ex-Payday devs). GTFO not only randomizes the placement of Loot drops within a level, but also randomizes the placement of elements WITHIN a given room, and then procedurally creates the entire map itself. The random map element isn’t really exposed to the players in the game, as each time you play a given map the basic map structure is the same, but when they are creating a new ‘Rundown’ for the game, the map itself is randomly generated (and then playtested to make sure that it makes sense and is fun).

Getting Started

So, where do we get started creating procedural content for our game?

There are a number of excellent tutorial series on the web that cover procedural generation in Unity:

GameDev Academy has a great series

and the Unity Learn site has a super cool series on Procedural Cave Generation:

In my case, the procedural nature of the environments for my game can be broken into 3 basic layers

  1. Random Loot

  2. Randomized Prop Placement

  3. Random City layout

I’m going to start with the second point – Randomized Prop placement, as this is the core of the entire system.  In the next part of this series, I’ll describe how I created the random prop system and why this is the backbone of the entire procedural system.