DevLog #2: Map Building & Variation

After the previous devlog we actually have to step back for a moment – while the units and decoration make up a lot of the visual appeal of Flatlings there would be nowhere to go for them without a proper world map, wouldn’t it?

In the game’s current state the map is based on perlin noise generation (there are tons of tutorials already covering this so I won’t go into the basic details here.) While there are more advanced techniques like wave function collapse, this tried and tested method is fine for general purposes.

Perlin Noise Map example generated using PerlinNoiseMaker

Converting the individual greyscale values of a perlin noise map to float values between 0f (completely black) and 1f (fully white) allows you to map certain terrain types to these values – very low values should obviously be water tiles, whereas a value around 0.5f might be a patch of grass. Admittedly it does not produce realistic or interesting landscapes on its own but you can add some more variation to it of course.

In Flatlings I am using a list to which I can add terrain types and set their range in the Inspector. For each point in the noise map the map generator then looks up which terrain types are theoretically possible for that point’s particular value.

The standard terrain configuration of Flatlings (Oct 2022)

This approach allows for two neat possibilities.

  • Terrain Types can be included more than once at different height levels. If you want the game to create random lakes in an otherwise forest-centric area you could add the Sea type and put its range inbetween the forest types.
  • Ranges can overlap which will break up otherwise straight borders between terrain types. In the above lake example you wouldn’t need to set up two different forest type entries – instead you could set the range of the new Sea type to sit inbetween the forest’s minimum and maximum value.

On top of that it’s easily possible to create more than one configuration and have the player pick one during game setup. Want to unleash your inner Kevin Costner and conquer a mostly flooded part of the world? Just create another preset to plug into the world map generator!

It’s a lot cheaper, too.

For ranges not covered by any terrain type a standard type has been set in the map generator.

And if you are still unhappy with the results you can always load an existing heightmap to use. 🙂

Ingame map of the British Isles; fog and rain not included

Leave a Comment