Announcement

Collapse
No announcement yet.

First Strikes: Questions and Answers

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

  • First Strikes: Questions and Answers

    Hi all.

    Forgiveness if this has been covered elsewhere, but it seems I see more questions on first strikes than on anything else. May as well focus that discussion Therefore, I went out to try and figure it out over the weekend.

    I'm not one who digs into the codes to look at things, and I'm sure not about to dilute everythign down to a nice mathematical formula. I just play around and make observations.

    Now, after a search, this is the best description I could find anyone attempt to make, from DeepO here:

    So allow me to contribute:
    How do first strikes work?

    First, in order to determine how many first strikes a unit A actually got, you need to look at the combatting unit B. If B ignore first strikes, unit A will have 0 first strikes. (very important early on!) If both A and B have first strikes (say A has 3, B has 1) it's the difference that counts (A gets 2, B gets 0).

    Once battle is fought, each first strike gives a free round of battle. That means that a round is fought normally, but in case A has a first strike, he can't lose the round. If B would be hit, he gets hit. If the result is negative, it is ignored.

    Notice that the base strength of the units is unaffected: if A has a strength (or hp) of 4, first strikes of 2 after modifiers, and B has a modified strength of 6, the first 2 rounds still have a 4/(4+6)=0.4 chance of succeeding, taking 0.2*6*(3*4+6)/(3*6+4)= 0.98 off the strength of B each time they hit. B, however, has 6/(4+6)=.6 chance of succeeding, but instead of taking .2*6*(3*6+4)/(3*4+6)=1.46 off the strength of A, it doesn't hit anything.

    Once first strikes are over, combat continues as usual. At most, B has been hit once (but it could be twice or not), which would mean its strength is now at 5. (the average would be a bit higher) A is still at 4. The numbers in the formula don't change, though, so B still has a .6 chance of winning the next round, while A only has .4. With those numbers, B is almost certainly going to win, even if he was hit a little during first strikes.

    You would be tempted to think that first strikes are thus unimportant. Nothing is farther from the thruth, you only need to use them well. If the situation is reversed, and a unit C has 6 strength and 2 first strikes, while unit D has 4 strength, the results are very different.

    C will hit D in 60% of the cases, and it will do 0.97 damage. D can hit C in 40% of the cases, and will do 0.8 damage. With those numbers, C will hit D once or twice, doing at least 0.97 damage and reducing D to 3.03. Another 4 hits and he's dead... C still needs 6/.98= 6.1 or 7 hits.

    (due to roundings, this is a bad example. In reality the number of rounds left will be 3 for C and 6 for D)

    If you compare the battle of C with one without first strikes, you would see that C has a much higher chance of not getting damaged, with a sligthly higher chance of actually winning. The bigger the difference in strengths between C and D, the extremer this effect. Adding 2 first strikes to a unit that is already twice as superiour will mean he will win most battles undamaged. As your damage directly affects your strength in the next battle it is very important to keep a good health.

    OTOH, if the difference between the strengths decreases, first strikes give a small advantage. You can use that to win fights where e.g. you have a 10% disadvantage. Once the difference is too large, first strikes won't help you to win, though.

    First strikes should be used for two different types of units: those that defend and the overwhelming attackers. As defenders are most likely stronger because of the bonusses, they are helped as they can fend of multiple attacks, still remaining strong. It's very annoying to have dozens of units attack a city, where one single defender just shrugs of the attacks.

    For the overwhelming attackers, it can keep you going. This especially applies to pillagers: they will remain healthy long enough to pillage that resource far inside the foreign borders, where units with the same strength but no first strikes will get slowly damaged over time to a point where an older unit can win. A tank which is damaged to strength 1 will most definately lose from a spearman of modified strength 5.

    DeepO
    And here:


    How many first strikes does a unit get, when it says e.g. 5-7? (That would be Drill III or IV, depending on the unpromoted unit)

    For every unit, there are actually 2 parameters: let's call them first_strikes, and extra_first_strikes. Some units start with first_strikes already, but normally these parameters are changed by promotion.

    In the case of Drill IV, a unit that displays as 5-7 first strikes means he will have 5 sure first strikes (so first_strikes=5), and 2 more possible first strikes (so extra_first_strikes=2).

    --------

    Before battle is fought, each unit has a step where the number of first strikes is computed. This total for the battle is equal to

    first_strikes_battle = first_strikes + chance(extra_first_strikes).

    Basically, it means that for the battle, anywhere between 5 and 7 first strikes will be assigned to the Drill IV unit.

    (Note that I don't kow what kind of randomizer is used for the chance distribution, meaning I can't tell if 5-7 would leadmore to 6 first strikes then it would to 5.)

    ---------------------

    Once a battle is fought, the first thing to check is if the opponent has the immune-to-first-strikes property. If it doesn't, the total falls to 0.

    Next, the two battle totals are compared, and the difference is taken. This difference is the number of first strikes the rest of the combat algorithm will use.

    So, a Drill IV unit, attacking a Drill II unit, might get 6 first strikes initially (somewhere in between 5 and 7). It faces an opponent of 2 first strikes, which leads to a difference of 4 first strikes.

    After allot of playing around with drill promotions, this appears to be contrary to my own observations to what first strikes are doing.


    The first thing I noticed was a wide range in the "5-7" first strikes listed in the calculator.

    The same unit would one time list '2-7', next combat, it might list '5-7'. Clearly, there was something other than just a hard line chance of first strikes going on here.

    Also, I have NEVER witnessed first strikes kill anyone despite the fact they mathematically SHOULD have.

    Then I saw the one that seemed to answer it all for me: A "0-6" first strikes listing in the combat calculator.



    What I believe is happening, based solely on observation, and I throw it out here to be torn to pieces by the real experts:


    First strikes occur before battle, this is a given and known.

    Chance of damage dealt occurs like normal combat. This is also known and given.

    Now onto the speculation and somewhat educated guessing:

    I believe the amount of damage you can deal to a unit via first strikes is capped, much like collateral damage. I also believe that damage to be 50% of a unit's base strength.

    So, when a unit is listing '2-6' first strikes, you unit has 6 first strikes, but if the first 2 hit, you've reached the cap.

    Whatever damage occurs via first strikes does appear to count in the regular combat rounds, ie, the weakened unit fights at the reduced numbers. Honestly, I'm a little confused as to whether DeepO was saying that above or not. A little to mathy for me, there, may as well be egyptian.


    And finally, the AI does not recognize first strikes when determining the relative strength of units:

    You have a str 4 unit with 6 first strikes, and a str 5 unit with nothing, the str 5 unit will absorb the first attack despite being a much weaker unit.

    This would also seem to suggest the AI will not ever use Drill promotions, nor will it recognize first strikes as a threat when attacking.


    Alright. Again, this is all just somewhat educated speculation based on more hours than I care to admit to playing, specifically using drill promotions and trying it out.

    Feel free to point out how flawed it is now, but please, let's get this first strikes thing figured out by the end.
    One who has a surplus of the unorthodox shall attain surpassing victories. - Sun Pin
    You're wierd. - Krill

    An UnOrthOdOx Hobby

  • #2
    So, when a unit is listing '2-6' first strikes, you unit has 6 first strikes, but if the first 2 hit, you've reached the cap.

    Uhmm... No. You're reasoning, to me at least, makes no sense. Sorry

    There are 2 different kinds of first strikes - A pure "chance" of getting one, and a sure fire first strike. Although even if you get a sure first strike, you still have to brave the odds to make sure it turns into a HIT or not, which will then do damage... or not.

    Taking your example "2-6 first strikes" means you have 2 sure fire first strikes and 4 additional 'chances'. Assuming even odds (strength wise), your 2 sure fire first strikes have a 50% of doing damage. Then it moves on to the "chances" - where it first calculates on whether or not you get a free shot or not - then it determines if you hit or not.

    As DeepO explained, First strikes give you a free battle round. If you lose the round, no problemo, you don't get damaged. IF you win, you damage the other unit.

    Comment


    • #3
      I began assuming that same thing. (guaranteed and bonus first strikes) It just didn't play out that way, for instance:

      How does that explain why the same unit will have varying 'sure fire' first strikes from round to round fighting the same opponents?

      The only variable was how damaged the opponent was. And, when facing a very damaged opponent, I'ld get the "0-6" listing, and no first strikes would appear to happen.

      Also, DeepO's explaination suggests first strikes are capable of killing off opponents. I did not witness that ever occuring. Regular combat would always ensue.
      Last edited by UnOrthOdOx; December 5, 2005, 10:42.
      One who has a surplus of the unorthodox shall attain surpassing victories. - Sun Pin
      You're wierd. - Krill

      An UnOrthOdOx Hobby

      Comment


      • #4
        I'm curious what you mean by "regular combat". I think the combat animation plays out either way. Are you looking at the results in the combat log? Since combat plays out in rounds, I don't expect archers and longbows can really do enough damage to kill something off reliably with first strikes. I'd imagine it would only happen when you have technologically advanced units (like machinegunners) in combat against early units.
        Age and treachery will defeat youth and skill every time.

        Comment


        • #5
          I think there is a consensis that first strikes happen before the round. This then has the ability to damage the opponet.

          The opponet then has a strength rating lower, so the hit/dam he is able to do is also lowered.

          In my present game, I have a catapult with drill 3 (decided to try something different then going collateral damage). The catapult (str = 5) killed 2 macemen (str = 8). This catapult also had a higher chance of retreating it seemed, because it has retreated twice against units of higher strength.


          First strikes have the ability to level the playing field. I think that the first strikes CAN kill off a unit. But the animation still plays itself out like normal. There is no animation for a unit standing there doing nothing while another beats it senseless.
          Early to rise, Early to bed.
          Makes you healthy and socially dead.

          Comment


          • #6
            I just did some testing with the world editor:

            1) The battle odds shown in the combat log are just the odds for every single round. They are not the total odds for winning combat. Those will, in general, be completely different.

            2) First strike does NOT affect the strength of the units during battle. If a unit gets hit during the first-strike phase, his modified strength remains unchanged.

            3) Injured units have less hitpoints. In the combat explanations UnOrthOdOx quoted this is explained wrong it seems. A unit on full health has 100 hitpoints. A damaged unit has less. For example one testbattle my injured longbow man attacked and got hit for 20 hp, reducing his health to 20. He must have had 40 hp to begin with, which is consistent with the 2.4 strength the game gave him.

            This basicly means:
            1) Injured units have less hitpoints
            2) Injured units take more damage
            3) Injured units do less damage
            4) Injured units are less likely to win each round of combat.

            To test this, I let a tank do a few battles in a testgame, bringing him down to 3.92 hitpoints. Then I attacked a warrior with it. You'd think the tank has twice the strength, and thus a much better chance to win. WRONG!

            Every single round the tank has a 66.3% chance to win. However the tank has only 14 hitpoints left, the warrior is at a full 100. The tank does 27 damage, then warrior 14. This means the tank has to win every single round of combat, 4 rounds total. That gives a tank only 19.3% chance to win.

            A tank with 3.92 strength will loose 4/5 battles against a warrior with 2 strength

            So keeping damaged units out of battle, and healing them quickly, is vital to survival on the battlefield.

            Comment


            • #7
              I wanted to attack a screenshot to my previous post but I couldn't. Forum says: "Forum Message
              The image that you have attached is too big. Please make it no bigger than 800 x 0.".

              First of all 0 height makes for a pretty small image

              Secondly I don't get this attacking at all. How does it work? I just wanted to add it as a link. Why is image size restricted at all for making links? Weird stuff...

              Anyway, I zipped it.
              Attached Files

              Comment


              • #8
                I got the same message with a screenshot I tried to post last night. I resized it from 1024x768 to 800x600 and it worked fine. I'd guess they just left out two digits of the height.
                Age and treachery will defeat youth and skill every time.

                Comment


                • #9
                  Originally posted by UnOrthOdOx

                  How does that explain why the same unit will have varying 'sure fire' first strikes from round to round fighting the same opponents?

                  The only variable was how damaged the opponent was. And, when facing a very damaged opponent, I'ld get the "0-6" listing, and no first strikes would appear to happen.

                  I'd assume first strikes vary because first strikes cancel each other out if the other unit has it too.

                  ALso, i don't suppose you could provide a screenshot?

                  I've never seen 0-6. Assuming you have Drill II, you already are guaranteed 1 first strike + 1 chance. So to get 6 "chances" you'd have to have Drill IV at the bare minimum. And then it would look like 3-6 OR a unit with 2 stock first strikes and Drill II.

                  So perhaps you were fighting a unit that had 3 First strikes and 1 chance (meaning it had +2 stock first strikes plus Drill II) then perhaps it would be possible to have a 0-6 rating. Since the sure fire first strikes cancel out, and the "chances" still have to be calculated.

                  Comment


                  • #10
                    Originally posted by Diadem

                    Every single round the tank has a 66.3% chance to win. However the tank has only 14 hitpoints left, the warrior is at a full 100. The tank does 27 damage, then warrior 14. This means the tank has to win every single round of combat, 4 rounds total. That gives a tank only 19.3% chance to win.

                    A tank with 3.92 strength will loose 4/5 battles against a warrior with 2 strength
                    This is an important concept. Beat-up Civ 4 units are even worse than they look because of the hitpoints. Only fresh units are any good, unless facing an even more damaged unit than themselves.

                    Comment

                    Working...
                    X