Post1
This is a special thread, please read Post 2 below, which contains instructions for use.
*****************************************
THIS THREAD HAS BEEN UPDATED AND MOVED TO THE CIV2 STRATEGY FORUM. PLEASE FOLLOW THIS LINK:
Info: Combat (GL)
ALL CONTINUING DISCUSSION SHOULD BE POSTED THERE.
*****************************************
Combat Modifiers and Calculation
BASICS
1.1 Combat occurs when a unit with an attack value greater than 0 attempts to enter a square occupied by a unit of another civilization.
1.2 A battle results in the destruction of one unit or the other. If the primary defender is destroyed, all other defenders (stacked) in the same square are also destroyed unless:
1.3 Units involved in combat usually sustain damage. Damage is shown in the unit's strength bar by color and percentage.[list=a][*] Green: 2/3 to full strength[*] Yellow: 1/3 to 2/3 strength[*] Red: less than 1/3 strength[/list=a]
1.4 Except for air units, damaged units have reduced movement points approximately proportional to the damage. However, land units will never have less than 1 movement, and sea units will never have less than 2. The proportion of damage is rounded to the nearest integer, but never less than the minimum for that unit.
CMP = CHP/HP * MP + 0.2
CMP...current movement points
CHP...current hit points
HP...(maximum) hit points (from rules.txt)
MP...(maximum) movement points (from rules.txt)
1.5 Ground units can only attack other ground units. Exceptions: Helicopters can be attacked by ground units. A sea or air unit may be attacked if it is the primary defender in a city or airbase.
1.6 Air units can attack only ground or sea units, except those (fighters) with the "Can attack air units" flag. Air units attacking ground units ignore city walls.
1.7 Sea units can attack other sea units or ground units occupying a land square (including cities) adjacent to a sea square. They may also attack air units caught on the ground in a city or airbase. Units with the "Submarine advantages/disadvantages" (submarines, thus) cannot attack land units. A sea unit attacking a land unit is called shore bombardment.
1.8 Special domain 3 units can be attacked by any other unit, regardless of flags. Domain 3 units can attack any other unit, and they ignore city walls, SAMs, and coastal fortresses.
UNIT COMBAT FACTORS
Units have four basic factors figured into the calculation of a combat result: attack strength, defense strength, hit points, and firepower.
2.1 Attack strength is the likelihood of inflicting damage when attacking an opponent. Units with 0 attack strength cannot initiate combat.
2.2 Defense strength represents the ability of a unit to defend itself when attacked; It is the likelihood that damage will be inflicted on an attacking unit.
2.3 Hit points indicate how much damage a unit can withstand before it is destroyed. The true number of hit points is the hp value x10. A 2hp unit thus has 20 hit points.
2.4 Firepower indicates how much damage a unit can inflict in a round of combat. A successful round reduces the opponent's total hit points by the value of the unit's firepower.
ADJUSTMENT FACTORS
Many factors affect the four basic Unit Combat Factors, depending upon the circumstance of the battle. All factors that apply as percentages are multiplied together.
3.1 Veteran units receive a +50% bonus for both attack and defense strengths
3.2a Fortified units receive a +50% bonus for defense strength. This bonus applies only on the next turn, after the unit appears with the dirt entrenchment, not while in the process of fortifying. This bonus is superceded by fortress improvement (3.2b) and city walls (3.4). It can be used in combination with a SAM battery (3.5) or a coastal fortress (3.6). Air units caught fortified in an air base do not enjoy this bonus. Air units in unwalled cities do, however, gain a (possibly more than) doubled defense, as if in a fortress improvement.
Test: Do sea units benefit from this?
3.2b The fortified bonus increases to +100% for a unit occupying a fortress improvement, whether given the order to fortify or not.
Test: When a city is built on a square that is having the fortress improvement built gain defensive benefit from the fortress? Is this bonus enhanced or superceded by city walls?
3.3 Terrain increases defense strength by:[list=a][*] +50% if on forest, jungle, or swamp[*] +100% if on hills[*] +200% if on mountains[*] +50% if on a river, enhancing any other terrain bonus.[/list=a]
Test: Do sea and air units also gain this advantage when on land?
3.4 City walls triple the defense value of city defenders against attacks by land units.
Test: Do ships caught in port benefit from city walls? It needs to be tested more... my quick test says NO for both sea and air units. If so, city walls only benefit land units.
3.5 SAM batteries double the defense value of city defenders against attacks by air units.
Test: Do ships caught in port benefit from SAMs?
3.6 Coastal fortresses double the defense value of city defenders against attacks by naval units.
Test: Do air units or ships caught in port benefit from coastal fortresses?
3.7 Some flags (in rules.txt) can alter combat calculations as follows:
3.8 Partisans gain an attack advantage against non-combat units (any with attack value = 0). Their firepower is increased significantly, perhaps as high as 10x.
3.9 Shore bombardment: When a naval unit attacks a land unit, both units have their firepower reduced to 1. A sea unit's firepower is reduced to 1 when it is caught in port by a land unit.
3.10 SDI defenses thwart any nuclear attack (except those set by spies) within 3 squares of the city in which it is built.
3.11 Nuclear missiles have a special attack value of 99. Unless thwarted by an SDI, this sidesteps any combat result calculations. If a missile attacks a target, a strike results. This kills all units within one square of the strike, causes pollution, and reduces the population of any city within the radius by half.
3.12 Barbarians do not always attack and defend at normal unit strengths. Barbarian archers defend with a base value of 1, not 2. Other barbarian units have normal defense values. All barbarian attack factors are affected by the difficulty level of game being played:
3.13 Sneak attack! A sneak attack seems to give an advantage to the attacker. This is currently being tested (see the thread Does it pay to be sneaky?) to determine how great this advantage is.
THE COMBAT FORMULA
First, some background. The manual provides a simplified combat formula to approximate the likely outcome of a combat. This formula states that the total modified attack and defense factors are combined; The probability of victory is approximately the ratio of the unit's factor to the total. In other words,
U / (a + d)
where
U = the unit's modified factor,
a = the attacker's modified attack factor, and
d = the defender's modified defense factor
This approximation has proven insufficient for many Apolytoners. Much debate has resulted in a more detailed formula. First, an explanation of what it entails. For explanatory purposes, a combat is a single round, a battle the cumulative result of all combats.
The attacker and defender each own a portion of the total modified attack and defense values proportional to their value, as the simplified formula, above, expresses. For each combat, a winner is determined by this ratio. In simple terms, the higher modified value is more likely to win a combat. For each combat won, the opponent reduces its hit points by the winner's firepower. This continues until one unit is reduced to zero hit points and is thus destroyed.
Heated discussion of a simplified combat formula led to several ideas being put forth. The one that most closely gives the results of the complex formula is:
Odds = (S + (S - W)) * Shp * Sfp / (W * Whp * Wfp)
where:
S = Stronger unit's modified attack or defense value
W = Weaker unit's modified attack or defense value
Shp = Stronger unit's hit points
Sfp = Stronger unit's firepower
Whp = Weaker unit's hit points
Wfp = Weaker unit's firepower
No playtesting results to test the accuracy of this formula have surfaced.
On to the real calculation...
Each unit gets a randomly generated number from 0 to its modified value minus one, multiplied by a constant. This constant has been best-guessed (based on play testing) to be 8. The unit with the higher random number wins the combat, ties going to the defender.
Where A = (a * 8) and D = (d * 8). The resulting p is the odds of the attacker winning the combat. To calculate the odds of the attacker winning the battle, p is plugged into the equation
P = SUMn(COMB(n-1,dh-1) * (p^dh) * (1-p)^(n-dh))
Where "n" is summed from dh to dh+ah-1.
ah = Attacker's modified hit points
dh = Defender's modified hit points
p = probability for attacker to win combat round
P = probability for attacker to win battle
Note: Modified hit points: An opponent's total hit points are divided by the unit's firepower. Thus an attacker with 2fp halves the defender's total hit points.
Comments:
This formula accounts for damaged units, as the input is the unit's current hit point total.
In layman's terms, P is the sum of the probabilities of the all possible outcomes of the attacker winning; For example, the odds of the attacker winning ten straight combats, plus that of winning ten out of eleven, plus that of winning ten out of twelve, and so on, added together to produce a grand total. The maximum number of rounds is the attacker's and defender's total hit points minus one. Basically, until the winner is left with a single hit point after destroying the loser. The defender's chance is (1 - winner's probability).
For those unable to decipher the above mathematics,
Units with 0 defense can occasionally win because it generates a number between 0 and 0 (0, thus), and the attacker can also end up with a 0. The tie goes to the defender, meaning he wins that combat round. A damaged unit, or one attacking at partial strength (after using part of its movement allowance), can on rare occasions end up on the short end of this possibility.
An Example
Veteran Artillery and Armor units attacking veteran Riflemen behind city walls. The formula stacked up to artillery, but was off slightly with the armor results. Marko Polo tested ten sets of ten attacks with each unit. Other tests to verify this formula, excepting one, have used a minimum of 234 attacks.
Artillery (10a, 1d, 20hp, 2fp) vs. Rifleman (5a, 4d, 20hp, 1fp): The formula predicts 82.5% victories, Marko Polo tests resulted in 79%.
Armor (10a, 5d, 30hp, 1fp) vs. Rifleman (5a, 4d, 20hp, 1fp): The formula predicts 58.2% victories, Marko Polo tests resulted in 44%. This result coincides with the rifleman having a modified defense value of 19 instead of 18, 45.8%. This is the only aberration discovered so far; If someone would verify the results, the formula would need tweaking.
MdS notes: The 58% prediction seems counter-intuitive, as the Rifleman has a stronger defense value, and the high HP total would favor it. I will recalculate to see that the error is not in my math...)
Other tests of Cavalry vs. Armor, Fanatics vs. Musketeer, Fanatics vs. Alpine Troops, Warrior vs. Warrior, Catapult vs. Musketeer, and others all matched the formula closely.
ADDITIONAL CONSIDERATIONS
A city's population is not reduced if the city has city walls and a defender loses a combat.
A sacked city will have its population reduced by one. A size one city will usually be destroyed if sacked. There is unresolved discussion about when size one cities are captured instead of destroyed. See the thread City Razing Problem for more.
Naval bombardment ignores city walls.
Units that 'Can make amphibious assaults' (Marines) can attack from the sea (a ship), but do not ignore city walls.
WHEN THE DUST SETTLES...
After the battle, the victor is usually damaged. Units can heal as long as they do not move, not even along railroad. They heal at varying rates, depending on their proximity to a friendly city or barracks. Settlers and Engineers, the only units incapable of fortifying, heal while working.
Land Units:
Naval/Aerial Units:
SHORT TIPS AND HINTS
Against 1hp defenders:
Against 2hp and 3hp defenders:
Defenders in a city have the advantage of maximum defense and healing. Also, only a diplomat or spy can see what units reside in an enemy city.
Stacked defenders are immune to bribery unless adjacent to a city that is bribed.
[This message has been edited by Marquis de Sodaq (edited May 15, 2001).]
This is a special thread, please read Post 2 below, which contains instructions for use.
*****************************************
THIS THREAD HAS BEEN UPDATED AND MOVED TO THE CIV2 STRATEGY FORUM. PLEASE FOLLOW THIS LINK:
Info: Combat (GL)
ALL CONTINUING DISCUSSION SHOULD BE POSTED THERE.
*****************************************
Combat Modifiers and Calculation
Basics | Â | Unit Combat | Â | Adjustment | Â | The Combat | Â | Additional | Healing | Hints and | ||
 |  | Factors |  | Factors |  | Formula |  | Considerations | Tips |
BASICS
1.1 Combat occurs when a unit with an attack value greater than 0 attempts to enter a square occupied by a unit of another civilization.
1.2 A battle results in the destruction of one unit or the other. If the primary defender is destroyed, all other defenders (stacked) in the same square are also destroyed unless:
- they occupy a city square, or
- the square has the fortress improvement built on it.
1.3 Units involved in combat usually sustain damage. Damage is shown in the unit's strength bar by color and percentage.[list=a][*] Green: 2/3 to full strength[*] Yellow: 1/3 to 2/3 strength[*] Red: less than 1/3 strength[/list=a]
1.4 Except for air units, damaged units have reduced movement points approximately proportional to the damage. However, land units will never have less than 1 movement, and sea units will never have less than 2. The proportion of damage is rounded to the nearest integer, but never less than the minimum for that unit.
CMP = CHP/HP * MP + 0.2
CMP...current movement points
CHP...current hit points
HP...(maximum) hit points (from rules.txt)
MP...(maximum) movement points (from rules.txt)
1.5 Ground units can only attack other ground units. Exceptions: Helicopters can be attacked by ground units. A sea or air unit may be attacked if it is the primary defender in a city or airbase.
1.6 Air units can attack only ground or sea units, except those (fighters) with the "Can attack air units" flag. Air units attacking ground units ignore city walls.
1.7 Sea units can attack other sea units or ground units occupying a land square (including cities) adjacent to a sea square. They may also attack air units caught on the ground in a city or airbase. Units with the "Submarine advantages/disadvantages" (submarines, thus) cannot attack land units. A sea unit attacking a land unit is called shore bombardment.
1.8 Special domain 3 units can be attacked by any other unit, regardless of flags. Domain 3 units can attack any other unit, and they ignore city walls, SAMs, and coastal fortresses.
UNIT COMBAT FACTORS
Units have four basic factors figured into the calculation of a combat result: attack strength, defense strength, hit points, and firepower.
2.1 Attack strength is the likelihood of inflicting damage when attacking an opponent. Units with 0 attack strength cannot initiate combat.
2.2 Defense strength represents the ability of a unit to defend itself when attacked; It is the likelihood that damage will be inflicted on an attacking unit.
2.3 Hit points indicate how much damage a unit can withstand before it is destroyed. The true number of hit points is the hp value x10. A 2hp unit thus has 20 hit points.
2.4 Firepower indicates how much damage a unit can inflict in a round of combat. A successful round reduces the opponent's total hit points by the value of the unit's firepower.
ADJUSTMENT FACTORS
Many factors affect the four basic Unit Combat Factors, depending upon the circumstance of the battle. All factors that apply as percentages are multiplied together.
3.1 Veteran units receive a +50% bonus for both attack and defense strengths
3.2a Fortified units receive a +50% bonus for defense strength. This bonus applies only on the next turn, after the unit appears with the dirt entrenchment, not while in the process of fortifying. This bonus is superceded by fortress improvement (3.2b) and city walls (3.4). It can be used in combination with a SAM battery (3.5) or a coastal fortress (3.6). Air units caught fortified in an air base do not enjoy this bonus. Air units in unwalled cities do, however, gain a (possibly more than) doubled defense, as if in a fortress improvement.
Test: Do sea units benefit from this?
3.2b The fortified bonus increases to +100% for a unit occupying a fortress improvement, whether given the order to fortify or not.
Test: When a city is built on a square that is having the fortress improvement built gain defensive benefit from the fortress? Is this bonus enhanced or superceded by city walls?
3.3 Terrain increases defense strength by:[list=a][*] +50% if on forest, jungle, or swamp[*] +100% if on hills[*] +200% if on mountains[*] +50% if on a river, enhancing any other terrain bonus.[/list=a]
Test: Do sea and air units also gain this advantage when on land?
3.4 City walls triple the defense value of city defenders against attacks by land units.
Test: Do ships caught in port benefit from city walls? It needs to be tested more... my quick test says NO for both sea and air units. If so, city walls only benefit land units.
3.5 SAM batteries double the defense value of city defenders against attacks by air units.
Test: Do ships caught in port benefit from SAMs?
3.6 Coastal fortresses double the defense value of city defenders against attacks by naval units.
Test: Do air units or ships caught in port benefit from coastal fortresses?
3.7 Some flags (in rules.txt) can alter combat calculations as follows:
- Negates city walls (howitzer): Self explanatory.
- x2 on defense versus horse (pikemen): This is actually a limited bonus, +50% if the attacker is a land unit with move=2, hp=1, and fp=1.
- Can attack air units (fighter): Self explanatory. A fighter stationed in a city that is attacked by a bomber scrambles, gaining a +400% defense bonus (sorry, no SAM adjustment) against the bomber. Additionally, helicopters suffer a -50% defense adjustment and their firepower is reduced to 1 when attacked by a fighter.
- x2 on defense versus air (AEGIS): An AEGIS cruiser gains a +300% bonus when attacked by an air unit, +500% if the attacker is a missile (destroyed after attacking).
3.8 Partisans gain an attack advantage against non-combat units (any with attack value = 0). Their firepower is increased significantly, perhaps as high as 10x.
3.9 Shore bombardment: When a naval unit attacks a land unit, both units have their firepower reduced to 1. A sea unit's firepower is reduced to 1 when it is caught in port by a land unit.
3.10 SDI defenses thwart any nuclear attack (except those set by spies) within 3 squares of the city in which it is built.
3.11 Nuclear missiles have a special attack value of 99. Unless thwarted by an SDI, this sidesteps any combat result calculations. If a missile attacks a target, a strike results. This kills all units within one square of the strike, causes pollution, and reduces the population of any city within the radius by half.
3.12 Barbarians do not always attack and defend at normal unit strengths. Barbarian archers defend with a base value of 1, not 2. Other barbarian units have normal defense values. All barbarian attack factors are affected by the difficulty level of game being played:
- Chieftan - 25% of normal
- Warlord - 50%
- Prince - 75%
- King - 100%
- Emperor - 125%
- Deity - 150%
3.13 Sneak attack! A sneak attack seems to give an advantage to the attacker. This is currently being tested (see the thread Does it pay to be sneaky?) to determine how great this advantage is.
THE COMBAT FORMULA
First, some background. The manual provides a simplified combat formula to approximate the likely outcome of a combat. This formula states that the total modified attack and defense factors are combined; The probability of victory is approximately the ratio of the unit's factor to the total. In other words,
U / (a + d)
where
U = the unit's modified factor,
a = the attacker's modified attack factor, and
d = the defender's modified defense factor
This approximation has proven insufficient for many Apolytoners. Much debate has resulted in a more detailed formula. First, an explanation of what it entails. For explanatory purposes, a combat is a single round, a battle the cumulative result of all combats.
The attacker and defender each own a portion of the total modified attack and defense values proportional to their value, as the simplified formula, above, expresses. For each combat, a winner is determined by this ratio. In simple terms, the higher modified value is more likely to win a combat. For each combat won, the opponent reduces its hit points by the winner's firepower. This continues until one unit is reduced to zero hit points and is thus destroyed.
Heated discussion of a simplified combat formula led to several ideas being put forth. The one that most closely gives the results of the complex formula is:
Odds = (S + (S - W)) * Shp * Sfp / (W * Whp * Wfp)
where:
S = Stronger unit's modified attack or defense value
W = Weaker unit's modified attack or defense value
Shp = Stronger unit's hit points
Sfp = Stronger unit's firepower
Whp = Weaker unit's hit points
Wfp = Weaker unit's firepower
No playtesting results to test the accuracy of this formula have surfaced.
On to the real calculation...
Each unit gets a randomly generated number from 0 to its modified value minus one, multiplied by a constant. This constant has been best-guessed (based on play testing) to be 8. The unit with the higher random number wins the combat, ties going to the defender.
- If the defense value is equal to or greater than the attack value, the probability (p) of the attacker winning the combat round is
p = (A - 1) / 2D - If the attack value is greater than the defense value,
p = 1 - ((D + 1) / 2A)
Where A = (a * 8) and D = (d * 8). The resulting p is the odds of the attacker winning the combat. To calculate the odds of the attacker winning the battle, p is plugged into the equation
P = SUMn(COMB(n-1,dh-1) * (p^dh) * (1-p)^(n-dh))
Where "n" is summed from dh to dh+ah-1.
ah = Attacker's modified hit points
dh = Defender's modified hit points
p = probability for attacker to win combat round
P = probability for attacker to win battle
Note: Modified hit points: An opponent's total hit points are divided by the unit's firepower. Thus an attacker with 2fp halves the defender's total hit points.
Comments:
This formula accounts for damaged units, as the input is the unit's current hit point total.
In layman's terms, P is the sum of the probabilities of the all possible outcomes of the attacker winning; For example, the odds of the attacker winning ten straight combats, plus that of winning ten out of eleven, plus that of winning ten out of twelve, and so on, added together to produce a grand total. The maximum number of rounds is the attacker's and defender's total hit points minus one. Basically, until the winner is left with a single hit point after destroying the loser. The defender's chance is (1 - winner's probability).
For those unable to decipher the above mathematics,
- An advantage in hit points is slightly more beneficial that an advantage in firepower, other factors being equal.
- The more total hit points involved in the battle, the more likely the unit with the greater modified value, the stronger unit, in other words, will win.
- With an even attack to defense ratio, the higher the values, the better the odds for the attacker.
Units with 0 defense can occasionally win because it generates a number between 0 and 0 (0, thus), and the attacker can also end up with a 0. The tie goes to the defender, meaning he wins that combat round. A damaged unit, or one attacking at partial strength (after using part of its movement allowance), can on rare occasions end up on the short end of this possibility.
An Example
Veteran Artillery and Armor units attacking veteran Riflemen behind city walls. The formula stacked up to artillery, but was off slightly with the armor results. Marko Polo tested ten sets of ten attacks with each unit. Other tests to verify this formula, excepting one, have used a minimum of 234 attacks.
Artillery (10a, 1d, 20hp, 2fp) vs. Rifleman (5a, 4d, 20hp, 1fp): The formula predicts 82.5% victories, Marko Polo tests resulted in 79%.
Armor (10a, 5d, 30hp, 1fp) vs. Rifleman (5a, 4d, 20hp, 1fp): The formula predicts 58.2% victories, Marko Polo tests resulted in 44%. This result coincides with the rifleman having a modified defense value of 19 instead of 18, 45.8%. This is the only aberration discovered so far; If someone would verify the results, the formula would need tweaking.
MdS notes: The 58% prediction seems counter-intuitive, as the Rifleman has a stronger defense value, and the high HP total would favor it. I will recalculate to see that the error is not in my math...)
Other tests of Cavalry vs. Armor, Fanatics vs. Musketeer, Fanatics vs. Alpine Troops, Warrior vs. Warrior, Catapult vs. Musketeer, and others all matched the formula closely.
ADDITIONAL CONSIDERATIONS
A city's population is not reduced if the city has city walls and a defender loses a combat.
A sacked city will have its population reduced by one. A size one city will usually be destroyed if sacked. There is unresolved discussion about when size one cities are captured instead of destroyed. See the thread City Razing Problem for more.
Naval bombardment ignores city walls.
Units that 'Can make amphibious assaults' (Marines) can attack from the sea (a ship), but do not ignore city walls.
WHEN THE DUST SETTLES...
After the battle, the victor is usually damaged. Units can heal as long as they do not move, not even along railroad. They heal at varying rates, depending on their proximity to a friendly city or barracks. Settlers and Engineers, the only units incapable of fortifying, heal while working.
Land Units:
- 100% of total hit points healed every turn in a city with barracks.
- 40% of total hit points healed every turn in a non-barrack city
- 30% of total hit points healed every turn near a city with barracks(i.e. a square 7x7 squares)
- 20% of total hit points healed every turn near a non-barrack city
- 10% of total hit points healed every turn on normal square
- Fortress (3.2b) always adds an extra 10% to the rate (i.e. on a normal square, near a city, or near a city with barracks). A city built on a fortress was not tested.
Naval/Aerial Units:
- 20%/20% of total hit points healed every turn in a fortress or a city
- 10%/0% of total hit points healed every turn on normal square
- 100%/100% of total hit points healed every turn in a city with port facility/airport, respectively.
- Airbase and barracks have no effect.
- port facility/airport affects only the city square.
SHORT TIPS AND HINTS
Against 1hp defenders:
- Even strengths or a defensive advantage strongly favor the defender.
- Even a slight attack advantage means a much greater possibility of winning the battle.
Against 2hp and 3hp defenders:
- Even strengths slightly favor the defender.
- Defensive advantages again heavily favor the defender.
- Attack strength advantage strongly favors the attacker.
- A 2hp attacker needs at least a fourth again as much strength as the 3hp defender to have even slightly favorable odds.
- A 1hp attacker needs better than half again as much strength as the 2hp defender, and more than double the 3hp defender to gain slightly favorable odds.
Defenders in a city have the advantage of maximum defense and healing. Also, only a diplomat or spy can see what units reside in an enemy city.
Stacked defenders are immune to bribery unless adjacent to a city that is bribed.
[This message has been edited by Marquis de Sodaq (edited May 15, 2001).]
Comment