Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Generating fantasy maps – an interactive exploration (mewo2.com)
1004 points by mewo2 on Aug 10, 2016 | hide | past | favorite | 64 comments

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.

Keep making, keep sharing!

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

I was just randomly zooming in and found a city called Auflington (http://www.opengeofiction.net/node/19913404) --- that's a work of art!!

Update: And there are so many like that --- incredibly detailed, ordered and organic!

Wow! I was looking for exactly this a few weeks ago for a story I'm writing. Don't know how I never came across this. Thank you so much.

Thanks! Didn't know about that one.

Your http://mewo2.com/notes/naming-language is equally interesting, great work!

my desire to tweet this article and have my followers click on it led me to write a forwarder: https://medium.com/@kevinkimball/building-a-tiny-node-app-to...

This is great. it can be applied to the startup world for new company names.

Very cool! This reminds me of Amit P's polygonal map generation project, which you should look at if you're interested in this kind of stuff. http://www-cs-students.stanford.edu/~amitp/game-programming/...

The OP actually cites that project as the method they use for initial polygon generation, and tells everyone to go read it.

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.

[1] https://en.wikipedia.org/wiki/Fortune%27s_algorithm

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.

He's done great projects. http://www.redblobgames.com - he writes here too.

Wanted to post this too. That guy is brilliant, and so is OP. I love this stuff.

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.

That seems like a way of changing a nice, convex problem into a much harder to solve NP-complete problem...

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.

Reamde was the book if any are interested.

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.

If I had this as a kid I would have buried myself in the basement playing D&D for the rest of my life.

For an RPG you can simply take anything from his Twitter bot https://twitter.com/unchartedatlas :)

Well done, thanks!

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.

He gives you his source on github. I think that's enough right there.


Oooo and it's MIT...

This is such a great tool for hobby world designers. I know for sure that I will use this when I create adventures.

I made multiple tools for random world generation but never come close to this kind of quality. I'm impressed!

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.

Nice work!

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!

This is really cool. I'm going to bookmark this and look in to it more in-depth. I've always wondered about how to generate maps for a game. Good job.

reddit.com/r/worldbuilding is an excellent community for such things as well

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).

And don't get me started on the rivers...

didn't know about that one, so thanks for the link! There's also a pcg subreddit, which might be of interest:


If the novels were as bad as he says they were, maybe he can crank out some random(ly bad) prose to go with it, and get Amazon-rich.

(And/or, this might make an interesting companion project.)

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.

For generating the epic campfire poems: http://dmatoso.com/manowar-lyrics-generator/

What's the best long-form text generator that can produce something beyond your average CompSci Markov chain results?

You might not need to pass the Turing test, but even getting the "Eye of Argon" out of something random would be pretty impressive.

You can't sell hair metal fantasy any more unless you happen to be named "George R. R. Martin".

Would be neat to give it real topo maps and then have it generate the towns and see how well it matches reality. Great work!

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.

Here is my try on paths generation: http://imgur.com/CUs6P4S

If you like pcg maps, have a giggle at my pirate-themed maps and the awful js code behind it.


This is an amazing use of Python. I'm OK with .py but terrible with images so this random generation amazes me. I will be passing this into my DM!

Now I want to make a vector rogue-like with Tolkien-ish world maps...

The "improved" blue noise random points at the start would probably be more efficiently generated with Poisson disc sampling.


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.

Does anyone have a nice pointer toward those?

very cool. tried to see if it could make sense of islands and such, and the results are extremely convincing: https://i.imgur.com/LXNtZLH.png

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.

Will definitely share if I manage it

Wow. I might need to spend some time making a clone of this but geared towards worldmaps like https://donjon.bin.sh/fantasy/world/

Or I could just visit a random planet in No Mans Sky and use that as my model.

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...

Sierra Nevada. So basically completely limited access highway with no at grade crossings or notable traffic. Not exactly stressing the system there.

Even as a child, I found Tolkien's maps of Middle Earth geographically implausible, in terms of river flows and mountain placement.

I only really had a problem with the convenient 'box' of mountains around Mordor.

Well, that and the fact that everything was so far apart that the main trilogy spent more pages talking about walking than talking about events :D

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.

He also just really liked writing about landscapes.

I too, like the author, often was more interested in the topography and maps of fantasy stories. This is awesome!

That's really cool, now just let the community create stories around these maps. Great work!

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!

This is amazing! This motivates me to do so many things... alas, none related to my day job.

This is very neat, I hope I will have time to dig into this at some later date. Great job!

Everything looks great except the rendering of the mountains.

Well done. I need to explore this later but well-done

This is sooo cool! Thanks for sharing!!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact