Extraction: Map generation

Extraction - Map IconThis is the second post in my game design series. Last time I gave an overview of the game and its goals. Making the framework and playing with the AI were the main objectives, but first we’ll take a quick detour into the map generation system.

Let’s start by reminding ourselves what noise-generation algorithm spits out…

Extraction - Map

It ain’t Perlin, but it does the job

In Extraction a map is a simple 2-dimensional array of terrain types, which currently can be ground, rock or wall (black, grey and white in the image above). There’s no mechanical difference between rock and wall currently, just a visual one, leaving the map essentially a binary collection of locations than can be occupied or not.

There are two stages to the generation process; first the Perlin* noise algorithm creates a 2-dimensional array of floating point values between 0 and 1. Then this is fed through a threshold filter to map the noise values to terrain types.

I won’t go into the specifics of the noise generator here – for that, see the excellent tutorial and sample code that I used. The noise generator takes three parameters – width, height and number of octaves. The octaves determines how ‘noisy’ the resultant noise map is. The lower the value the more it looks like static, and the higher the value the more is tends to a single dominant value.

Let’s take a look:

Extraction - Octaves

(a) Low octaves, (b) Medium octaves, (c) High octaves

The other available configuration option is in the noise-to-terrain conversion thresholds:

Extraction - Thresholds

(a) Low threshold, (b) Medium threshold, (c) High threshold

By combining these two factors into map configurations we can randomly generate maps that follow a set of loose forms:

Extraction - Map Types

(a) Mazy, (b) Open, (c) Caverns

The type of map has a significant effect on the tactics needed. A maze-like map with few open spaces will require a lot of relocating and path clearance, which takes longer but is balanced by the fact that zombies will take longer to find survivors, and may even be contained within closed-off areas. A more open map becomes a game of choosing the best landing site and racing to pull in as many survivors as possible before the zombies swarm.

Next time we’ll look into the AI controlling the survivors and the zombies, and how simple rules lead to emergent behaviour. It’s hardly going to shake up the world of artificial intelligence or anything, but it’s fun to play with.

* Not Perlin

Leave a Reply

Post Navigation