Aztlan.Games
07-21-2011, 10:47 AM
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 (http://forums.toucharcade.com/showthread.php?t=100850) 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:
O.O.O.OOOO
.O.OOO.OOO
.OO.O.OO.O
O.O.OO.OO.
..OO.OO.O.
O.O.O.O.OO
O.OO.O.O..
.O.OOO.OOO
.OO.O.O.O.
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:
OOOOOOOOOO
OOOOOO.OOO
OO......OO
OO......OO
OO.....OOO
OO.....OOO
OO...O.OOO
OOOOOOOOOO
OOOOOOOOOO
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:
http://www.aztlangames.com/wp-content/uploads/2011/07/Heightmap.png
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:
http://www.aztlangames.com/wp-content/uploads/2011/07/Tiles01.png
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:
http://www.aztlangames.com/wp-content/uploads/2011/07/Texture.png
In the game it looks like this:
0ydQrfyFUxs
So, what do you think about procedurally generated content?
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 (http://forums.toucharcade.com/showthread.php?t=100850) 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:
O.O.O.OOOO
.O.OOO.OOO
.OO.O.OO.O
O.O.OO.OO.
..OO.OO.O.
O.O.O.O.OO
O.OO.O.O..
.O.OOO.OOO
.OO.O.O.O.
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:
OOOOOOOOOO
OOOOOO.OOO
OO......OO
OO......OO
OO.....OOO
OO.....OOO
OO...O.OOO
OOOOOOOOOO
OOOOOOOOOO
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:
http://www.aztlangames.com/wp-content/uploads/2011/07/Heightmap.png
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:
http://www.aztlangames.com/wp-content/uploads/2011/07/Tiles01.png
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:
http://www.aztlangames.com/wp-content/uploads/2011/07/Texture.png
In the game it looks like this:
0ydQrfyFUxs
So, what do you think about procedurally generated content?