★ TouchArcade needs your help. Click here to support us on Patreon.

Procedural Content

07-21-2011, 10:47 AM
Joined: Dec 2010
Location: Germany
Posts: 159
Procedural Content

Hi everybody,

I would like to get your comments and feedback on procedural content. There are a couple of titles in the App Store, which work extremely well without levels created by a level-designer. Some of you might know that Tiny Wings is for the greater part procedurally generated, which contributes to the high replayability, because every level is unique. And I think that Doodle Jump relies a lot on precedurally generated levels.

Thinking back to developing my last game, I remember painstakingly and painfully creating 45 levels by hand. This somehow influenced my decision a lot to have a look at procedurally generated levels for my next game. For Vermes on Mars I decided to give it a try and take a portion of the time I would have spent on level design and invest it in coming up with a good mechanism for generating levels automatically.

Procedural generation has a couple of advantages and disadvantages. If you come up with a good method you save a lot of time. This is especially crucial if you do not have that much manpower as it is the case with a lot of indie developers like myself. Procedural generation, once implemented, gives you a powerful tool to quickly generate a huge number of levels.

For me, procedural generation saved indeed a lot of time and provided a lot of fruitful ideas and insights.

In the following, I will give a brief explanation on how levels are generated in our upcoming title Vermes on Mars.

In Vermes on Mars each level is a 2d Martian landscape. Generating such a level has several phases:
1. calculating a very low-res representation of the map
2. increasing granularity by resizing and blurring, which will yield a heightmap, and
3. using the heightmap to compute a very big terrain texture.

Calculating the low-res representation is as follows. A starting width and height is calculated, both are random values. For example width = 10 and
height = 9. The representation is represented by a 10x9 matrix. For each cell in that matrix I then randomly assign a value. Either the cell is an obstacle or it is not. This could look like this:

Each O is an obstacle, each . is free space. After that I apply a cellular automaton on the matrix, which would than reorganize and create islands. The result would be this:
Now there is plenty of open space in the center of the map. For bigger matrices the result would have been more complex.

In the next step create a heightmap from the matrix by resizing and blurring. This would yield:

The brighter a pixel the higher the terrain is at that position. White areas are obstacles.

Now I only have to map the heights to colored pixels. I use this lookup-texture:

For the white pixels I use the dark brown patch, for the black pixels I use the yellow patch, and everything in between is smoothly interpolated. The outcome is:

In the game it looks like this:

So, what do you think about procedurally generated content?

Developer of Multipods Escalation and Vermes on Mars. Upcoming game is Tesla Overdrive.
Follow me at Twitter and visit our homepage.
07-21-2011, 01:05 PM
Joined: Mar 2011
Posts: 463
Hm, one thing I don't like about procedural content is the lack of customization and design that can go into it however, I really like your approach here, I think you've done a great job at using procedural content to great a game I'd never guess was auto-generated. Very creative.

Twitter: @PeterBabiy
Site: www.strappedtoameteor.com
Games: Go Go Giraffe | DEO | Mr. Dreamer
07-21-2011, 02:13 PM
Joined: Jul 2011
Posts: 1
I've been reading up a lot on Procedural Content and found it pretty interesting when I saw Lost Gardens was using it with their maps. I have yet to integrate something that sophisticated but I am trying to create some random segments in my next game. (Similar to Canabalt.)
07-21-2011, 06:01 PM
Joined: Apr 2011
Location: Kyoto, Japan
Posts: 281
Here is my view on the subject:
I am a huge fan of procedural content. And I want to use it a lot.
However, the choice of whether on not to use it depends on the situation.
My latest game 'BlibBlob', is a platformer, and the level design is a very important part of the fun. It requires creativity and subtle tweaking. I dont believe I could write a function to do that.
However, procedural content has the benefit that each level can be stored as nothing more than a handful of random seeds, or can be arbitrarirly long.
So, in conclusion, I will use procedural content as much as I can but I know that occasionally I will have to resort to map editors.

Game source code for PC, Mac, Linux and iOS here.
07-21-2011, 06:38 PM
Joined: May 2009
Location: UK
Posts: 761
It is possible to do a bit of both. The levels in my first iOS game, Ground Effect, are fractal islands which then have the spline based road blended with them.
This screenshot shows the editor.The levels is completely fractal with the red/green/yellow/black line the only edited part, the colours denote how the spline is blended with the fractal at any point. Ground Effect levels are a 512x512 floating point heightmap but only take a few thousand bytes each on disc.

-=< Fat Owl With A Jetpack >=-
-=< Topia World Builder >=-
-=< Twitter >=-
-=< Blog >=-
07-22-2011, 10:58 AM
Joined: Dec 2010
Location: Germany
Posts: 159
I think there are a couple of cases, where procedural content would be aweful. In other cases procedural content would be awesome. In the rest, hybrid strategies would work fine.

GleenX, I like your editor! Generating landscapes is a huge thing when it comes to procedural generation. People did a lot of work there!

Developer of Multipods Escalation and Vermes on Mars. Upcoming game is Tesla Overdrive.
Follow me at Twitter and visit our homepage.