
Show HN: Generating fantasy maps – an interactive exploration - mewo2
http://mewo2.com/notes/terrain/
======
aarondf
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!

------
chippy
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](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

~~~
critiqjo
I was just randomly zooming in and found a city called Auflington
([http://www.opengeofiction.net/node/19913404](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!

------
caio1982
Your [http://mewo2.com/notes/naming-language](http://mewo2.com/notes/naming-
language) is equally interesting, great work!

~~~
kevinkimball
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...](https://medium.com/@kevinkimball/building-a-tiny-node-app-to-add-
twitter-cards-to-your-links-56007491ee92)

------
loeber
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/...](http://www-cs-
students.stanford.edu/~amitp/game-programming/polygon-map-generation/)

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

~~~
douche
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](https://en.wikipedia.org/wiki/Fortune%27s_algorithm)

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

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

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

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

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

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

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

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

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

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

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

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

EDIT -

Oooo and it's MIT...

------
abelhabel
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!

------
agentultra
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!

------
fapjacks
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!

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

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

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

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

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

~~~
Jormis
For generating the epic campfire poems: [http://dmatoso.com/manowar-lyrics-
generator/](http://dmatoso.com/manowar-lyrics-generator/)

------
stephenmm
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!

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

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

------
yousry
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](http://imgur.com/CUs6P4S)

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

[https://github.com/wlievens/scallywag](https://github.com/wlievens/scallywag)

------
jscardella
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!

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

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

[https://www.cs.ubc.ca/~rbridson/docs/bridson-
siggraph07-pois...](https://www.cs.ubc.ca/~rbridson/docs/bridson-
siggraph07-poissondisk.pdf)

------
bartvk
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?

------
LoSboccacc
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](https://i.imgur.com/LXNtZLH.png)

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

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

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

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

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

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

~~~
vacri
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

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

~~~
Null-Set
He also just really liked writing about landscapes.

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

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

------
bovermyer
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!

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

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

------
moultano
Everything looks great except the rendering of the mountains.

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

------
kaik
This is sooo cool! Thanks for sharing!!

