Wednesday, August 21, 2019

Azgaar's Fantasy Map Generator

In the previous posting, I generated some maps and did a self-critique.  To bookend that, I'm going to take a look at another really good map generator:  Azgaar's Fantasy Map Generator.  Like me, Azgaar started with Martin O'Leary's generator.  But Azgaar made some different decisions in how he elaborated that generator.  Most notably, he had a focus from the beginning to create an interactive tool for generation, and he's made it publicly available, so it has a thriving community of users over at /r/FantasyMapGenerator.  If you haven't ever looked at Azgaar's generator, I encourage you to do so.  To be honest, this review will be less criticism and more highlighting some of the more interesting aspects of the generator!

The first thing I notice in playing with Azgaar's generator is how fast and smoothly responsive it is.  A few operations (like generating new terrain) take a second or two, but most operations happen virtually instantaneously.  This is in great contrast to Dragons Abound, which can take many minutes to generate and display a map.  I also love that when you zoom in, new details become visible.  At the default zoom level you don't see much more than the outlines of the land and large rivers.  As you zoom in, trade routes, country boundaries, cities and more become visible.  It's all very nicely done.  Beyond the mouse, the interface is handled through a widget in the upper left hand corner of the map.  This pops out to provide access to a variety of options and features.  There's a tremendous amount of control possible.

Beyond those first impressions, let me take a look at three legs of the map generation stool: (1) terrain generation, (2) culture generation and (3) the map display.

To start with, take a look at the options Azgaar provides for terrain generation:
Azgaar provides a list of about ten different land templates.  These include things like a large central island, a peninsula (going off the map edge), a Mediterranean central sea, and so on.  This is really a very clever way to handle this part of the interface.  Most users presumably have a high-level notion of what the map should look like (e.g., “a big island", “like the Mediterranean", etc.) and don't really want to play around with low-level control of the noise generation.  Some of the options like “Pangea" aren't immediately intuitive (to me, anyway) but generating a few sample maps (which can be done quickly!) gives the idea.

The template choice plus size and detail are the primary options for controlling terrain generation.  The templates do a pretty good job at creating usable maps, but it's obvious that most of the land generation is based on noise, so if you're looking for geologic accuracy you're going to be disappointed.  The land shapes also often have the typical ink splatter look of noise-based generation:
but that's an objection you could raise about almost any procedural map generator (including Dragons Abound).

If you don't like the generated terrain, Azgaar provides a tool to paint new terrain:
There are a variety of paint brushes and other tools to use; here I've painted in an isthmus.  So this is very nice for customizing a map, or if you're trying to match an existing map you can generate maps until you get a close approximation and then use the paint brushes to tweak it into alignment.

There's also a tool to create new templates.  I expected this to be something that would take a map and turn it into a general pattern, but in fact it's something quite different:
A template is a sequence of generation actions (like “Create a hill").  There are 8 possible actions, and they each have some parameters that you can assign values or ranges of values (in which case a random value in the range is selected when the action is executed).  This is a very smart way to approach templates, and something I'm inclined to recreate in Dragons Abound.  One of the nicest features of this approach is that you can repeat actions a number of times; something that essentially has to be hardcoded in Dragons Abound.  On the flip side, this is the sort of thing that could become quite a rabbit hole and end up implementing an entire scripting engine.  (Not that I've ever been guilty of that sort of overkill, of course.)

A final option for creating terrain is to upload an image and convert it to a heightmap.  The whole process is described in this blog post.  I haven't tried this myself, but it seems like a useful feature for (say) recreating a map from your favorite fantasy book.

Before I get off of terrain generation, let me take a quick look at rivers and lakes:
Azgaar's river generation seems to be a lot like Dragons Abound's, but there's something odd going on that (at least to my eye) creates rivers with a lot of sharp right angle turns, as you can see in the three rivers on the right side of this map.  As for lakes, I'm not sure what Azgaar's doing, but it looks like they're being placed randomly (as Dragons Abound does).  Lakes also have a different color from both rivers and oceans -- I'd probably make them the same color as rivers.  (Lake color is something you can change.)

The next step in the map creation process is the culture generation.  This step creates the human occupation of the land: states, cities and so on.  The culture generation is described in detail in this post, but the TLDR summary is that it uses a fairly straightforward algorithm that places capitols, towns, and then divides the land up into states.

One interesting wrinkle Azgaar has introduced is the notion of cultures versus states.  A culture is a unified set of beliefs and social norms, like the Kazakh culture, or the Desai of India.  Cultures often follow country borders but not always, and you may have pockets of a neighboring culture across the border in a different county -- like French influences in Switzerland.  Azgaar creates both a cultural map and a state map, and they do not precisely coincide:
Here the dotted lines are country borders and the colors cultures; you can see how the yellow culture is mostly in three countries along the coast, but there is large green culture influence in two of those countries.  I'm not sure how useful cultures really are; they seem to be used primarily to pick city names.  But it's an interesting idea, and certainly has a lot of potential.

Azgaar's generator creates the states by growing out from the capitol city.  This map shows a common problem with this approach:
Here “Repi" has grow to encompass a few islands and has also nibbled a peninsula out of “Rafha."  Furthermore you can see that “Rafha" also has a small chunk of unaffiliated territory (“wild lands") along the coast.  This looks (at least to my eye) pretty unrealistic, especially since you can see the trade routes pass right along the edge of wild lands.  It's hard to imagine why Rafha wouldn't claim those lands right along a trade route, or why they would permit Repi to have that little chunk of land.  Dragons Abound generates states essentially the same way, and despite various attempts I've made to address this, it's a common problem in Dragons Abound as well.

