Regicide is a fun game mode in Age of Empires II where each player controls one1 king, and as soon as a player controls zero kings, the player drops out of the game.
King of the Hill is a fun game mode in Age of Empires II where there is an indestructible monument in the center of the map. When a player has at least one unit around the monument and all other players don’t, the player gets control of the monument. The first time this happens in a game, a countdown of 550 in-game years starts. A player who controls the monument when the countdown hits zero wins the game. When control of the monument switches and the countdown is below 100 in-game years, it is reset to 100 in-game years.
In regular gameplay, these gamemodes are mutually exclusive: You can either play Regicide and hunt kings (cruel, I know!), or you can play King of the Hill and desperately throw your armies into the middle. But you could not do both at the same time.
Now, with the endless possibilities that UserPatch 1.5 has brought upon us, you actually can. But how? Let us find out.
Random maps in Age of Empires II are generated using random map scripts. A random map script is a text file with the extension .rms that contains instructions on how to generate the terrain and distribute players, units and resources on a map. In addition to the maps that come with the original game, many interesting and fun random map scripts have been developed by the community.
Let’s look at what a map would have to do in order to provide Regicide or King of the Hill capabilities, respectively.
We can easily see that the mechanics of Regicide are rather easy to implement:
begin loop for each player if player does not control king player loses endif endfor end loop
We need to put a king on the map (easy), and when a player has no king, the player must drop out (???).
The mechanics of King of the Hill are rather complicated in comparison:
begin loop if there are units around the monument if no countdown is running countdown = 550 start countdown give control of the monument to a player who has units around the monument else if player who controls monument has no units around the monument give control of the monument to a player who has units around the monument if countdown < 100 countdown = 100 endif endif endif endif if countdown == 0 player who controls monument wins endif end loop
We need to put a monument in the dead center of the map (not sure if we can hit the center, but approximately it’s definitely possible) and handle a countdown (???) as well as ownership changes (???).
From what we gathered so far, it looks way more practical to create a random map script which simulates a Regicide game, and to then use it with the King of the Hill game mode, where game itself handles all the monument placement and especially the gameplay logic for us.
UserPatch 1.5 introduces a new statement into Random Map Scripting: guard_state. It is a very powerful statement which can serve two functions at once: Generate a resource trickle and define a victory/defeat condition. This makes it a bit tricky to use.
Our plan for creating a King of the Hill Regicide map is as follows:
- Take practically any old random map script
- Place a king unit, even if the game mode is not Regicide
- Use guard_state to make a player lose if the player does not control any king unit
- Maybe adjust the starting resources
- Play the map with the King of the Hill game mode
- Profit!
Let’s go through these step by step.
1. Take practically any old random map script
I take the WSVG Single Maps v2 by HJ1, because they contain many standard maps, but frankly, it does not really matter.
2. Place a king unit, even if the game mode is not Regicide
While in theory only the king is necessary, we usually want to recreate the Regicide look and feel, which includes additional villagers (no problem), a castle from the start (no problem) and different resources (welp… you can’t have everything.)
The random map script will probably contain a part like this in the <OBJECTS_GENERATION> section2:
/* SPECIAL STUFF FOR REGICIDE */ if REGICIDE create_object VILLAGER { number_of_objects 7 set_place_for_every_player min_distance_to_players 6 max_distance_to_players 6 } create_object KING { set_place_for_every_player min_distance_to_players 6 max_distance_to_players 6 } create_object CASTLE { set_place_for_every_player min_distance_to_players 10 max_distance_to_players 10 } endif
This places additional villagers, a king, and a castle. We simply copy this part, but replace “if REGICIDE” with “if KING_OT_HILL”:
/* SPECIAL STUFF FOR REGICIDE */ if REGICIDE (…) endif if KING_OT_HILL create_object VILLAGER { number_of_objects 7 set_place_for_every_player min_distance_to_players 6 max_distance_to_players 6 } create_object KING { set_place_for_every_player min_distance_to_players 6 max_distance_to_players 6 } create_object CASTLE { set_place_for_every_player min_distance_to_players 10 max_distance_to_players 10 } endif
Note: This way, the map will only work with King of the Hill or Regicide game modes. If we want this map to be usable for any other game mode as well, we can instead simply remove the “if REGICIDE” and “endif” parts.
If you can’t find a regicide section in your random map script file, just copy it from this article and paste it into the <OBJECTS_GENERATION> section. If there is no such section, that’s very strange, but you can add that as well in that case.
Now that we get kings in King of the Hill, we can move on to the interesting part. Simply losing your king won’t kill you… yet.
3. Use guard_state to make a player lose if the player does not control any king unit
We need to tell guard_state to watch out for kings. Also, we need to set guard-flag-victory. We do not want to use the resource trickle functionality, but have to fill all parameters. Hence, we add the resource identifiers at the top of the file, before any section. In the <PLAYER SETUP> section, we add our guard_state rule with an arbitrary resource and a ResourceDelta of zero.
The top of our random map script file now looks like this3:
#const AMOUNT_FOOD 0 #const AMOUNT_WOOD 1 #const AMOUNT_STONE 2 #const AMOUNT_GOLD 3 <PLAYER_SETUP> random_placement guard_state KING AMOUNT_WOOD 0 1
Turns out that we are done. The King of the Hill Regicide game is ready to be played. But wait, there’s more!
(If there is no <PLAYER_SETUP> section in your random map script file, just add it. It might also not be at the top.)
4. Maybe adjust the starting resources
In regular games, each player starts with 200 wood, 200 food, 100 gold and 200 stone when using standard resources4. In Regicide games however, players start with 500 wood, 500 food, 0 gold and 150 stone. We can adjust for that by introducing further declarations at the top of our random map script as well as four effect_amount statements in the <PLAYER_SETUP> section, which adjust the starting resource values. The top of our file now looks like this:
#const AMOUNT_FOOD 0 #const AMOUNT_WOOD 1 #const AMOUNT_STONE 2 #const AMOUNT_GOLD 3 #const STARTING_FOOD 91 #const STARTING_WOOD 92 #const STARTING_STONE 93 #const STARTING_GOLD 94 #const MOD_RESOURCE 1 #const ATTR_SET 0 random_placement guard_state KING AMOUNT_WOOD 0 1 effect_amount MOD_RESOURCE STARTING_WOOD ATTR_SET 300 effect_amount MOD_RESOURCE STARTING_FOOD ATTR_SET 300 effect_amount MOD_RESOURCE STARTING_GOLD ATTR_SET -100 effect_amount MOD_RESOURCE STARTING_STONE ATTR_SET -50
Don’t be fooled: It might say “ATTR_SET”, but the values are actually added to the initial values, they do not replace them.
5. Play the map with the King of the Hill game mode
We move the .rms file into the game folder for random map scripts, most likely C:/Program Files (x86)/Steam/steamapps/common/Age2HD/Random
or C:/Program Files/Microsoft Games/Age of Empires II/Random
.
We start up the game.
We create a new game with a custom map and select our random map script.
We start the game.
We see the monument in the middle.
We see our king.
We delete our king.
We lose.
We are happy that it works.
6. Profit!
Check out these maps that I already modified and threw on GitHub for your playing pleasure.
Drawbacks and fun ideas
King of the Hill Regicide games lack two main things one thing: The starting resources of a Regicide game, which are different from a standard random map game, and the Treason technology, which reveals the positions of all enemy kings on the map for a few seconds.
The “king” unit does not necessarily need to be a king. Basically any unit that the players can’t produce themselves will do5. Why not use Joan of Arc? Or even a building? You can do anything. Anything at all. The only limit is yourself.
TL;DR
Add this to your random map script in order to turn it into a King of the Hill Regicide map:
At the top:
#const AMOUNT_FOOD 0 #const AMOUNT_WOOD 1 #const AMOUNT_STONE 2 #const AMOUNT_GOLD 3 #const STARTING_FOOD 91 #const STARTING_WOOD 92 #const STARTING_STONE 93 #const STARTING_GOLD 94 #const MOD_RESOURCE 1 #const ATTR_SET 0
In the <PLAYER_SETUP> section:
guard_state KING AMOUNT_WOOD 0 1 effect_amount MOD_RESOURCE STARTING_WOOD ATTR_SET 300 effect_amount MOD_RESOURCE STARTING_FOOD ATTR_SET 300 effect_amount MOD_RESOURCE STARTING_GOLD ATTR_SET -100 effect_amount MOD_RESOURCE STARTING_STONE ATTR_SET -50
In the <OBJECTS_GENERATION> section:
if KING_OT_HILL create_object VILLAGER { number_of_objects 7 set_place_for_every_player min_distance_to_players 6 max_distance_to_players 6 } create_object KING { set_place_for_every_player min_distance_to_players 6 max_distance_to_players 6 } create_object CASTLE { set_place_for_every_player min_distance_to_players 10 max_distance_to_players 10 } endif
[Update 2017-09-22]: Added the adjustment of starting resources, big thanks to TriRem!
- In rare settings, that may also be two or more kings. ↩
- Random map scripts are organized in sections. ↩
- We actually don’t even need all resources declared. But maybe we want to extend the map later. Adding them doesn’t hurt. ↩
- We ignore civilization “bonuses” here as they do not interfere with what we are doing. ↩
- We can also use units that the players can produce, like villagers or scouts. But that would kind of foil the base idea of Regicide. ↩