For one project, we wanted a PvP strategy map with open areas for both teams to build in, mountains on the east and west edges, mountains in the middle, and one or more mountain passes connecting the two sides of the map. Separately, I wanted to try a very simple stylized map renderer (toggle the “stylized” option).
This is a quick & dirty exploration project and not a polished tutorial. It’s a bit slow; I haven’t spent the time to optimize the code.
mountain_scale sharpens slopes
The current algorithm:
- start with perlin/simplex noise; this is controlled with the “wavelength” slider
- stretch the y coordinate out so that on the west or east edges, the perlin noise has a longer wavelength (larger features) and in the middle it has a shorter wavelength (smaller features); this is controlled with the “spread features” slider
- use the x coordinate to add elevation if it’s near the west edge, middle, or east edge, or subtract elevation if it’s in the west team or east team’s buildable area; this is controlled with the “flatten valleys” slider
- sharpen the transition from valley to mountain; this is controlled with the “mountain scale” slider
- divide the world into voronoi cells and assign a terrain type to each cell; this is controlled with the “cell size” slider
- if “stylized” is not selected, fill each cell with a solid color, or, if “stylized” is selected, draw a simple icon in each cell
I think there’s something interesting here for the map generator, and there’s definitely something appealing about the stylized renderer, which I could apply to some of my other map generators. The stylized renderer is something I’ve wanted to try ever since my polygon map generator project back in 2010. It was much easier to implemented than I expected, as all I did was draw an icon in each voronoi cell! The size of the icon depends on the size of the polygon.