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:
- hexlib.js from https://www.redblobgames.com/grids/hexagons/implementation.html#codegen[4]
- hex grid from https://www.redblobgames.com/grids/hexagons/implementation.html#map-shapes[5]
- store attributes at each hex - KeyMap class from https://www.redblobgames.com/x/2226-roguelike-dev/[6]
- hex to x,y from hexToPixel() https://www.redblobgames.com/grids/hexagons/#hex-to-pixel[7]
- x,y to e,m from https://www.redblobgames.com/maps/terrain-from-noise/#demo[8]
- e,m to biome from https://www.redblobgames.com/maps/terrain-from-noise/#biomes[9]
- biome to color from https://www.redblobgames.com/maps/mapgen2/colormap.js[10]
- drawing each hex from https://www.redblobgames.com/maps/mapgen2/draw.js[11]
- make the maps into islands using https://www.redblobgames.com/maps/terrain-from-noise/#islands[12]
- click/drag handler https://www.redblobgames.com/making-of/draggable/examples.html#svg-painting[13]
- find hex to paint on https://www.redblobgames.com/grids/hexagons/#pixel-to-hex[14]
Ingredients for later:
- add icons for biomes from https://www.redblobgames.com/maps/mapgen2/map-icons.html[15]
- edge coordinates from https://www.redblobgames.com/grids/parts/#hexagon-coordinates[16]
- mark edges as coastlines, and draw them
- generate rivers, and draw them
- generate or paint roads, and draw them
- draw mountains on edges and corners, like autotiling
- 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)