Monday, June 18, 2012

Random Terrain Generator

I mentioned in a recent post that I was working on a set of random tables for terrain generation. The tables themselves aren't quite ready for use; at the moment they only exist as an Excel spreadsheet; but I did spend an hour to build a small test map. Once I had the raw map done on graph paper, I used Hexographer to create a legible map.



The Test Map
It's not too bad actually. I still have some work to do, mostly with how the tables are selected and how coastal / ocean areas are generated. Right now oceans tend to fill all available space. I cheated a bit on the test map and re-rolled some of the ocean results. In general terms, here's how things work:

There are eight tables, each based around a central terrain type: plain, woodland, mountain, desert, wetland, coastline, and ocean, plus a random table that effectively forces a change in terrain. Each table favors it's primary terrain type plus variants, but also includes similar types that might appear nearby. Each table entry also includes a table number, with same-type terrain referring back to the same table. If you're using table II, plains and roll plains, the new table number is also II. But, if you generate mountains, the table number is IV. When generating hexes you record both terrain and table number, then use the table numbers of neighboring hexes to select the table to use when generating new hexes.
Plains Table (II)
The tables use Fudge dice in a non-standard way to select entries. To read the result, roll the dice, then count plus and minus results. Each plus moves right one column on the table, each minus moves down one row. You can try out the roll system on the sample table above if you like.

To generate hexes, use the following rules to select a table, using the first rule that matches:

  1. If next to ocean, use table VIII (ocean table).
  2. Use the lowest numbered table from any generated neighboring hexes.
  3. If there are no neighbors, use table I (random table).

Record both the terrain, and the listed table number, then move on to the next hex. If a result indicates coastline, mark the hex, then place two ocean hexes (if possible) in adjacent hexes. Once terrain around the coastline hex has been fully generated, choose the most common type as the coastline hex's terrain.

As you can see from the map, the results are decent. The biggest oddity in the sample is the desert hex next to forest on the north edge, and the generally unsatisfactory ocean layout. There's also a tendency for plains terrain to take over the world, since it's the lowest-numbered, terrain-based table. The random table, table I, was my attempt to fix that. I'm not 100% sure it's doing what I want. I may alter rule two to read:

  • Use the most common table number from any generated neighboring hexes. Resolve ties by using the lower table number.
I'm also not happy with coastline treatments / ocean generation. I wasn't 100% rigorous in following my rules when I started this map, mostly because I was making it up as I went along, so I need another test to see how it really works. Time to hit the random number generator!

3 comments:

  1. Mark,

    Is that the completer chart?

    -K

    ReplyDelete
  2. Right now it is. I'm using Excel to do the prototype work. Eventually I'll get it out in some usable form.

    ReplyDelete

Note: all comments are moderated to block spammers. Please be polite.