Procedural level creation.

I spent today creating a method for procedurally building the terrain in a game level.

The framework for procedural placement of various objects (e.g. trees) is started, but I won’t have time to finish implementing that today.

As usual I thought this would be easy, and as usual there were many obstacles to overcome.

Creating a level that had the maze-like properties is created with a cellular automata, which is simple, but took a couple of hours of tinkering to behave the way I wanted.

The walkable portion of the level created by a cellular automata is displayed in white.

The terrain is stored as a single channel 16 bit floating point texture, and the XBOX does not support blending in that format. So I do most of the terrain creation using the HdrBlendable format (which does support blending) for intermediate creation textures, and then copy the terrain heightmap before blending, and manually blend using a copy of the target texture. For each blended draw, you have to make a copy of the FP16 terrain heightmap.

In pseudo code:

For each set of terrain features/modifications to apply to the terrain heightmap:

Draw terrain heightmap to temp rendertarget.

Draw terrain features to HdrBlendable target.

Manually blend (in a pixel shader) the HdrBlendable target with the terrain heightmap.

 

Random spikiness bug.

This-game-turning-itself-into-minecraft bug.

After ironing out all the random bugs (which were related to losing a rendertarget by resolving at the wrong time, and wrong texture offsets), some progress is made:

 

A certain ability causes an explosion on top of the procedurally created terrain.

 

And with edges added to the walkable portion of the terrain:

Edges are added. They prevent objects (and the player) from falling off the edge of the map -- which results in death.

The repeating pattern you see in the distance will not be walkable.

 

Either I will make the walkable portion of the terrain float in space, or I will add water/lava to the ground. Floating terrain would take longer to implement than water, but would probably look better. There’s not much time left though, so I’ll have to leave that for later and decide closer to the competition deadline. Also I’m not 100% sure that floating terrain would look better anyway.

This entry was posted in DBP2011, XNA. Bookmark the permalink.

2 Responses to Procedural level creation.

  1. Pingback: Slope based terrain texturing. | Olhovsky

  2. csgo weapon says:

    Incredibly beneficial, look forth to coming back again

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>