I Blame GreyKnight

Today GreyKnight tagged me in a G+ post regarding some machine-assisted mapping software by Martin O’Leary (Uncharted Atlas on Twitter).

Well, I say ‘machine-assisted’, but it looks like the software does most of the work.

It’s also frighteningly close to some ideas I explored about fifteen years ago, but Martin made it work much better than I did… and this gives me ideas for how to improve what I’d done, and make it a little more interactive.

Fantasy Map Generator (Terrain 2.0)

Some notes off the top of my head, so I don’t forget.

Original Version

My original attempt was a command line program. Given an an arbitrary height map (TIFF file with elevation ranging from black to white — which mapped to values ranging from 0..1) it would apply many iterations of ‘precipitation’ to discover rivers (and thus watersheds) and lakes/oceans (depressions that filled with water). I was good at finding waterways, I never did find a satisfactory method of finding bodies of water.

There was also an erosion element, where moving water would reduce the elevation along its path. This included a ‘sediment’ component where the eroded material could be dropped if the speed of the water became too low. This would happen mostly when the slope became to shallow or when the ‘water unit’ hit standing water. It didn’t work as well as I’d hoped but I think this was mostly because of my problem finding bodies of water.

The program would periodically render the image in several modes, so I could see what was going on.

  • Bump mapped height map, just the terrain itself. Over time I could see the effects of erosion.
  • Bump mapped colored height map, the terrain with pseudocolored elevation so I could more readily make out the differences in elevation.
  • ‘Water map’ showing the aggregated water flows, optionally with the ‘ocean’ (everything with an elevation under a specified value) filled in blue. This gave me a very good idea of how the water flows were working out. It was very satisfying seeing how, over time, I could pick out where the mountains were by the water flowing away from them.
  • Combined, the colored height map with the waterflows and ocean shown. Because I like the pretty pictures.

New Version

First thoughts on what will be in the new version.

  • GUI (C#/WPF, because that’s what I work with in my day job) allowing adjustments as it goes.
  • Multiple phases in map development:
    • Initial height map. The first iteration will load a greyscale raster image (black = low, white = high) to use as its height map. I might later add a height map generation tool, but that’s lower priority for me.
    • Adjustment layer, so the user can adjust the heights of the original height map nondestructively. I will probably add this after height map generation, since loading the height map from a raster image means the height map can be modified outside this program if needed.
    • Set sea level (which might be below the lowest elevation, if the entire map is above sea level). This should be readily adjustable, but will affect later steps.
    • Find lakes (apply the Planchon-Darboux algorithm), so I know where all the standing water is.
    • Erosion, per my original algorithm. Drop units of water on the terrain, see where it goes. If it hits a lake, go to the exit point of the lake and carry on until it hits the ocean (or the edge of the map). This will find my rivers and watersheds, and will affect the final height map.
      • I might need to find lakes a few times, depending how much effect erosion has. The water leaving the lake should probably erode the terrain as well, and would thus reduce the maximum elevation of the surface of the water. Ultimately it might even wash the lake out!
      • I might go with with a more approximate, but much faster, erosion mechanism. I might even make it configurable which gets used… but I will still need to do the water flow analysis.

That gets me more or less as far as I’d gotten before. Get height map, pour water on it. Now for the next steps.

  • New phases in map development:
    • Settlement. User identifies how many cities (major settlements) and towns (minor settlements) to add. There might be the option of manual insertion (put them exactly where the user says), but for the first pass I’m going to apply them based on rules — mostly around where the water is. Each city or town added will grab the most attractive location available.
      • Initial version will follow Martin’s algorithm, taking into account how attractive the location is (how much water) and how unattractive (how close to another city or town).
      • Later versions might allow weighting these. Perhaps cities want to be far from each other, but towns like to be close to cities.
    • Nations. Assign control (or at least influence) over the territory based on proximity to settlements.
      • It appears Martin assigns control of the territories based on relative proximity to the cities, splitting things as evenly as possible between them. This seems to take the terrain into account, with mountains, and rivers and other waterways, penalizing distance.
      • Martin’s process appears to assign all territory on the map. I am greatly tempted to restrict the reach of each settlement.
      • I might instead give each settlement a certain amount of ‘regional reach’ (first pass, each city is worth this much, each town is worth less) that governs how far their influence can reach. (City, city) regions overlapping are probably either contended or split based on proximity (each point goes to the closer city), (city, town) regions overlapping probably see the town allying with the closest overlapping city, (town, town) probably either stand alone or ally. Allied town regions are counted as part of their ally’s region, extending the reach of a city (or set of towns).
    • National option: iterative assignment.
      • Rather than working on ‘distance to settlement’, each settlement might have a certain amount or number of points of influence. Assign each in turn (proportional to number available, I suspect — if a city has twice as much influence as a town, the city should assign/grab two units of territory for each the town grabs… of course, there are more towns than cities).
      • Each time a settlement grabs territory, it looks for the most attractive location to grab. This is probably a function of:
        • Distance from settlement;
        • Ease of travel (proximity to water is probably a good measure here, easier to follow a river up-valley or follow a shoreline than to cross the mountains);
        • Distance to or amount of neighboring territory of the same settlement (while it is easier to go up-river for a while, eventually the proximity to other controlled terrain makes it cheaper to climb the hill than to follow the river).

I don’t anticipate worrying about names.

Further Adjustments

I expected to have more places for the user to intervene in the map development. Adjusting the height map is the biggest one, but by dropping the need (and ability) to do that there isn’t much left to change. There are some controls involved (how much erosion, etc.) but most of the work after that is done by the computer.

… I started to list other things that could be added, but I think I’ve got enough to start. It would be very easy to get bogged down in additional detail, and I don’t want that to happen. At least, not until I’ve got this part working.

No related content found.

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.