Endlich reich!

Aus der beliebten Reihe “Zemantek recherchiert”, heute: Wie reicht kann man mit der Mensa-Card des Studierendenwerks werden?

Das Studierendenwerk Bonn bietet in seinen Mensen die Bezahlung mit der hauseigenen “Mensa-Card” an. Die Mensa-Card ist eine Chipkarte der Machart “Mifare Classic” und ist in allen Mensen sowie am Infopunkt des Studierendenwerks in der Mensa Nassestraße erhältlich. Sie kann neben der Bezahlung in den Mensen auch noch zur Bezahlung in den Waschkellern der Studierendenwohnheime genutzt werden.

An Aufladeautomaten lässt sich die Mensa-Card mit Geldscheinen aufladen. Wird mindestens ein Zehn-Euro-Schein eingeschoben, so legt das Studierendenwerk nochmal 3 % des Aufladebetrags als Bonus obendrauf. Das macht bei 10 € Aufladung also 30 ct zusätzlich.

Bei Rückgabe der Mensa-Card an einer Mensakasse werden der Restbetrag und das Kartenpfand wieder erstattet.

Findige Studierende bemerkten schon früh, dass sich mit der Mensa-Card verzögerungsfrei 3 % Rendite generieren lassen. Doch wie weit kann man das treiben? Getestet und dokumentiert wurde dies meines Wissens noch nicht. Bis jetzt!
Mehr

Everything is Regicide with UserPatch 1.5

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.

Everything is Regicide with UserPatch 1.5

The reference text for guard_state from the UserPatch 1.5 beta documentation.

Our plan for creating a King of the Hill Regicide map is as follows:

  1. Take practically any old random map script
  2. Place a king unit, even if the game mode is not Regicide
  3. Use guard_state to make a player lose if the player does not control any king unit
  4. Maybe adjust the starting resources
  5. Play the map with the King of the Hill game mode
  6. 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.

Everything is Regicide with UserPatch 1.5

This is a fake screenshot that I took with the HD edition because I wanted an image in this article, but did not want to reboot my computer in order to start up Voobly.

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!

  1. In rare settings, that may also be two or more kings.
  2. Random map scripts are organized in sections.
  3. We actually don’t even need all resources declared. But maybe we want to extend the map later. Adding them doesn’t hurt.
  4. We ignore civilization “bonuses” here as they do not interfere with what we are doing.
  5. 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.

Understanding Relic Teleportation Behaviour in Age of Empires II

Relics can be a key element in Age of Empires II gameplay. Scattered all over the map, they can be collected by players using monks, therefore usually only in Castle and Imperial Age. Once in your monastery, they generate 0.5 Gold per in-game second, 0.67 even if you’re playing as the Aztecs. If you happen to collect all the relics on the map, you win after holding onto them for 200 in-game years.

The most frequently asked question regarding relics probably is:

What happens if I pick up a relic with a monk, put that monk in a transport ship, then delete the transport ship?

When a transport ship is destroyed, all units aboard are destroyed as well. Through divine intervention however, the relic carried by the monk is not destroyed, but magically reappears on land. But how and where? After intensive testing, we are today able to present all the answers to the questions you never dared ask yourself.

Where exactly does the relic reappear?

When the transport is sunk, the relic reappears at the spot where the monk entered the transport ship. This may actually be quite far away. The relic does not reappear at the closest shore.

What happens if the relic has not been loaded, but has been inside the transport ship the whole time?

This probably falls into the category “useless knowledge”, but then again, so does this whole article. In the scenario editor, we can directly put a monk carrying a relic inside a transport ship. When that ship is destroyed, the relic reappears at the ship’s starting position – floating on the water.

Understanding Relic Teleportation Behaviour in Age of Empires II

It’s magic! But so is religion in AoE, I guess.

What happens on shallows or the mangrove shallows?

Shallows are unique in that both ships and land units can travel over them. Mangrove shallows, introduced in Rise of the Rajas, are unique in that both ships and land units can travel over them and buildings can be built on them. So one might assume that the relic is unloaded and placed right where the ship dies. Nope, it reappears again at the spot where it had been loaded into the transport ship. From a programmer’s point of view, this is the correct behaviour, as it removes the need to program additional logic into the game.

What happens if the reappearance spot is blocked by a building?

When the transport ship dies, the spot where the relic is supposed to reappear might already have been put to different use and a building might occupy the place. Turns out that the relic ignores the building entirely. Relic sees ya, relic don’t care.

Understanding Relic Teleportation Behaviour in Age of Empires II

Anyway, here’s (a relic on your) wonderwall.

Capture the relic pro tips

There is a map for the capture the relic gamemode (CtR) which has an island with the relic in the middle, islands with the players on them in a circle along the edges of the map, and shallows in between. On this map, players like to use ships to attack the monks transporting the relic, and transport ships to move the relic, as a transport ship is much quicker than a walking monk.

If your transport ship is being attacked on the way back to your base and going to die, you should probably unload the monk. This may at first be counter-intuitive, as the monk can then directly be attacked by enemy ships and will probably die quickly. In this case however, it drops the relic on the spot, which is probably a lot closer to your base than the island in the center of the map, where the relic would teleport to if it sunk inside your transport ship. This effectively brings the relic closer to you and makes it easier to come back later and snag it.