As usual, Azgaar has made the cultures and the states editable.  The names for both the states and the cities are randomly generated from name lists based upon real world cultures (e.g., Chinese, German, etc.)  There are quite a few available:
I'm not exactly sure how the random name generation works; I'm guessing that it does some kind of n-gram generation using syllables and frequencies taken from the list of sample names in that language.
Looking at these city names you'd probably guess (correctly) that they're taken from Spanish.  Changing the namebase for the culture to English and regenerating the names:

This gives names that are more recognizably English.  But a problem with this sort of name generation is that the names (particularly when you see a large number of them at once, as you do on a map) aren't very plausible.  Certainly something like “Nefodmouth" on the surface seems English but pretty unlikely. If it was an odd one-off you'd probably pass it over, but when every name has that quality it is more noticeable.  (Of course, you can rename all the cities  yourself if you're so inclined.)

On the other hand, one nice feature of this approach is that having different namebases to drive the generation does create a nice association between the cultures and the names.  So here along the coast of Repi:
You can see English names in the north and Chinese names to the south, and indeed there is a culture change between the two areas:
That's pretty cool.  I like map features that imply some deeper underlying mechanisms.  Even though Azgaar doesn't really have much more going on here than random cultures, the map clues give you ample room for your imagination to elaborate.

Lastly, the map display.  The map style is largely controlled by revealing (or hiding) various map layers through a simple pushbutton interface:
This is a nice, straightforward interface and there are 21 layers, so a lot of customization is possible.  At the bottom of the widget you can select any of the 21 layers and set various parameters for the layer, so you could (for example) change the lake color to match the river color.   There are also a few filters you can toggle; grayscale in particular is useful to easily make a black & white map.

Overall the display of the map is clean and pleasing.  There's quite a bit of variety available through customization of the different layers, but it can take a while to learn each of the elements.  But it's certainly possible to vary the look quite a bit.
To indicate forests, mountains, etc., on the map there is an option called “Relief Icons" which does this:
This is a pretty typical style seen in a lot of map tools.  There's currently only the one set of icons and no way to easily switch to a different set.  Oddly enough the icons remain visible even at the most zoomed out view of the map; I expected them to fade away.

The state labels are done in a really nice way that follows the spine of the state:
I need to dig into the code and see how Azgaar has implemented this; it's certainly worth stealing.

Beyond that, labeling is pretty rudimentary:  cities get a horizontal label centered above the anchor point.  Because city labels aren't generally visible until the map is quite zoomed in (and hence there's a lot more room between the cities) the labels don't usually clash, but there are places where it happens, particularly where city labels clash with the larger capitol labels or the state label:
This is probably the weakest part of the map display, but in most cases it's not really a problem.  Using a zoomed out map with state labels but no city labels and a zoomed-in map with city labels but no state labels eliminates almost all the clashes.  (You do still get labels on top of lakes, rivers, relief icons, etc.)

Overall the map display is very functional.  The tool can display a lot of information in many different ways, so by toggling layers and using customization you can usually find a way to display whatever information you need.  You can certainly produce maps that would be very useful for, say, a role-playing game.  (And many people in the community are doing just that.)

So what are my lessons learned?

First, it's that Azgaar has done a really nice job and created a very mature tool.  Although I've recently subscribed to his Reddit group, in the past I mostly followed his blog -- which hasn't been updated in over a year -- so I was quite out of date on his progress.  The tool is really solid and full-featured.

Second, it's really nice to have a responsive user interface and an easy way to tweak a map on the fly.  Azgaar's tool is very much designed to be actively driven by a person building a map.  Sadly, I don't think that's easily possible for Dragons Abound but I certainly should think about adding some more capabilities like that where I can.

Finally, Azgaar has come up with some nice “shorthand" approaches for some complex configuration problems.  I particularly like his templates for terrain generation and the scripting approach for defining templates.  These are things I should steal, er, use as inspiration.  (Update: I'm working on it. :-)



5 comments:

  1. Love both of your work. I would like to see a similar review of Dwarf Fortress map generation too.

    ReplyDelete
    Replies
    1. Thanks very much! That's an interesting idea about Dwarf Fortress. I only have a passing familiarity with DF; I wonder how long it would take me to understand the map generation enough to make any interesting comments?

      Delete
  2. Very well written review. I fiddled with Azgaar's tool few days back. This review helped me with the information about inner workings of the tool.

    ReplyDelete
  3. ๐Ÿ˜ฎ๐Ÿ˜ฎ๐Ÿ˜ฎ๐Ÿ˜ฎ๐Ÿ˜ฎ๐Ÿ˜ฎ๐Ÿ˜ฎ๐ŸŒ

    ReplyDelete

Note: Only a member of this blog may post a comment.