The Civilinic Books

Info: Combat New
by Marquis de Sodaq

Great Library: CivII combat

This thread contains all the collective knowledge of combat in CivII, including the odds of a unit winning a battle. The information has been gathered from forum threads, discussions, and extensive testing.
This is a special thread, please read Use of this thread below, which contains instructions for - you guessed it - how to use this thread. The following links will jump you to the combat information:

Combat Modifiers and Calculation

Basics UnitCombat Factors Adjustment Factors
The Combat Formula Additional Considerations Healing
Hints and Tips False Statements Credits

Use of this thread

Use this thread to post your comments or insights about combat. You will post any suggestions :

I will integrate your suggestions into the main post.

Please, clear your post if all its problems are solved and integrated into the first post (you must leave at least one letter there). Help me: if you think I forgot to integrate one of your ideas then edit your post, delete ideas I included already and write LOOK! in the beginning of post. Send me a personal message noting this. If I post a response to you (you are named), and you have read it and you think it may be cleared, let me know via personal message. I will clear the response post if there is no useful information for others. I suggest to mark your posts by numbers (Post 5, Post 6...) for easier reference. Links: This thread is an updated version. The original combat summary thread was in the CivII General/Help forum: The old GL Combat thread Some issues discussed in that thread still need resolution. Go to the Great Library Index Go to the Great Library Discussion thread Go to The Great Library: a hierarchical structure

1. BASICS

  1. Combat occurs when a unit with an attack value greater than 0 attempts to enter a square occupied by a unit of another, non-allied, civilization.
  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: The primary defender is the unit with the greatest modified defense value at the moment of the attack.
  3. Units involved in combat usually sustain damage. Damage is shown in the unit's strength bar by color and percentage.
    GreenYellowRed
    2/3 to full strength1/3 to 2/3 strengthless than 1/3 strength
  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

    where
    CMPcurrent movement points
    CHPcurrent hit points
    HPmaximum hit points (from rules.txt)
    MPmaximum movement points (from rules.txt)
  5. Land units (domain 0) can attack any other unit on a land square, except airborne bombers.
  6. Air units (domain 1) can attack only land or sea units. Air units with the "Can attack air units" flag (fighters) can also attack other air units.
  7. Sea units (domain 2) can attack any unit occupying any adjacent square, except for airborne bombers. Units with the "Submarine advantages/disadvantages" (submarines, thus) cannot attack land units. When a sea unit attacks a land unit, it is called shore bombardment.
  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.
  9. Airborne bombers (any air unit with range > 1) can only be attacked by a unit with the Ącan attack air units (fighter) flag. This holds true regardless of what domain the attacking unit is.

2. UNIT COMBAT FACTORS

Units have four basic factors figured into the calculation of a combat result: attack strength, defense strength, hit points, and firepower.

  1. Attack strength is the likelihood of inflicting damage when attacking an opponent. Units with 0 attack strength cannot initiate combat.
  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.
  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.
  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.

3. 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.

  1. Veteran units receive a x1.5 bonus for both attack and defense strengths
  2. Fortified land units receive a x1.5 bonus for defense strength. 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).

    Notes:
    This bonus applies only on the next turn, after the unit appears with the dirt entrenchment, not while in the process of fortifying.
    It has been suggested, but not tested, that city defenders in multiplayer games do gain the bonus immediately if given the order to fortify with the 'f' key, but not the menu. (MdS suspects this is false in single player.)
    Air units caught fortified in an air base do not enjoy this bonus. Fighters in unwalled cities may, however, gain the scrambling defense bonus, as if being attacked by a bomber - even if the attacker is a land or sea unit. (This point is still in contention, see posts 15 thru 17 and post 19, below.)

  3. The fortified bonus increases to x2 for a land unit occupying a fortress improvement, whether given the order to fortify or not. This improvement gives no bonus against an attack by an air unit. A city built on an existing fortress eliminates that fortress. If a city is built on a square where a fortress is in the process of being built, the fortress will have no effect.
  4. Terrain increases defense strength of all units by
    x 1.5 if on forest, jungle, or swamp
    x 2 if on hills
    x 3 if on mountains
    +0.5 if on a river, additively enhancing any other terrain bonus.
    For example, a rivered hill gives a x2.5 bonus, a x(2 + 0.5) multiplier.
  5. City walls triple the defense value of city defenders against attacks by land units only. This bonus can apply only to land units.
  6. SAM batteries double the defense value of city defenders against attacks by air units. This bonus applies to any unit defending a city except a scrambling fighter, which receives a separate defense bonus. When combined with an SDI defense (3.10), the defender's defense strength is quadrupled against missile attacks.
  7. Coastal fortresses double the defense value of city defenders against attacks by naval units. This bonus applies to any unit defending a city.
  8. 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, x1.5 if the attacker is a land unit with move=2, hp=1.
    Can attack air units (fighter): The unit can attack air units with range > 1. This also affects other combat circumstances, as follows:
    A fighter stationed in a city that is attacked by an air unit with range <> 1 scrambles, gaining a x4 defense bonus.
    A fighter stationed in a city scrambles and gains a x2 defense bonus when attacked by another fighter.
    Any helicopter (any air unit with range=0) attacked by a fighter suffers a x0.5 defense adjustment and has its firepower reduced to 1.
    A fighter cannot benefit from a SAM (3.5) adjustment unless attacked by a missile. This applies to any domain unit with this flag.
    Scrambling applies only to air units with the fighter flag.
    x2 on defense versus air (AEGIS): An AEGIS cruiser gains a x3 bonus when attacked by an air unit, x5 if the attacker is a missile (destroyed after attacking).
    Can make amphibious assaults (marines): The unit can attack from the sea (a ship). This does not count as shore bombardment (3.9). The attacking marine does not ignore city walls (3.4).

  9. Partisans (or any unit in the partisan slot of units.gif) gain an attack advantage against non-combat units (any with attack value = 0). Their attack value is increased eightfold (8x).
  10. Shore bombardment: When a naval unit attacks a land unit, both units have their firepower reduced to 1. A sea unit's firepower is also reduced to 1 when it is caught in port (or on a land square) by a land or air unit; The attacking unit's firepower is doubled in this case.
  11. SDI defenses thwart any nuclear attack (except those set by spies) within 3 squares of the city in which it is built. It also doubles a city defender's defense strength against non-nuclear missile attacks. When combined with a SAM Battery (3.5), the defender's defense strength is quadrupled against missile attacks.
  12. 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.
  13. Barbarians do not always attack and defend at normal unit strengths. Barbarian archers defend with a base value of 1, not the normal archer defensive value of 2. Other barbarian units have normal defense values. All barbarian attack factors are affected by the difficulty level of game being played:
    ChieftainWarlordPrinceKing EmperorDeity
    25%50%75%100% 125%150%
  14. Sneak Attack! A unit sneak attacking (attacking an enemy unit while a peace treaty is in effect) receives an attack bonus if the defender is one of a human player's units. The adjustment appears to be a doubling of attack strength.

