Age of Empires II – hszemi.de https://hszemi.de the only difference between screwing around and science is writing it down Sun, 08 Apr 2018 16:03:27 +0000 de-DE hourly 1 https://wordpress.org/?v=4.9.5 Everything is Regicide – now with Treason https://hszemi.de/2018/04/everything-is-regicide-now-with-treason/ https://hszemi.de/2018/04/everything-is-regicide-now-with-treason/#respond Sun, 08 Apr 2018 16:01:34 +0000 https://hszemi.de/?p=3573 Mehr]]> In Everything is Regicide with UserPatch 1.5 I described how to turn any random map script into a custom regicide map, with the help of UserPatch 1.5 and the guard_state command.

However, regicide is only half the fun without the Treason1 technology. For the mere cost of 400 gold, it briefly reveals the positions of all enemy kings. Treason can also be researched repeatedly, making it easier for you to hunt those kings down and eventually kill them, defeating the player instantly.

Treason is only available in regicide games, where it replaces the Spies technology2. Treason could hence not be used on the custom regicide maps above. The latest update of UserPatch 1.5 however allows us to manually enable the technology in our random map script, without the use of any mod!

Adding Treason to Custom Regicide Maps

First we need to define three constants at the top of the script (if they are not defined already):

#const GAIA_SET_PLAYER_DATA -10
#const DATA_MODE_FLAGS 1
#const ATTR_SET 0

Now we can mess with the availability of Treason and Spies in the <PLAYER_SETUP> section by adding an effect_amount command:

<PLAYER_SETUP>
  […]
  effect_amount GAIA_SET_PLAYER_DATA DATA_MODE_FLAGS ATTR_SET 1

The value 1 at the end enables the Treason technology, the value 2 disables the Spies technology, and the value 3 does both (so Treason is available while Spies is not).

I have of course updated all the custom King of the Hill Regicide maps over at Github to include both Treason and Spies: click me

Have fun!

Does it have to be a king?

The guard_state option not only works with kings, but with arbitrary units.

Supposedly, Treason also works with other units that a guard_state is set for. If there is a king, it is revealed, else one guard_state unit is revealed. This behaviour is not necessarily ideal, but without doubt better than before.

  1. (the medieval kind)
  2. For the mere price of 200 Gold per enemy villager (min. 200, max 30.000), Spies reveals the line of sight of all enemy players‘ units.
]]>
https://hszemi.de/2018/04/everything-is-regicide-now-with-treason/feed/ 0
Everything is Regicide with UserPatch 1.5 https://hszemi.de/2017/09/everything-is-regicide-with-userpatch-1-5/ https://hszemi.de/2017/09/everything-is-regicide-with-userpatch-1-5/#respond Thu, 21 Sep 2017 22:43:38 +0000 https://hszemi.de/?p=3220 Mehr]]> 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.

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.

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.
]]>
https://hszemi.de/2017/09/everything-is-regicide-with-userpatch-1-5/feed/ 0
Understanding Relic Teleportation Behaviour in Age of Empires II https://hszemi.de/2017/09/understanding-relic-teleportation-behaviour-in-age-of-empires-ii/ https://hszemi.de/2017/09/understanding-relic-teleportation-behaviour-in-age-of-empires-ii/#respond Sun, 17 Sep 2017 20:56:39 +0000 https://hszemi.de/?p=3208 Mehr]]> 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.

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.

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.

]]>
https://hszemi.de/2017/09/understanding-relic-teleportation-behaviour-in-age-of-empires-ii/feed/ 0
Spaß mit der Reliquieneroberung https://hszemi.de/2017/06/spass-mit-der-reliquieneroberung/ https://hszemi.de/2017/06/spass-mit-der-reliquieneroberung/#respond Sun, 04 Jun 2017 21:17:41 +0000 https://hszemi.de/?p=3044 Mehr]]> Es gibt da diesen speziellen Spielmodus in Age of Empires II, die Reliquieneroberung. In der Mitte der Karte befindet sich eine Reliquie, und es gewinnt, wer die Reliquie im eigenen Kloster platzieren kann. Es können keine neuen Klöster gebaut werden, dafür sind die Klöster, von denen jede Person zu Beginn jeweils eines besitzt, praktisch nicht zerstörbar1.

Nimm mich! Und setz mich in dein Kloster!

Spielt man Reliquieneroberung als Team, kann die Reliquie auch im Kloster eines Teammitglieds platziert werden.

Ich bin blau und platziere die Reliquie im Kloster meines roten Teammitglieds. Gewonnen!!!!!

Nun kann es aber passieren, dass das Teammitglied unterwegs den Geist aufgibt und aus dem Spiel ausscheidet. Das Kloster wird dann aber in der Regel noch herumstehen. Und natürlich kann die Reliquie weiterhin darin platziert werden.

Du wunderst dich zurecht, kleiner Mönch.

Stellt sich raus: Das Spiel prüft offenbar regelmäßig für jede aktive Person, ob sich im Kloster eine Reliquie befindet. Wer eine Reliquie im Kloster hat, gewinnt das Spiel für das eigene Team. Setzt man die Reliquie ins Kloster einer ausgeschiedenen Person, wird das Spiel hingegen nicht gewonnen, da die Abfrage hier nicht mehr durchgeführt wird. Wer schon verloren hat, kann schließlich nicht mehr gewinnen!

Da hilft nur eins: Schweres Gerät muss ran, um die Reliquie wieder aus dem Kloster zu holen.

So ein Belagerungsonager zieht gerade mal 9 Lebenspunkte ab… Da dieses Kloster 9999 Lebenspunkte hat, geht man besser einen Kaffee trinken.

Anschließend kann die Reliquie immer noch ins eigene Kloster verbracht werden. Sieg!

