Projects

Realms | A Journey into Procedurally Generated Maps

In 2018, I became interested in procedural generation in regards to map creation. It started with some basic procedural forest generation I did when I was still working at Paul Bernhard Exhibits where a colleague and I were working toward a multi-screen strategy game about renewable energy.

I've always loved the sort of fantasy fiction with a map tucked in the front cover of the book. I drew inspiration from Amit Patel, Azgaar's Fantasy Map Generator, Scott Turner, and Marting O'Leary.

I pulled inspiration and motivation from maps like these.

Ilanthar also has a great selection of maps, though their website is largely in French.

My end goal with Realms was to make a great big procedurally generated world complete with continents and island chains, wind directions, biomes, and a lot more. City generation within this world was also a goal, and I did some research into it. The best resource for city generation (somewhat recently kind of integrated with Azgaar’s work, more of an easter egg really) is by the procedural generation wizard Watabou and covers districts, walls, farms, roads, and rivers. You can view the medieval city/town generator for yourself.

Watabou's awesome city generator creates and labels districts and noteworthy buildings

 Other places I took inspiration were from Azgaar's Fantasy Map Generator, Amit Patel, Scott Turner's Dragons Abound, and Martin O'Leary's Fantasy Maps. Most of these programmers overlap in some way and borrow ideas from each other, and each has their own way of explaining certain concepts they've worked on making all of them crucial for a complete understanding of map generation.

Azgaar has the best (bar none) available map generator that can be run immediately in the browser. His work is current but unfortunately I find it hard to understand a lot of his (JavaScript) code. Nevertheless, his blog discusses in detail the approach he takes to tackling various challenges which makes it not only a fantastic starting point but also great reference material when writing parallel code.

Amit Patel has several iterations of his maps, and his oldest ones were done in ActionScript, which originally got me into procedural programming. Amit’s site boasts a lot of amazing in-depth tutorials and essays on different programming concepts ranging from pathfinding to his most popular: generating random worlds.

Scott Turner has taken map generation and gone off the deep end with it. His blog doesn’t usually show actual code, but goes into a satisfying amount of detail about how he achieves his map generation. He mainly focuses on generated art, creating maps that look practically hand drawn. If you’re seeking the most advanced concepts and methods, Scott’s blog is certain to provide you with more than enough material.

Martin O'Leary's Fantasy Maps are limited but they also served as an inspiration to Scott Turner and Azgaar, which makes them an important keystone in the map generating community. His post detailing his work goes into great detail and explains the map-making process intuitively and interactively. He also made a Twitter bot that posts randomly generated maps from his generator.

I came across some valuable additional resources as I explored the topic.

For my own map generator, dubbed "Realms", I decided to dive right in and essentially copied how Azgaar's height map is generated. A giant "sticky" mountain with a few mountains dotted around it. Raise the sea level to produce islands and continents, practically at random. Looks okay, but isn't very realistic. The map ends up with several mountains but no mountain ranges to speak of. Drop moisture on the map evenly and roll it down slopes to produce rivers.

Simple enough, the first iteration of the voronoi-cell map generator looks good. Shading represents height, and lines and circles represent flow and flow strength.

Next, I added biomes and a temperature layer to keep the south warm and the north cold. Town placement was pretty straightforward, but roads took me a while to implement.

I created two types of forest drawing patterns with heavy inspiration from Scott Turner's work

I ended up getting really invested in toponymy - the way things are named. After tremendous amounts of research, I went with German as a good base language because English has too many variables (Norman and Viking invasions have left the English language riddled with peculiarities that make toponymy hard). German on the other hand simply combines common words or names into place names.

I put together a pretty convoluted system for naming places after trying multiple other approaches including real place names and markov chains. These methods, while fast and easy to implement resulted in irrelevant names. For example, an inland town with an industry focused around a salt mine should probably be called something related to that. Or related to the founder of the town. Random real place names and markov chains ignore context entirely.

I learned a ton from this project, but I started running into performance issues and got demotivated by technical debt as my code base grew.

You can view my source code on GitHub or view the (inactive) Trello board.