Voronoi stylized map generator

 from Red Blob Games
18 Sep 2016

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
flatten valleys
spread features
cell size

The current algorithm:

  1. start with perlin/simplex noise; this is controlled with the “wavelength” slider
  2. 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
  3. 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
  4. sharpen the transition from valley to mountain; this is controlled with the “mountain scale” slider
  5. divide the world into voronoi cells and assign a terrain type to each cell; this is controlled with the “cell size” slider
  6. 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[1] 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.

Update: [2017] I implemented this in the html5 version of mapgen2[2], using these icons I drew by hand[3]. It’s surprisingly easy, if you already have a Voronoi-based map: draw one icon in each Voronoi cell! (optional: vary the size based on the cell size)

Email me , or tweet @redblobgames, or comment: