Procedural maps in Spy DNA Pt. 2: A peek under the hood

by Jason Sams, Lead Developer

I wanted to talk a bit about how we’re generating mission maps. A few days ago, Alex showed some of the visual results, and now I’m going to share some details on how we generate those maps.

In the past we would generate a map when loading it. This meant that if you took a mission at the base, saved the game, and then went on the mission, you might see a different map if you reloaded your game and tried the mission again. With the new code the map is fully generated up-front, so if you want to replay a mission, the map will not change when you reload. This was also an important step as we work towards supporting saving mid-mission.

Several things need to happen when generating a new map. Anyone who wants to create a custom mission for Spy DNA will want to understand how we do this in order to be able to create a map description in the mission editor that fits the scenario they had in mind.

1: We start by generating the terrain height map based on the size of the map, the amount of hills specified, and the roughness of the map

Mission editor “Map” tab has all the options needed to generate the mission map

2: We place the main roads (if any) based on the map settings

3: We divide the map up into blocks. The size of the blocks depends on the setting (Ex: Urban, Suburban, etc)

4: We place the locations specified in the mission. These may require placement of buildings or other items. If buildings are placed, the blocks in which they are placed will be zoned (commercial, residential, industrial) to match the type of buildings being placed.

Mission editor “Gameplay” tab has all the elements of the mission, such as NPCs, key locations, and objectives

5: We fill in the map with “decor” buildings. They provide cover, hiding places, and also enhance the overall look of the map

6: Secondary roads are added

Debug snapshot of a map in process of being generated, with roads placed and plots zoned

7: Map decor is added. These are things such as trees, grass, street signs, and other things you expect to see in the setting

At this point, steps 1-5 in the map generation are fully implemented. Step 7 is also partially done, and we will be adding the decor you expect to see along roads soon.

At this point the maps are complete for going to early access. The cosmetic Steps 6 and 7 will be refined during the early access period.

The next update will talk about the progress we are making with AI and dealing with larger numbers of NPCs on the map. Thanks for reading.