Mapgen1 with hexagons

 from Red Blob Games
15 Oct 2025

I wanted to procedurally generate a wilderness map on a hexagonal grid. I already have the ingredients for this: mapgen1[1], hexagonal grids[2], edge coordinates[3], but I haven’t put these ingredients together in this way before. I’ve implemented elevation painting in mapgen4 but this project has biome painting.

 

Source: mapgen1-hexagons.ts

Ingredients used so far:

  1. hexlib.js from https://www.redblobgames.com/grids/hexagons/implementation.html#codegen[4]
  2. hex grid from https://www.redblobgames.com/grids/hexagons/implementation.html#map-shapes[5]
  3. store attributes at each hex - KeyMap class from https://www.redblobgames.com/x/2226-roguelike-dev/[6]
  4. hex to x,y from hexToPixel() https://www.redblobgames.com/grids/hexagons/#hex-to-pixel[7]
  5. x,y to e,m from https://www.redblobgames.com/maps/terrain-from-noise/#demo[8]
  6. e,m to biome from https://www.redblobgames.com/maps/terrain-from-noise/#biomes[9]
  7. biome to color from https://www.redblobgames.com/maps/mapgen2/colormap.js[10]
  8. drawing each hex from https://www.redblobgames.com/maps/mapgen2/draw.js[11]
  9. make the maps into islands using https://www.redblobgames.com/maps/terrain-from-noise/#islands[12]
  10. click/drag handler https://www.redblobgames.com/making-of/draggable/examples.html#svg-painting[13]
  11. find hex to paint on https://www.redblobgames.com/grids/hexagons/#pixel-to-hex[14]

Ingredients for later:

  1. add icons for biomes from https://www.redblobgames.com/maps/mapgen2/map-icons.html[15]
  2. edge coordinates from https://www.redblobgames.com/grids/parts/#hexagon-coordinates[16]
  3. mark edges as coastlines, and draw them
  4. generate rivers, and draw them
  5. generate or paint roads, and draw them
  6. draw mountains on edges and corners, like autotiling
  7. have a function from elevation+latitude+season to temperature, and use temperature for the biomes (although it’s not really a biome if it varies by season?)
    • maybe biome is marked by a symbol and color is vegetation
    • grasslands are dry; plains are green (opposite of Civilization)

Email me , or comment here: