Wiki
Battle engine
As battle is an important and complex system, it will be explained in detail on this wiki page.
Definitions
- "Participant": a participant in the battle (see definitions of attacker, main defender and secondary defender).
- "Attacker": a participant in the battle against the defenders.
- "Main defender": a participant in the battle who is targeted by the attackers.
- "Secondary defender": a participant in the battle who assists the main defender.
- "Unit": an element of the "Army" or "Defence" category.
- "Army unit": an element of the "Army" category.
- "Defence unit": an element of the "Defence" category.
Initialization
Parameters
Here are the parameters set during a battle:
- Number of rounds: each unit has the opportunity to attack once per round.
- Wall destruction: the wall used by the main defender may or may not be attacked during battle, depending on this parameter.
- Pillage factor: when the attackers win, this factor defines the percentage of resources that can be looted.
- Citizen elimination factor: when the attackers win, this factor defines what percentage of citizens will be eliminated.
- Targeted infrastructures: when the attackers win, these infrastructures will be attacked at the end of the battle.
Units by participant type
All participants can have army units during a battle. However, only the main defender can also use defence units.
The power of army units can be boosted by certain researches:
- For attackers: "Barbarism".
- For the defenders: "Combat Formation".
Summary | |||
---|---|---|---|
Participant type | Army units | Defence units | Research increasing the power of army units |
Attacker | ✔️ | ❌ | Barbarism |
Main defender | ✔️ | ✔️ | Combat Formation |
Secondary defender | ✔️ | ❌ | Combat Formation |
Use of a wall
The main defender can use a wall in battle to increase the resistance of the defenders' army units. Depending on the parameters, the destruction of the wall can be enabled, so that it can be targeted by attacker units able of inflicting infrastructure damage.
Attack sequence
The attack sequence represents the order in which units will attack opposing units. All units involved in the battle are included. Furthermore, this sequence is sorted in descending order by each unit's initiative. When two initiative values are equal, the defender's unit will have the advantage and attack first.
Execution
For each round of battle, the attack sequence is scanned in sort order and two cases are possible at each iteration:
- If the unit being scanned is an attacker's unit, it can attack infrastructures, wall destruction is enabled in the parameters, and the wall is not destroyed, then this unit will attack the wall with all its power.
- If not, this unit will attack the opponent's units. A unit will attack all opposing targets, however, the strength used against each targeted unit will differ according to certain criteria:
- The percentage represented by each opposing unit in relation to the total number of opposing units.
- The efficiency of the unit that attacks: a unit will always preferentially targeted units against which it is effective.
Examples
Composition used:
- Participant A:
180
bunkers.
- Participant B:
100
conveyors,100
wagons,100
assault tanks.
We are interested in the stage of the attack sequence when participant A's bunkers are about to attack participant B's units.
Example WITHOUT efficiency
To begin with, let us assume the efficiency of participant A's bunkers against each opposing unit is 1
. Of the units targeted, each represents a third of the total units in their side (100 / 300 * 100 ≃ 33.33%
). In this way, each third of participant A's bunkers will attack each of participant B's opposing units.
Result:
60
bunkers of participant A will attack the100
conveyors of participant B.60
bunkers of participant A will attack the100
wagons of participant B.60
bunkers of participant A will attack the100
assault tanks of participant B.
Example WITH efficiency
Now, let us assume that participant A's bunkers have the following efficiencies against participant B's units:
2
against conveyors,1
against wagons,0.5
against assault tanks.
To calculate participant A's new bunker distribution, the number of each targeted unit is multiplied by the respective efficiency against it:
- Let
n1 = 100 * 2 = 200
for conveyors. - Let
n2 = 100 * 1 = 100
for wagons. - Let
n3 = 100 * 0.5 = 50
for assault tanks.
These values are then increased or decreased by a ratio so that the sum is equal to the number of bunkers of participant A. This ratio is defined as: (number of bunkers) / (sum of the numbers of each targeted unit multiplied by their respective efficiency)
. In our example, this ratio is r = 180 / (n1 + n2 + n3)
.
Result:
r * n1 ≃ 102.9
bunkers of participant A will attack the100
conveyors of participant B.r * n2 ≃ 51.4
bunkers of participant A will attack the100
wagons of participant B.r * n3 ≃ 25.7
bunkers of participant A will attack the100
assault tanks of participant B.
Results
The result of a battle depends on three factors:
- The loss of all attacker units.
- The loss of all defender units.
- The condition of an entire elimination of all defenders for the attackers to win.
Therefore, the following results can be obtained:
- The defenders win if the attackers have lost all their units.
- The attackers win if they have at least one unit left and the defenders have lost all their units.
- The attackers win if they have at least one unit left and do not need to eliminate all the defenders to win. This is particularly the case during a pillage operation.
- In all other cases, it is a draw.
When the attackers win the battle, they can perform several actions against the main defender, depending on the parameters:
- Firstly, they can loot resources according to the capacity of the surviving units, the percentage that can be looted depends on the operation and the main defender's "General Alert" research.
- They can also eliminate citizens whenever possible, for example during an onslaught operation. The loss percentage is calculated from the average of the attackers' Domination researches.
- Finally, they can attack infrastructures with surviving units that have this ability, dividing forces equally between them. For example, the Town Hall can be destroyed during an onslaught operation.