I have nothing super valuable to add except to say: this is totally awesome. Good for you for exploring this and sharing it with the world. I just emailed it to 3 non-techy friends who will totally love it.
If you like making fiction maps by hand (but not fantasy maps) - have a look at this great mapping project: Open Geo Fiction: http://www.opengeofiction.net
From the about page: "This world is set in modern times, so it doesn't have orcs or elves, but rather power plants, motorways and housing projects. But also picturesque old towns, beautiful national parks and lonely beaches. "
It's essentially a fictional OpenStreetMap, and actually uses all the same stack as OSM, with all the data as Creative Commons Attribution-NonCommercial-ShareAlike
If you want to lose a few weeks hacking away at something kind of fun, then turn around and try to implement the Fortune's Algorithm[1] Voronoi region/Delauney Triangulation method that underlies Amit's map generator.
Somewhere I have a WinForms app I built a while back that animates the process and draws everything out step by step.
This is actually what I did in my first internship -- generating Delaunay triangulations (or more often, tetrahedralizations) of points, and then adjusting the underlying sets of points to help ensure that the corresponding Voronoi cells have good properties (generally reasonable surface area to volume ratios).
We didn't use Fortune's for historical reasons (the first versions of the code were in Fortran 77, and written well before he published his paper). Instead we generated triangulations and then flipped edges until they were Delaunay, and then used the corresponding Voronoi diagram. It turns out that flipping edges to produce a nicer triangulation is reasonable in two dimensions, but intractable in 3D and up.
The tricky task of label placement could be outsourced to a SAT solver.
The way it works is that for every city, town etc you generate a few placement candidates (4 positions around the point like you do seems fine) and then calculate all the pairs of placements that collide. For each collision you add a clause to a SAT formula that forbids this combination from occurring. Every solution of this formula will be a clean labeling of your map.
I think you underestimate how hard the original problem is. Small decisions can cascade and have effects very far away on the map. Also, in what exact sense do you mean convex?
Furthermore, SAT is hard in theory but the kind of very structured instances found in practice tend to respond well to heuristics.
Reminds me of a bit in one of Neal Stephenson's books where a MMORPG company hired a team of geologists to generate a geologically plausible map for their game. The hardest part of their job was finding ways to integrate the parts of the world that had been made up without any regard geology and made no sense in their model.
A cool part was one of the engineers complaining when a powerful user cast a spell that deformed the landscape. The whole world was a huge finite element simulation so that one spell cause CPU usage to spike as whole world had to be updated.
The book was fun, sort of a thriller, but I felt Stephenson could have done more exploring the world of the MMO game. A rare complaint for him.
Cast in another light, it was standard Stephenson fare -- the first half of the book explores a topic deeply and interestingly, then the second half basically sets it aside to trail off into some weird no-man's land. Seveneves was particularly obvious version of this issue.
I thought Seveneves was more like two "first half of Stephenson novels" smushed together; I found myself wishing there was more exploration of the "second" world. I thought the cultural evolution stuff was super interesting.
BTW, this is a quick way to generate an higher resolution map on the site. Open the developer tools, remove the width from .note (it's the container of the column), inspect the map at the bottom and set the height and width of the canvas to suit your needs. Then click on the Generate button.
Maybe the page could be changed to extract that canvas from the column layout and make it fit the viewport.
This belongs to the class of teleological algorithms and is very cool! I appreciate the links to some of the source material the author learned from... and the interactive elements on the page are great. I'd like to do the same for my blog.
I found this entire post to be completely awesome, but laughed in particular with this line: "I have a programmer's superstitions about always using powers of 2, which are more pleasing to the spirit of the machine." Also, I share similar fond memories of those maps from cheap, grocery store fantasy books!
Has that improved lately? I stopped reading it ages ago, when it was turning into /r/PhotosOfSplotchyWallpaper - lots and lots of low-effort pareidolia with no filtering (downvotes disabled IIRC).
I like it. If we assume that schlock fiction is objectively worse in some measurable way, then that suggests it should be easier to generate than works of high literature. I bet with some concerted effort, it would be possible to build an algorithm which digests a bunch of generic fantasy books and produces a tale of an unlikely group of heroes questing for the $object to turn the tide of $conflict.
That is super sweet. It looks sort of similar to how Dwarf Fortress generates its geographies.
You should look at how that game does it because it also involves creating a whole mythology and history to help generate civilizations and their fall/rise.
Cute. Usually this is done with fractals, as with VistaPro and its successors. You generate a coarse random height field, then subdivide, making smaller random changes locally, until you have all the detail you want.
An ambitious project: take in fantasy novels and extract location cues from them, then draw a map. Find text which mentions a place, then try to recognize phrases which express distance and direction.
Your post is really helpful. I recently tried to create procedural algorithms for medieval maps. I started with path-generation and circular city layouts.
It's great for creating your own world. However if you play D&D, chances are you play in Forgotten Realms. In that case you already have the large-scale map, and you want town- and city-scale maps.
This is insanely cool! I'm totally making a conversion of this into Elm my next pet project. One nice thing to see would be generation of terrain types (such as deserts or tundras) and the affect these have on the algorithms that place cities etc.
This is truly fantastic, both the project and the interaction. If you want to continue with it, it seems there's so much more you could do, too: roads, forests, altering namelists for different regions...
They didn't have automobiles, you know. b^) As I understand it, one of Tolkien's primary concerns was to resist the easy shortcuts of modernity, both in transportation and in thought.
mewo2, I am immensely grateful to you for devoting the time and energy to a task I've been meaning to undertake (and thus value), but have yet to find the time.
Your success is inspiring, and I've forked your repo(s) to try and continue your work. Thank you so much!
Keep making, keep sharing!