Laufband-GIFs erstellen

Hier ein kleines Tutorial für die Feiertage, das euch zeigt, wie mit relativ wenig Aufwand Laufband- oder auch Spruchband-GIFs erstellt werden können.

Wir beginnen mit dem Endprodukt: So könnte das Ergebnis aussehen.

Laufband-GIFs erstellen

Zunächst überlegen wir uns, welche Dimensionen das fertige Laufband haben soll. Für das Tutorial wähle ich 100×40 Pixel aus.

Dann gestalten wir das komplette Bild das später durchlaufen soll. Die Höhe ist der eben festgelegte Wert, die Länge ist theoretisch beliebig.

Laufband-GIFs erstellen

Beachtet, dass das Laufband am Anfang und am Ende einen neutralen Bereich hat, der mindestens so breit ist wie das fertige Laufband. Im Beispiel sind das die >100px breiten grünen Randbereiche.

Laufband-GIFs erstellen

Nun benötigen wir eine Kommandozeile und das imagemagick-Paket1. Im Ordner in dem das volle Laufband liegt erstellen wir einen Unterordner “einzelbilder”. Jetzt müssen wir ein bisschen rechnen: Wir benötigen die Breite des vollen Spruchbands minus die Breite des fertigen Spruchbands. In unserem Beispiel ist das also 550 – 100 = 450.

Den Wert setzen wir statt des X in den folgenden Befehl ein und führen ihn aus (falls der Dateiname des Laufbands anders ist, muss dieser natürlich auch angepasst werden):

for i in {000..X..2}; do convert -crop 100x40+$i+0 +repage laufband-komplett.png einzelbilder/$i.png; done

Im Beispiel führen wir also den folgenden Befehl aus:

for i in {000..450..2}; do convert -crop 100x40+$i+0 +repage laufband-komplett.png einzelbilder/$i.png; done

Im Ordner “einzelbilder” werden nun die Dateien 000.png bis 450.png angelegt.

Was passiert hier genau? Das Bild wird von 0 bis 450 in zwei-Pixel-Schritten “abgetastet” und immer ein 100×40 Pixel großer Bereich herausgetrennt und als separates Bild gespeichert.

Laufband-GIFs erstellen

Der nächste Befehl den wir ausführen fügt all die Einzelbilder zu einem animierten GIF zusammen:

convert einzelbilder/*.png animiert.gif

Laufband-GIFs erstellen

Das sieht doch schon vielversprechend aus!

Nun wollen wir die Animation noch etwas flüssiger laufen lassen. Hierzu öffnen wir die Datei in GIMP.  Die einzelnen Animationsschritte werden in GIMP als Ebenen dargestellt. Das interessiert uns jedoch nicht weiter, sondern wir führen den Befehl “Filter > Animation > Optimieren (für GIF)” aus. Dieser erstellt eine kleinere Kopie des GIFs in einem neuen Tab.

Zu guter Letzt exportieren wir diese Datei per “Datei > Exportieren als…” in eine Datei mit der Endung “.gif”. In den Exporteinstellungen wählen wir “Als Animation” aus, in den Optionen für animierte GIFs im selben Fenster wählen wir dann “Schleife endlos wiederholen”, setzen als Pause 17 Millisekunden, als Einzelbildübergang “Kumulative Ebenen (Kombinieren)”, und wählen sowohl “Obige Pause für alle Einzelbilder verwenden” als auch “Obigen Übergang für alle Einzelbilder verwenden” aus. Ein Klick auf “Exportieren” speichert das Endprodukt.

Frohe Weihnachten!

Laufband-GIFs erstellen

  1. Ob das installiert ist seht ihr, wenn ihr in der Kommandozeile “convert” ausführt. Falls das Kommando nicht gefunden wurde, installiert das imagemagick-Paket nach.

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.

Eine Wand voller Bibliotheksbarometer

Die ULB hat seit neuestem einen neuen Service: Ein Nutzungsbarometer. Das funktioniert folgendermaßen: Das Hochschulrechenzentrum misst stündlich, wie viele Clients an den WLAN-Access-Points in den Bibliotheken angemeldet sind, und stellt diese Daten zur Verfügung. Ein Skript auf der ULB-Webseite ruft diese Daten ab und erzeugt daraus eine süße Balkengrafik.

Die URL die hierfür aufgerufen wird sieht folgendermaßen aus:

https://temilun.ulb.uni-bonn.de/ws/apVIZ/_wlanapdata.php?day=2017-07-29

Wie man sieht kann man einfach das Datum am Ende anpassen, um Daten für andere Tage zu erhalten. Ein kurzer Test ergibt, dass die API vergangene Daten bis zum 24. Januar 2017 ausspuckt.

Und außerdem gibt es Daten für den Zeitraum 03.11.2014 – 19.08.2015. Warum auch immer ¯\_(ツ)_/¯

Ebenfalls interessant: Während die ULB noch schreibt, dass derzeit geprüft wird, ob dieser Service für die Abteilungsbibliothek MNL ebenfalls angeboten werden kann, liefert die API die nötigen Daten bereits aus.

Man könnte also bereits eine Seite basteln, die für die ULB (Adenauerallee) und die MNL (Nussallee) die aktuelle Auslastung sowie die der vergangenen Woche anzeigt.

Eine Wand voller Bibliotheksbarometer

Code auf GitHub