Assignment Six: Stratagus


Description

Figure 1: Screenshot of a battle in Wargus

What is Real-Time Strategy?
Real-Time Strategy (RTS) games are simple military simulations (war games) that require the player to control armies (consisting of different types of units), and defeat all opposing forces. In most RTS games, the key to winning lies in efficiently collecting and managing resources, and appropriately distributing these resources over the various game elements. Typical game elements in RTS games include the construction of buildings, the research of new technologies, and combat. Famous RTS games include the Warcraft series, the Command & Conquer series, Ages of Empires etc. Game AI in RTS games determines the tactics of the armies controlled by the computer, including the management of resources. Academics are showing an increasing interest in AI research in RTS games.

What is Stratagus?
Stratagus is a free cross-platform sophisticated real-time strategy engine that can be used to build real-time strategy games. It successfully runs under GNU/Linux, BSD, BeOS, MacOS/X, MacOS/Darwin and Windows. Stratagus uses low-level C code, along with high-level scripts to control the AI opponents. The scripts are written in LUA. LUA is a powerful but surprisingly comfortable scripting language. For more useful information and tutorials on LUA, please refer to the Wiki website. Stratagus includes several scripted AI opponents, each focusing on different strategies such as attacking over land, sea or air. Basically scripts are lists of rules that are executed sequentially. For a list of possible rules, please refer to the AI API documentation for Stratagus.

What is Wargus?
Wargus is not a stand-alone game but a mod that implements a Warcraft II clone. Wargus is not completely true to the original Warcraft II experience because it uses a different engine. However, Wargus is close enough to the original that Warcraft II strategies, which are collected in numerous strategy guides available on the Internet, are applicable to Wargus. Figure 1 illustrates Wargus. The figure shows a battle between an army of “orcs”, which approach from the bottom right, and an army of “humans”, which attempt to defend a base consisting of several buildings.

Note: You are legally required to own a copy of the Warcraft II game to run Wargus.

Assignment

Your assignment is to define a new AI player in Wargus. Your AI should be fit to battle three strategies: (1) land-attack, (2) soldier’s rush and (3) knight’s rush. We will test these strategies on two maps: a large (Scandinavian) and small (Little Ambush) map. You can use the custom_script.lua in the data.wargus\scripts\ai directory to define your AI. Custom_script.lua uses a similar design as the existing scripts. The script is divided into two parts: a main and end section. The main body consists of a list of API calls (i.e., rules) and is traversed only once. The rules in the main body are executed sequentially. To assure that an AI player will continue running when all rules in the main body have been executed, an end loop is implemented. The main body should be used to define your actual strategy (e.g., decisions on the building order, acquiring appropriate technologies and combat), the end loop should be used to initiate continuous attacks on the enemy. Please note, that you are allowed (encouraged) to use a different design as discussed above (and employed by the other existing scripts). Your job is to create the best AI you can. After some experimenting, you will discover the limitations of scripting and realize that creating a sophisticated AI using the simple AI API in Stratagus, is extremely difficult (or even impossible). To create truly ‘human-level’ AI, you will need more control over the AI e.g., changing the low-level C code. However, this is out of scope for this assignment.

Testing your AI

Once you have finished your AI, you can test it against other strategies. Start a single player game and select the desired scenario (map/strategy). By default the small map is selected. In this scenario your custom script will battle the land-attack strategy. This is not a very hard strategy to beat. It is balanced in the sense that it focuses equally on defense, offense and research. The knights-rush map is a larger map and the knight’s rush strategy employed by the opponent AI, focuses on early technological advancement. When strong units are available, it will attack with large groups of soldiers. The soldiers-rush map, uses the same map as used in the first scenario, but now your opponent AI will be defined by the soldier’s rush. Before starting the game, you must set the game type to ‘Machine vs Machine’ (see Figure 3). This will enable a game between AI players. You can speed up experiments by increasing the game speed in the options menu or you can run the fast forward mode where graphics are partially turned off, resulting in fast experiments. To do this press enter while a game is being played, and then type 'ffw ', e.g., ffw 20000 will fast forward the game to game cycle 20000.

 

You can change the opponent AI player in the Stratagus map editor. In the main menu, start the editor and load a map. Once the map is loaded, you can choose opponent strategies in the Player Properties window (see Figure 2). Since custom_script defines your AI, make sure custom_script is defined for player #0. Figure 2 shows three AI players using respectively the custom, knight’s rush and soldier’s rush strategy.

 

Figure 2: Player properties window

Figure 3: Single Player Game Setup window

 

 

                                                                       

Figure 4: Wargus Competition

For our Wargus competition we will play your AI against the other AIs your classmates designed. The setup is similar to the setup we used for the robocode and coderuler competition. However, this competition will be a knockout competition, meaning that we won’t have a losers bracket. We will start with the quarterfinals. The teams that win, progress to the semi final and so forth.

You will need to turn in your ruler before the due date. There are three parts to this assignment:

  1. Script (custom_script.lua)- Once your script is done, send it to me. [40%]
  2. Writeup - Writeup - A write up of the ideas you used in creating your strategy. If you use a different design for your AI compared to the sample scripts, please explain how and why you choose this design. Please include in the writeup some text explaining what you have tried to achieve with your AI, but also explain what prevented you from implementing your original idea. By now, you probably experienced for yourself the limitations of the Stratagus AI. Please include a description of what you think is definitely necessary to implement sophisticated AI in a RTS game. [40%]
  3. Presentation - A 1-3 slide power point presentation giving the basics of your script design. [20%]

Frequently Asked Questions

Here is the current FAQ in plain text.