Among all the beta madness, we found some time to prepare a new development journal. One of the things we’re tweaking in this beta phase is the Random Map Generator (RMG). In this journal, programmer Lascha Lagidse will tell you how the RMG is constructed and what considerations have been made.
The Quick Start Settings in the Front End
Our Goals with the RMG Hi! Random Maps Generation has always been a much wished for feature, yet in the Age of Wonders series the RMG wasn’t added until the stand-alone expansion Shadow Magic was released. For Age of Wonders III we wanted to add the RMG while the main game was still in development, so we could take the random generation process into account when developing the game and spend enough time on it. On and off, the RMG was written over a period of 18 months! Our goals for the RMG are:
- Give you the sensations of truly exploring and conquering varied uncharted worlds; both in single player and in multi-player.
- Support for multiple, vastly different, Map Types; Land based maps, Island Maps, Underground Maps, etc. In the previous game you could sort of predict the lay of the land once you generated a bunch of levels. Now we wanted to add more variation at the core.
- Good flow and balance; e.g. ensuring that player’s don’t start right next to hostile high level structures like a Dragon’s Peak with raiding dragons.
- Support for randomly selected AI players, so you don’t know who you’ll be encountering.
- A Quick start Option allowing tweaking of the core settings, like size, # players and starting power.
- Advanced options with filters allowing experienced players to tweak every detail like the abundance of forest or the exclusion of a particular race and the flow of the map.
- And last but not least, the lands should look natural, with locations fitting in their natural surroundings. Rivers flowing into seas, etc approaching the look of a hand crafted map
The Generation Process Central to the generation process is tool that allows us to define generation passes. Each generation pass has the responsibility of generating a part of the world. While a generation pass is being generated it must meet a special set of generation rules which are configured by us. For example, here are some rules for a generation pass for Shrine of the Fickle Mermaid water structure: – It should always be generated in the water. – It should not be generated too near to the shores, unless there’s no better place. – It should not be generated near other shrines of the same type, unless there’s no better place. – It should never be placed within a 10-hex distance from a player starting point. – It should never be placed within a 6-hex distance from the map borders. After creating the rules, we made sure it had sufficient randomness in the values of the rules. This is important; otherwise the maps will become too predictable! But also don’t allow it to have too much randomness, or it won’t be fair! Tweaking these values is extremely important for finding a balance between fairness and randomness. When the configuration of the generation pass was finished, we added the whole thing to a generation group. At the moment there is a generation group for each map type, namely Land, Continents and Islands. And there is another generation group for Underground. Either of these groups can be given to the generator and the generator will return a randomly generated map by processing each generation pass in the group in order.
Generation Pass Types We have many types of generation passes and each type has its own specialized way of changing the world. The most important ones are:
- Object Generation Pass: Can generate objects such as structure, pickups, unit stacks and props.
- Area Generation Pass: Can generate terrain area of a given theme and/or clime.
- Continent Generation Pass: Same as Area Generation Pass, but is more shaped like continents and scales better with different map sizes.
- Cluster Generation Pass: A generation pass that can contain a sub-group of generation passes. This recursive generation pass is very powerful. I’ll leave it to you to imagine the possibilities.
- Path Generation Pass: Can create paths from an object to another object. This pass can be used to create road paths, or to simply break down mountains in order to create a passage.
- Player Spawn Generation Pass: Responsible for finding player spawn positions while making sure the distribution is fair.
- River Generation Pass: Responsible for generating random rivers (can also be used for lava rivers!).
- Layer Connector Pass: Makes sure that objects such as cave entrances/exits are placed correctly. This allows units to travel from the surface map to underground map.
We wanted fair random generated maps, but this way of generation was completely new to us; we could not find another strategy game that used a similar approach. Would this approach even work? I had a strong feeling it would, but no guarantee. The initial implementation of the RMG (prototype) was actually way too complex that it became difficulty to work with. At one point I decided to rewrite it, but keep the good parts. The result was a new prototype application (2D) of which a screenshot can be seen below. The left contains the resource objects, such as generation passes. The currently selected generation pass is [Mountains], for which the rules can be configured in the center panel. I would have to write a book to explain each of the values in the center panel, so I’ll leave that explanation out. On the right side is a random generated level based on my currently configured values. So in short, this prototype application allowed me to test faster; I had a simpler overview of the map but most importantly I did not have to wait for the whole game to launch (takes precious time). When I felt that the generator was stable enough I converted all the code to the Age of Wonders 3 codebase. And this is when the rest of the developers were also able to generate random maps for themselves.
The Random Map in the Game
And here are some results of the game. As you can see there’s quite some variety in geography. At this points we’re tweaking the results and adding some beatufication passes like smart prop placement. (flowers and butterflies around Sylvan Court’s for example)
A Continent Style Map. All Players have about the same size expansion area.
Underground Layer, Note the rivers of water and lava.
An Isles Map. All Players start with a Harbor. Seafaring is essential in this map.
Another in-game shot. Note the cluster of resources and an Indie town placed in a bottleneck. This creates an area of heightened strategic interest.
Thanks for reading, and please let us know what you think in the comments below! Lascha Lagidse
Latest posts by Lascha (see all)
- Dev Journal: Conquering Infinite Worlds in the RMG - February 2, 2014