Procedural Content

Discussion in 'Public Game Developers Forum' started by Aztlan.Games, Jul 21, 2011.

  1. Aztlan.Games

    Aztlan.Games Well-Known Member

    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:

    Code:
    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:
    Code:
    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:
    [​IMG]

    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:
    [​IMG]

    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:
    [​IMG]

    In the game it looks like this:


    So, what do you think about procedurally generated content?
     
  2. ImStrapped

    ImStrapped Well-Known Member

    Mar 1, 2011
    463
    0
    0
    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.
     
  3. awongulous

    awongulous New Member

    Jul 21, 2011
    1
    0
    0
    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.)
     
  4. Charybdis

    Charybdis Well-Known Member

    Apr 2, 2011
    281
    1
    0
    Programmer
    Kyoto, Japan
    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.
     
  5. GlennX

    GlennX Well-Known Member

    May 10, 2009
    761
    0
    0
    UK
    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.
     
  6. Aztlan.Games

    Aztlan.Games Well-Known Member

    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!
     

Share This Page