Yay.

Im regulären Spiel generiert eine Reliquie im Kloster ja langsam Gold. Allerdings nicht mehr, sobald man verloren hat. Daher hat Johanna auch in den Errungenschaften 0 Reliquien-Gold. Fies.

  1. Mit 9999 Lebenspunkten und ordentlich Rüstung sehr schwer. Dazu später mehr.
]]>
https://hszemi.de/2017/06/spass-mit-der-reliquieneroberung/feed/ 0
Spiel ohne Sieger https://hszemi.de/2017/01/spiel-ohne-sieger/ https://hszemi.de/2017/01/spiel-ohne-sieger/#respond Sun, 01 Jan 2017 22:52:45 +0000 https://hszemi.de/?p=2827 Mehr]]> Age of Empires II ist zweifelsfrei eins der besten Echtzeit-Strategiespiele, die es so gibt.

Im Spielmodus „Königsmord“ (das Spiel ist im Mittelalter angesiedelt, als so etwas wohl üblich war) kontrolliert jede der bis zu 8 Mitspielerinnen und Mitspieler eine Königsfigur. Sobald die stirbt, scheidet man aus und hat verloren.

Die wahrscheinlich fetteste Figur im ganzen Spiel, aber sauschnell. (Screenshot: Age of Empires II)

Diese Mechanik fügt der Aufbau- und Schlachtsimulation also noch ein Sudden-Death-Element hinzu. Am Ende gewinnt die Person oder das Team, dessen/deren König noch lebt.

Siegreiche Personen bekommen in der Endstatistik ein Krönchen.

Hurra! Gewonnen! In diesem Fall aber, es musste schließlich schnell gehen, nur gegen Computergegner und durch Cheats. Aber psscht! (Screenshot: Age of Empires II)

Doch hat ein Königsmord-Spiel immer eine Gewinnerin/einen Gewinner? Konkret: Was passiert, wenn alle Könige sterben? Das bedeutet zwangsläufig, dass die letzten Könige zeitgleich das Zeitliche segnen, denn sobald das Spiel gewonnen ist, hält es an.

Zunächst widmen wir uns der Frage, wie so etwas bewerkstelligt werden kann.

Idee 1: Der Belagerungsonager

Ein Onager verursacht Flächenschaden. Es ist also theoretisch möglich, die beiden letzten Könige im Bereich des Flächenschadens zu platzieren.

Das Problem: Ich habe es spontan nicht geschafft, dass beide Könige zeitgleich sterben. Für die praktische Anwendung ist das also zu unzuverlässig, man müsste ihnen vermutlich vorher eine gewisse Menge Schaden zufügen, damit das verlässlich klappt.

Idee 2: Das Transportschiff

Versenkt man ein Transportschiff, so werden auch alle sich darin befindlichen Einheiten entfernt. Steckt man also beide Könige in das selbe Transportschiff und versenkt das dann, sterben die beiden Könige theoretisch zeitgleich.

Wie so etwas in der Praxis ausgeht, sehen wir hier:

Die Errungenschaften-Übersicht führt konsequenterweise bei keinem Spielernamen ein Krönchen auf.

Das Sternchen bekommt der Spieler mit der höchsten Punktzahl, die ist jedoch im Spielmodus „Königsmord“ extremst zweitrangig. (Schreenshot: obiges Video)

Bleibt die auch im Video aufgeworfene Frage: Kann man nicht einfach Bloodpriest den Sieg zusprechen, da er laut Chatverlauf als letztes gestorben ist?

Selbstverständlich habe ich intensiv getestet, wie diese Reihenfolge der Chatausgabe bestimmt wird.

Ich vertrete nach diesen ganzen Tests die Theorie, dass die Tode immer gemäß der internen Spielerreihenfolge ausgegeben werden – unabhängig davon, wessen Transportschiff versenkt wird und in welcher Reihenfolge die Figuren auf das Schiff gesetzt wurden. Das heißt, dass in diesem Fall Bloodpriest immer „gewinnt“, weil seine Spielernummer einfach höher ist als die von n1ghthavvk.

Oft vergehen ein, zwei Sekunden zwischen dem Tod eines Königs und der Meldung, dass eine Person verloren hat. In manchen Konstellationen besitzen alle Personen auch zwei Könige, die dann beide erledigt werden müssen, damit man ausscheidet.

Ich mutmaße deshalb, dass das Spiel intern einfach periodisch der Reihe nach alle Personen abfragt, ob noch mindestens 1 König lebt, und sie für tot erklärt, falls das nicht mehr der Fall ist. Das würde auch die konsistente Todesreihenfolge im Chatverlauf bei meinen Tests erklären.

Aus technischer Sicht haben also alle Spieler verloren. Daher hat auch niemand ein Krönchen.

Das hat übrigens einen amüsanten Nebeneffekt. Bei Online-Spielen über Steam startet man auf einem persönlichen Level von 1600 Punkten. Verliert man ein Spiel, verringert sich das Level, gewinnt man ein Spiel, so erhöht es sich. Die genaue Punktzahl um die das Level sich erhöht oder verringert ist abhängig vom Level des gegnerischen Teams: Gewinnt man gegen Personen mit hohem Level, bekommt man mehr Punkte, verliert man gegen Personen mit hohem Level, so verliert man weniger Punkte, und umgekehrt.

Falls sich nun in einem Königsmord-Spiel mit Wertung beide Könige auf dem selben Transportschiff befinden und dieses anschließend versenkt wird, so verlieren beide Personen Punkte! Falls zwei Personen also zufällig schnell Punkte verlieren möchten…

]]>
https://hszemi.de/2017/01/spiel-ohne-sieger/feed/ 0