4. 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
Uad
=the unit's modified factor the attacker's modified attack factor 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. An increase in HP produces a greater range of values of n to be summed. Because FP is in the denominator of the fraction, its effect is less; Greater HP is all accounted for in the range, half of a greater FP is. The greater range of values means more COMBinations are calculated. COMB values increase at a greater rate than the final exponent ^(n-dh) reduces the total value in our equation.
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 45.8% victories, Marko Polo tests resulted in 44%.
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.

5. ADDITIONAL CONSIDERATIONS

  1. 5.1 A city's population is not reduced if the city has city walls and a defender loses a combat, or if the city is attacked from a sea square.
  2. 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.
  3. Air units attacking land units ignore city walls and fortresses.
  4. Airbases provide no defense bonus.

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.

  1. Land Units: 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).
  2. Naval/Aerial Units:
  3. Healing away from a city or fortress (by skipping that unit's turn) occurs immediately, before the next unit is available for an order. Barracks healing occurs at the end of the player's turn.

SHORT TIPS AND HINTS

As a general rule, the unit with the higher modified attack or defense strength will likely win the combat.
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.

LIES! LIES! LIES!

Much discussion has surrounded figuring out how combat works. In the process, some misinformation has been spread. This section addresses these incorrect ideas.
The following statements about CivII combat are all FALSE. Where applicable, a reference number before the statement directs you to the section where the correct information can be found:

  1. Damaged units have movement points proportional to their damage.
  2. The defensive bonus of fortifying a unit enhances the city wall or fortress bonus.
  3. The defensive bonus of fortifying is immediate.
  4. A unit must be fortified in a fortress to gain the defensive bonus.
  5. The defensive bonus of rivered terrain is multiplied along with other adjustment factors.
  6. City walls increase the defense strength of any unit.
  7. The pikeman bonus works against all land units with more than one movement point.
  8. A ship caught in port has its defense strength reduced to 1.
    The combat formula in the manual is correct.
  9. Marines attacking from a ship ignore city walls.
    Defenders attacked by marines on a ship gain the coastal fortress bonus.
  10. Air units gain a healing bonus in an air base.

Credits

The first linked thread, discussing the final formula, should be read if any clarification is needed about how it was found and what it means.
Eggman, Buenos, and Euclid provided the bulk of the math in this process. Thanks to SlowThinker and others for extensive testing to verify suspicions and ideas!
The following threads contributed to this topic: The Civ2 Battle Equation Solution
Defense Multipliers
AI cheats on naval bombardment
The Pikeman's defense
Modifiers for Attack/Defense
What is the difference between firepower and attack points?
Barbarians and level of play
Veteran units... (Healing)
Hit points and firepower
Fortification bonus within walls or fortress
Defensive terrain for air and water units
Fighter vs. SAM
Civfanatics combat odds discussion and testing
Civfanatics Battle Simulation
Sneak Attack bonus in MP
This thread is an updated version. The original combat summary thread was in the CivII General/Help forum: The old GL Combat thread
Keywords {combat system} {combat formula} {stack} {primary defender} {vet status} {healing} {walls} {fortress} {coastal fortress} {SAM} {SDI} {fortify} {city capturing} {attack and reduced population} {plunder} {pillage} {attack strength} {defense strength} {hit points} {firepower} {end2} {Marquis de Sodaq}