I like the way Age of Empires II generate random maps turned out (good variety, decent biome transitions, maps felt random without feeling chaotic), but am struggling to replicate the style. I've attempted using e.g., Perlin noise, but everything comes out either too homogeneous, or if not, the Perlin value -> terrain heuristics are too sensitive and fragile to make a variety of world types.

I remember the AoE2 map type "The Unknown" advertised "100,000 possible maps", suggesting some use of seed numbers, but I'm not sure how to use seed numbers to produce the variety I saw.

What algorithms and heuristics could I use to produce random maps that feel like AoE2 random maps?

Edit to be more specific:

Thinking further about my problem, and studying what I like about AoE2's random map engine, I believe my biggest problem is managing the distribution of water and plant life on the map. I now see I've also tied that up in my mind with "biome transitions that make sense", but that's a different problem (though I expect my continued use of Perlin noise will make it tricky to solve).

I've added several AoE2 random maps that highlight what I like about their mapping engine, which my own efforts are failing to reproduce. All screenshots are taken from random map type, "Custom" -> "The Unknown". I did not instruct the game to use specific geographies like archipelagos.

Further below are images from my own map engine. Each pixel corresponds to one AoE2 map tile.

One complication for my project is I want maps to be many, many times larger than AoE2 maps. Thus, whatever engine I use must be able to create the full range of biomes in each map, and not one narrow set of biomes per map, like AoE2 uses.

Age of Empires II maps

Inland lakes

Here's an example that features inland lakes and some sort of river-looking things. I like how the map includes a large amount of water scattered about, but that water is still somewhat concentrated - there are large swaths of land that are available for building your empire. You don't have to spend the entire game planning your city around the water.

Connected islands

Here's similar example where the game was smart enough to connect islands with traversable marshes. I can't imagine how a noise-based algorithm would create the marsh there, and only those places. Also, notice how the game created the land such that each player has their own private, large swath of land all to start out with. It didn't create random patches of land, then take a best-guess as to which one would be the least terrible for each player to start on.


I like that this map also makes heavy use of water, but doesn't include many inland lakes. Contrast it with the first image. I like the way AoE2 creates entirely different geographies using the same building blocks. My attempt at using Perlin noise failed here - I either get enormous sprawling oceans that dwarf the land mass, or the Land of 10,000 Lakes. I also found it hard to get both islands and connected continents (think North/South America).

Dry, lush Dry, desert

Contrast this image with the one above it. They show that the aridity of a map doesn't depend on the water level. The first image features a map that's nearly devoid of water, yet contains forests and grass. The second image has a moderate amount of water, yet is a desert. I like that that's possible (think having both New Mexico or the Sahara and Costa Rica in your world).

My own maps

I've read in a bunch of places that a good way to build maps is to layer multiple levels of Perlin noise, each representing a different dimension of data. Following popular recommendations, I went with elevation and moisture, selecting terrain types from the Whittaker table here.

I took two perlin maps, quantized the values from each into integers via a simple if perlin_val < x { i=some_int } else if perlin_val < y..., then mapped the (elevation, moisture) integer pairs to a table of terrain types (e.g., [1,0]-> tropical desert, [1,1] -> grassland). Oceans were included in this system - elevation=0 defined ocean.


There's good variation, and in many ways it feels like a real world, but there are a few problems:

  • First, there's no pattern to the ocean depths. You'd expect shallow waters near shore and deep waters further out, there's no rhyme or reason as to which is where

  • Second, all of the water is concentrated in the oceans; there are no lakes or rivers, because Perlin noise doesn't suddenly dip to a lower value in the middle of a continent.

  • Creating a balance between quantities of each biome is very, very difficult. I attribute this to:

    • Perlin noise follows a normal distribution, so estimating how to adjust the probability of each dimension mapping is difficult

    • Trying to balance multiple dimensions is hard - maybe I want more (2,3) so I up the odds of getting (n,3). Well, now I have too much (3,3) and everything looks wrong.

    • When I zoomed the noise in closely enough to have smooth data, I wasn't getting a very complete sample of Perlin values. So I'd tweak my distributions for the map in front of me, reload a new random map, and get very different results.


I tried to fix the rivers/lakes issue by making water from a third set of Perlin values. A binary water/land decision, then apply all of the above stuff to the land. This makes it drastically easier to control water distribution (still not perfect, but better), but introduces the problem that there are a lot of biome transitions that don't make sense. E.g., inexplicable patches of desert in the midst of lush grassland, snow on the beach, etc. It's also still hard to control proportions of land biomes, for the reasons mentioned above.

One-dimensional failure

Looking at that the above problems, I tried a simpler algorithm that only mapped the Perlin noise to one dimension. I now have an array of terrain types escalating from 0=deep ocean -> 1=shallow ocean -> 2=beach ... -> N=snow. While this yields islands and continents, and makes it far easier to balance the proportion of each terrain, the terrain types are far too clustered. Every land mass looks like an elevation map, generally without terrain types scattered across its surface. Every land mass has approximately the same features, always in the same order, and always in the same ring-like shape.

  • \$\begingroup\$ I'm not sure anyone not on the original development team can really answer your question, but I'd suggest the seed is much lower than you'd expect. The seed almost certainly generates different maps per base map type, and including them all in any combination is most likely what allows it to reach 100,000. \$\endgroup\$
    – Magus
    Mar 10, 2014 at 21:58
  • \$\begingroup\$ This question appears to be off-topic because it is asking for implementation details about a specific already-existing game, rather than about creating a game. \$\endgroup\$ Mar 10, 2014 at 22:02
  • \$\begingroup\$ @TrevorPowell After reviewing the guidelines for on-topic questions for this site, I've rephrased the question. \$\endgroup\$
    – spiffytech
    Mar 10, 2014 at 22:03
  • \$\begingroup\$ You posted that edit about ten seconds after my comment. Now that's service! ;) \$\endgroup\$ Mar 10, 2014 at 22:03
  • 1
    \$\begingroup\$ -1 Still too broad I think. You need to be specific about what "maps that feel like" means. Specific examples of what you're talking about are required to answer this question. Procedural generation, is more artistic than people often think it is. Art creation and perception is a subjective topic. Pick a specific thing you want to focus on and ask only about that. The scope of this question is currently very broad. \$\endgroup\$
    – House
    Mar 10, 2014 at 22:26

2 Answers 2


Check out Amit Patel's excellent article that I feel is kind of a quintessential resource for procedural generation of terrain...


The key thing he does is use graph structure to model his terrain, not straight up noise maps (Perlin et al). I won't embed his illustrations, but read the article, and I think you'll find it helpful to get you thinking about a different approach.

If you are making a CIV/AOE type game, placement of resources will be important. You can't have key resources be too rare, or high value ones be too common. If you presume each polygon to be a zone with a given characteristic (see article's illustrations, it will make more sense), I could see assigning resources to each polygon based on some algorithm of your choosing. You can get pretty clever by making the resources in a polygon be statistically biased by the neighbors so that a forest next to a desert might be rare, but forest next to grassland more common for example.

  • 2
    \$\begingroup\$ Amit's guide produces terrain that is too realistic for Age of Empires. :) \$\endgroup\$ Mar 11, 2014 at 5:56
  • \$\begingroup\$ Hehe yes, true. But the basic concept of using cells of varying sizes (where each is a specific terrain type) would work well as an approach I think. Remove the idea of terrain height from the equation. \$\endgroup\$
    – Tim Holt
    Mar 11, 2014 at 23:30
  • \$\begingroup\$ I reviewed Amit's article, but it's optimized too tightly around having a single island. Making elevation a simple function of distance from shore would produce awkward results with multiple islands, or larger continents, and his water distribution method assumes a prominent peak in the landscape that eventually flows to the ocean. If I were to remove terrain height from Amit's scheme, I'm left unsure how to adapt his biome distribution idea to my project. \$\endgroup\$
    – spiffytech
    Mar 12, 2014 at 16:32

I create random map scripts for Age of Empires 2. My most recent one is for the HD version.

If you're looking to understand how to create maps for Age of Empires 2, there is this excellent guide to RMS (Random Map Scripting).

Age of Empires uses an expert system, allowing scripts to write routines for the generation rules, which you can learn a lot from. As for regions, I imagine that would simply be a case of masking off areas and applying different scripts/routines to the masked areas accordingly. You can easily see the generation rules of existing map scripts by opening them in a text editor. I write mine in Notepad


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .