I've been posting on Twitter but was reminded that I should be posting more to my blog. I don't want Twitter to be the only place to read about what I'm doing.

Back in 2010 I had written an influential article about map generation, making maps specifically designed for one game. I made a Flash demo called mapgen2. At the time I didn't emphasize enough how each of the layers of the process could be different. Many people took the recipe as the way to do it, even though the recipe was specifically for the needs of that one game. In mapgen2 the rivers depended on elevation which depended on coastlines. But it could've been coastlines depended on elevation which depended on rivers. There are lots of different ways to glue the pieces together. In 2017, I wanted to go back and try a different recipe with the same ingredients (Voronoi, elevation, rivers, biomes, etc.). For a while I thought the new project, mapgen4, will do all the things! I experimented with lots of things but the task seemed overwhelming. I decided to step back and limit my scope. I rebuilt the same algorithms with the new framework (HTML5, and more efficient data structures), and launched that as an HTML5 version of mapgen2. Then I put everything on hold.

Five months later, in part inspired by the fantastic procedural map generation work of Scott Turner and Azgaar, I decided I should take another look at my unfinished map projects. I had found lots of cool things during my experiments, and it would be a shame to not use any of them. I made a list of the experiments and decided to drop many of them to limit my scope:

Ok, that looks like I already have 90% of the work done. But of course, the last 10% takes 90% of the time! The big areas are performance and map quality. The map generation and rendering code from last year is taking 5500ms. I want to be able to change parameters, or draw constraints, and see results right away. So I need to somehow get this down to 100ms. So there is a lot of work to do.

point selection

poisson disc is too slow and also was too obvious in output

jittered grid is fast and less obvious in output, but has artifacts if you jitter too much

For map quality, I had to change direction. Last year's goal was to make interesting maps for a game with specific gameplay needs. But that game was cancelled, and its gameplay needs are no longer relevant. Now my goal is to make good looking maps. Beyond that, I want to make "cartoon" maps like people might draw by hand. Take a look at the Lord of the Rings map or the Game of Thrones map or all the maps on @mythicmaps or /r/FantasyMaps. See how they have mountains, hills, forests, rivers, lakes, and towns, but they don't look like a typical Perlin Noise or Midpoint Displacement procedurally generated map! There's a lot of simplification to emphasize the important features, at the expense of realism.

river flow should depend on biomes (as opposed to mapgen2 where biomes depended on the rivers)

handle local minima and rivers

mapgen2 constructed elevations to have no local minima but mapgen4 doesn't

canyons: lower elevation of downstream rivers to make sure they always flow downhill

filling: raise elevation of upstream rivers to make sure they always flow downhill

There's even more. I don't know that the system I have now will work well for the user-drawn constraints. Parts of it were designed for mapgen2, not mapgen4. That's the next thing I need to test. I don't know that it will be fast enough; I should try webworkers. I also need to build a UI. And after I finish all of this, I want to write an interactive tutorial that explains all of these algorithms. So much to do!

If you want to see 100MB of images I've saved over the past few weeks, I put them here.

I hope to finish the map generator in a month, and then I can start on the tutorial.