Assignment Four: Stratagus/Wargus
Email any
questions to
Xavier
Otero Keil - xok210@lehigh.edu
Joseph Siefers - jjs204@lehigh.edu
Kristen
Gardner - kcg2@lehigh.edu
Installation
To install Wargus running on the Stratagus
engine download our custom installer here. Then simply run it and
it will put shortcuts to the game on your desktop as well as your start menu.
Do not change the install location because that will cause problems with your
game. It installs by default to C:\Program Files\Wargus
the installer by default does not allow you to change this and you should not
attempt to.
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. Your performance against these AI’s will determine seeding for the tournament of AI’s created by your classmates. 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 (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. See the example scripts for help with formatting and syntax. Also the API has a listing of all unit, building, and research types available. Keep in mind that this scripting language only allows for some very simple rules. Basically you define build order and when you should attack and that is it. You have no direct control of the attacks or placement of structures or anything like that. Also a good thing to keep in mind is that you also do not control the casting of spells. If you research spells Stratagus will decide when to cast them for you. I highly recommend doing this because Stratagus is highly effective at spell casting.
Good things to know:
1. You do not need to control the building of farms done automatically
2. You do not need to control the collection of resources also done automatically Just use the AI set collect to set the ratio of resources you would like. I prefer 50% gold 50% wood for early game then switch to more gold in late game
3. You do not need to rebuild buildings that are destroyed, that is done automatically.
4. Wargus is basically Warcraft 2 so if you can find a guide on the internet for Warcraft 2 you are good to go.
Test 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’ 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
The
Competition
The Wargus
competition will be single elimination bracket based tournament seeded by your
performance against the example scripts. Each battle will consist of 8 separate
games. After much research into why there are large advantages for different
scripts depending on maps I found several flaws in the Stragatus
Machine vs Machine system. The system is full of
inefficiencies that are dependent on the map. Basically the path finding gets
really screwed up depending on the surrounding terrain. And since the scripting
language does not let you do anything other than basically specify build order
this can cause a distinct advantage for one starting point. There is also some
odd handling of attacking forces that results in the higher player number
getting higher priority for their attacker’s path finding. We have designed a
fair map that gets around these issues that will be used for the tournament.
There are 4 starting locations on it and basically you play from each of them
giving everyone a fair chance to win. On this map if you play the same script
against itself it is so fair that sometimes it will tie by running out of
resources and there being no victor. However if this does not occur the score
is always 4 to 4 wins. And if you play one script against an inferior one the
stronger one always wins. Like soldiers rush vs
knights rush the soldiers always win. Also the bottom right has about the same
win percentage as all the other starting locations unlike before when starting
there was almost a guarantee of victory.
Another side note: For the competition you will be restricted to playing
as humans. This actually works in your favor since it is easier to write the
script without detecting your race. However the real reason for it is that orcs for unknown reasons cause problems with Wargus and give the player using them an unfair advantage.
For this reason you will not be allowed to select your race. Also orcs want to kill all humans!! and
I am not down for that.
Hints: the competition map has huge amounts of resources and is very
large. Also there is never a direct path to your enemy there are many obstacles
in the way. Also there is no water in any of the maps where you will be tested.
The maps you will be tested on are very different from the maps that come with
the game. If you want you can create your own map that is similar to this vague
description in the editor and test on that.
One more side note: Depending on my ability to get this working reliably
we may have an Insane Final Battle where all teams are on a small map and have
to battle it out. Probably not though since having this many
players causes hard to define difficulties. Try it yourself if you don’t
believe me.
PS I will not release the tournament or the test maps to you until you
have turned in your final script.
You will need to turn in your
scripts the night before the due date. There are three parts to this
assignment: