forums | blogs | polls | tutorials | downloads | rules | help

Map generator with Perlin heightmap

I've been playing with map-generating again recently - this time I wanted to not just produce flat squares of terrain but mountainous terrain from a Perlin-generated heightmap. This not only looks prettier and more interesting, it also provides the important benefit that only a fraction of the map is accessible, generating long linear paths that loop around mountains and valleys and connect to each other.

The idea developed together with the idea of a Green Range map. I made two forum topics tho to keep discussion separate.

So here's what I have so far:
- Generating terrain: only the default 4x4 nodes of floor, wall and corner pieces for 4m, 8m and 12m height
Fitting nodes onto a heightmap is imperfect as not for all situations there's a fitting node. The algo retries a few times but eventually gives up; the user has to fix these spots themselves.
- Cutoff nodes above/below certain heights
- Region tiling, where the generated map is separated into several regions in a grid, incl. automatic stitching
- Generating plants based on a profile file and another perlin distribution, like the old map generator also featured. For now on floor nodes only
- A system where you define larger areas where different plant profile files are applied
- Generating enemies; these are distributed based on even more perlin, making it possible to define different sets of enemies that get placed randomly in separated areas. It also considers the plant perlins, such that you can place animals more among the trees and Krugs more in the clearings

Here's where the algo wasn't able to find a fitting node:

Here's a perlin heightmap visualized (white = high value = mountain, black = low value = valley, gray = walkable middle area) and the resulting region:

And here's a picture of larger floor area to show off plant distribution:

Green Range map discussion: https://siegetheday.org/?q=node/7327
My old map generator: https://siegetheday.org/?q=node/7241
Code: https://github.com/foerstj/gaspy