Announcement

Collapse
No announcement yet.

Info: Combat (GL)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Info: Combat (GL)

    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 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.
    The primary defender is the unit with the greatest modified defense value at the moment of the attack.

    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).]
    Last edited by Marquis de Sodaq; August 7, 2001, 07:52.
    The first President of the first Apolyton Democracy Game (CivII, that is)

    The gift of speech is given to many,
    intelligence to few.

  • #2
    Post 2
    -------------------------------------------------------------------

    Use this thread to post your comments or insights about combat.

    You will post any suggestions :
    • to add new wisdom,
    • to mark/unmark insecure or unsettled wisdom,
    • to put new questions that should be answered,
    • remarks to mistakes or clarifications needed.

    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.

    If my post responding 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. Only Ming may delete posts, let's hope he helps...

    Go to the Great Library Index
    Go to the Great Library Discussion thread
    Go to The Great Library: a hierarchical structure

    [This message has been edited by Marquis de Sodaq (edited April 24, 2001).]
    The first President of the first Apolyton Democracy Game (CivII, that is)

    The gift of speech is given to many,
    intelligence to few.

    Comment


    • #3
      Post 3

      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.

      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
      Civfanatics combat odds discussion and testing
      Last edited by Marquis de Sodaq; July 21, 2001, 15:21.
      The first President of the first Apolyton Democracy Game (CivII, that is)

      The gift of speech is given to many,
      intelligence to few.

      Comment


      • #4
        Post 4

        Keywords
        {combat system}
        {} {end1}

        {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}

        [This message has been edited by Marquis de Sodaq (edited April 24, 2001).]
        The first President of the first Apolyton Democracy Game (CivII, that is)

        The gift of speech is given to many,
        intelligence to few.

        Comment


        • #5
          Thanks Marquis for your great work of compiling the combat info! It was really needed.

          I'm hoping that maybe you could give us an example how to use your formulas. It would be nice to see how my tests with Artillery vs armor correspond with your probability math. I'm sure that giving us an example would greatly increase the common understanding of combat outcomes.

          Comment


          • #6
            Post 12
            FreeCiv program code:http://www.freeciv.org/lxr/source/se...s.c?v=cvs#L517

            I suggest to put DaveV's (Modifiers for Attack-Defense) way how to count "adjusted combat factor" (with bonus for a stronger unit): something similar to my example in What is the difference between firepower and attack points? , posted April 10, 2001 14:50.
            Last edited by SlowThinker; October 3, 2001, 18:55.
            Civ2 "Great Library Index": direct download, Apolyton attachment

            Comment


            • #7
              Post 15 removed
              [This message has been edited by SlowThinker (edited May 14, 2001).]
              Civ2 "Great Library Index": direct download, Apolyton attachment

              Comment


              • #8
                removed

                .
                Last edited by SlowThinker; October 3, 2001, 18:56.
                Civ2 "Great Library Index": direct download, Apolyton attachment

                Comment


                • #9
                  Post 23 removed
                  Last edited by SlowThinker; June 25, 2001, 14:13.
                  Civ2 "Great Library Index": direct download, Apolyton attachment

                  Comment


                  • #10
                    Post 25 There is an attack bonus afforded to the unit which makes a sneak attack.

                    You might incorporate this, perhaps seeking definitive confirmation and a value for the bonus (impiric evidence makes me think it will turn out to enhance the attacker's chances by one third).

                    Since I posted this SG has asked me for the authority I rely on for the existence of the bonus and I realised that I can't recall where I saw it referred to. Now I have played for some time relying upon it being there and believe I would have noticed if my calculations were being thrown out because it ain't. But still, you don't want duff stuff in here so I'd better open a lab and see what shows up. I've time to do a short test to-night so I'll post again to-morrow.

                    Well, I opened a thread in Strategy giving the result of my (extemely short) test. It was inconclusive but, I believe, shows that anyone conducting a longer test would be unlikely to be wasting their time. My short test focused on sneak attacks which violated a full peace treaty, not a mere cease fire. I made no attempt to come to any value for the bonus (if confirmed to exist) nor to establish that it is the same value for different units or different pairs of combatants.
                    [This message has been edited by East Street Trader (edited April 20, 2001).]

                    Comment


                    • #11
                      Didn't anybody make a program that counts P? (See THE COMBAT FORMULA
                      )
                      Civ2 "Great Library Index": direct download, Apolyton attachment

                      Comment


                      • #12
                        Post 27
                        I've made a program that does this, but it's in PocketC, and unless you have a handheld/pocket WinCE device I can't distribute it. But I did see someone in one of the archive links in post 3 say they had one for download.
                        [This message has been edited by airdrik (edited April 19, 2001).]
                        I don't have much to say 'cause I won't be here long.

                        Comment


                        • #13
                          Post 29
                          Why is an advantage in HP better than an advantage in FP?

                          I now understand the formula well enough to answer this. 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 difference is small, but we are splitting hairs, after all. Clear as mud?
                          [This message has been edited by Marquis de Sodaq (edited April 21, 2001).]
                          The first President of the first Apolyton Democracy Game (CivII, that is)

                          The gift of speech is given to many,
                          intelligence to few.

                          Comment


                          • #14
                            Post 30

                            removed
                            Last edited by SlowThinker; October 5, 2001, 14:36.
                            Civ2 "Great Library Index": direct download, Apolyton attachment

                            Comment


                            • #15
                              Post 31

                              pillage?
                              always 1 turn spent? 1/3 of move points needed? order of pillage...is it possible to be fortified and to perform a pillage?

                              Edit: I think now that pillage belongs to "units" section better (it is a "special order")


                              vet status (barracks...), East Street Trader's post (Modifiers for Attack/Defense, posted February 08, 2001 10:50).


                              The combat formula:
                              You should add an example how to count "p". See post 12.

                              But I would modify my example so that HP and FP are not 1:
                              Artill.(10a,1d, 2h,2f,) attacks Armor(10a,5d, 3h,1f):

                              Artill.'s battle factor is
                              ( 10 + (10 - 5 "bonus for the stronger unit") - 1/8 "malus for the attacker" ) * 2 (HP) * 2 (FP)
                              =59 1/2
                              and Armor's battle factor is
                              (5 + 1/8 "bonus for the defender") * 3 (HP)
                              =15 3/8

                              The artill's chance to win a combat is 59.5/(59.5+15.375)



                              I would stress a calculation of "p" over "P". "P" may be estimated only.
                              Last edited by SlowThinker; October 5, 2001, 14:35.
                              Civ2 "Great Library Index": direct download, Apolyton attachment

                              Comment

                              Working...
                              X