Please note that this page is still under construction. All parameters given in bold between braces ( [...] ) are still under revision. We will publish fixed values closer to the closing date.
All players should be able to function in all possible environments - we suggest you make use of the game settings constants and try not to hard code ANY (where possible).
Getting Started: The Game Rules
At the start of the game each player is allocated a number of countries randomly distributed on the board. In addition to player occupied countries, the game starts with a number of "neutral" players, each occupying one country and allocated a random number of units. The neutral players take no turns and make no action other than to defend. Each player occupied country starts with two units and is connected to two other countries: one to the left and one to the right. The countries are organised into a flat, two-dimensional, toroidal shape and are connected in a fixed sequence.
Figure 1: The Toroid Wars Game Board
The players are given a random turn sequence that is fixed at the start of the game. Each player takes their turn in sequence. A complete run of all players is called a Game Turn. The number of Game Turns is fixed depending on the number of players and countries, usually [NORMAL_GAME_TURN_PER_PLAYER] per player.
The game ends when either the maximum number of game turns is reached or one player occupies the whole board. If a player occupies the whole board they are awarded [OCCUPATION_WIN] points. If the game reaches the maximum turns then the player, or players if they have an equal number of countries, with the most country is awarded [DOMINATION_WIN] points. The aim of the game is to occupy as many, or preferably all, countries when the game ends.
Each turn a player must make one of the following actions for each of their occupied countries: attack; scout; transfer; build.
The player may attack either the left or right neighbouring countries as long as the country is occupied by an opponent. The player firstly selects the country to attack and then selects the number of units to attack with. A player cannot attack with all their units and must leave at least one unit in the occupied country but must attack with at least one unit. The number of units a player may attack with is limited to [MAX_ATTACK_UNITS]. An occupied country with only one resident unit cannot attack. Once a player attacks one of the following outcomes will occur depending on the strength, number of resident units, of the target country and the roll of the die (a random element): defeat; victory; conquer. A defending country always defends with either all their resident units or an equal number of units to the attacker, depending on which is least. If the attacking player is defeated, they lose all the attacking troops and the unit count of the attacking country is reduced accordingly. If the attacking player is victorious the defending country loses a number of units equivalent to the number of attacking units. If the number of attacking units is greater or equal to the number of defending, resident, units then the defending player's country is conquered and all the defending the player's units are lost. The attacking country has, therefore, conquered the target country and moves all the attacking units into the newly occupied country. The newly occupied country cannot make an action in the same turn it is conquered, but will act as a normally occupied country in consequent turns.
Note: An exception will be thrown when attempting to transfer units out of a country with too few units or to a country with too many units
Like attack, the player may scout either the left or right neighbouring countries but may scout any country, including their own occupied country. Scouting an occupied country is equivalent to a "skip" turn action. No units are required when scouting however the scout action, like all actions, takes the entire turn; the country may make no other action that turn. The player selects which neighbouring country to scout and does so. The scout action returns the number of resident units in the selected neighbouring country.
The transfer action is another inter-country directional action, where the player must select either the right or left country. A transfer may be made to either an occupied or an opposition country, though this is discouraged as "gifting" units to opponents is not the most effective use of unit resources. The player selects which country to transfer to and selects a number of units to transfer up to a maximum of [MAX_TRANSFER_UNITS]. Like attack, the player must leave at least one unit in the occupied country and so cannot transfer if the country has only one unit. Once a transfer action has been taken, the source country's unit count is decreased by the number of transferred units and the target country is increased accordingly. BEWARE: if the "Unfriendly Transfer" option is enabled then you may transfer units from your occupied country to an opposing player's country. If this option is disabled then you will cause the engine to throw and exception.
The player may take the turn to build one unit. Once the turn is completed the occupied country's unit count in incremented (increased by one). This action is non directional and requires the player to only issue the action. A player may continue building units until a [MAX_RESIDENT_UNITS] is reached. At this point, any build actions will be rejected and the player must make another action.
Notes on Strategy
It is important you think you strategy through carefully. Try to think of the best way to handle many different types of players - from aggressive to defensive players. Also consider what kind of win you want to take and how likely you player is to win at different times in the game?
Consider making a player that does more than decide whether to attack and/or defend. Should you try to consolidate your countries and close any gaps between close countries? Try to make the most of the information made available to you.