Announcement

Collapse
No announcement yet.

The Civ IV Combat System

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

  • #31
    Originally posted by Lou Wigman
    I have an army of many units and so does my opponent. Each army chooses(?) 1 unit which then fight. After one has lost the next one steps up.
    Well, yeah. But the one defending will always be the best one. So if you've got a pike and a couple of horse archers, your pikes will defend against mounted units (e.g. enemy horse archers), while your horse archer will defend against axemen. By further differentiating, you can give the pike another 25% against mounted units, and you can give a horse archer another 25% against melee units... they will become better defenders against one specific type of unit, and get far less damaged.

    The same applies to attacking: if you know a sword is only to going to be used for attacking cities, you normally will upgrade him along the city raider path. That will give the best results, for that one task! However, that city raider sword will not stand axeman attacks, so include a horse archer or something with the shock promotion...

    And pillagers: there are a couple of units in the game that, in their period, make excellent pillagers when promoted right. Most of the times, this means giving them either woodsman or hill bonusses, or giving them first strikes. March is also extremely handy for pillagers.

    Compare this to just taking a bunch of horses, and try to attack a city where a pike, or a couple of rightly promoted archers is defending. You will lose them all without any chance. And the defender has gained a lot of XP, giving the next promotion perhaps.

    DeepO

    Comment


    • #32
      Oh, BTW, I just realised that I was sounding like you always need to differentiate... nothing is farther from the truth, some general purpose units are a necessity as well if you want to wage war efficiently!

      DeepO

      Comment


      • #33
        Originally posted by DeepO
        SR, if you want to stay in one system, it may be easier to adjust Alex' formula to:

        damage = 0.2 * D * (3*A + D) / (3*D + A)
        This is not entirely correct, as damage is taken as percentage from HPs of the defender, not his strength (D). But we don't need to know how many HPs go into the calculation, each unit has the same amount, not depending from strength and it is enough to classify full health as 100% and death as 0%. It suffices to know the percentage to derive the number of turns needed to kill the unit (by reducing HP to 0).

        My point is, that both - odds to win a round and damage taken by the loser - are not a function of 3 variables A, D and HP, but merely of one, the ratio R = A/D, and for that reason I want to get rid of both A and D in the formulas.

        As in

        p = f(R) and d = f(R), where R = A/D.
        Last edited by Harovan; October 27, 2005, 19:55.

        Comment


        • #34
          Originally posted by Sir Ralph


          This is not entirely correct, as damage is taken as percentage from HPs of the defender, not his strength (D).
          It depends on the system you're working in. I was just pointing out that in Solver's system (which I used before as it is so natural), you needed the extra factor... If you're using the hp system, you don't.

          But we don't need to know how many HPs go into the calculation, each unit has the same amount, not depending from strength and it is enough to classify full health as 100% and death as 0%. It suffices to know the percentage to derive the number of turns needed to kill the unit (by reducing HP to 0).
          I agree, and thought of leaving the hp out of my description. However, there are roundings at work, and exactly the example I'm using gets hit by those roundings. So I figured it would be better to simply tell how it truely happens. Internally, there are 100 hp's, with calculation going on in integer math. This does lead to different results than the purely theoretical ones...

          My point is, that both - odds to win a round and damage taken by the loser - are not a function of 3 variables A, D and HP, but merely of one, the ratio R = A/D, and for that reason I want to get rid of both A and D in the formulas.
          hp is only included to show the roundings. But if you follow the scheme above, you will notice that whether you introduce an extra step to calculate the ratio R or not hardly matters in the calculations. You still need both damage_per_round and chance_of_1_round. You get there with easier equations, but introduce another equation, and another concept before getting there. You are right it is possible and your method is preferred if you want to make tables where the ratio is put against the total chance of succeeding. It is not simpler, though.

          DeepO

          Comment


          • #35
            DeepO, I have a Slow Brain Syndrome (TM) today. Could you show me which formula I need to update to make my original post correct?
            Solver, WePlayCiv Co-Administrator
            Contact: solver-at-weplayciv-dot-com
            I can kill you whenever I please... but not today. - The Cigarette Smoking Man

            Comment


            • #36
              Originally posted by Solver
              DeepO, I have a Slow Brain Syndrome (TM) today.

              Could you show me which formula I need to update to make my original post correct?
              Sure.

              Then, the unit that won the round does damage to the other unit. The damage the unit does is, if the attacker wins:

              A/D * 0.2 * A

              If the defender wins:

              D/A * 0.2 * D

              It's this part that is basically what's wrong: you should adapt that to
              Then, the unit that won the round does damage to the other unit. The damage the unit does is, if the attacker wins:

              (3A+D)/(3D+A) * 0.2 * D

              If the defender wins:

              (3D+A)/(3A+D) * 0.2 * A


              Some of the text below should also be adjusted. And maybe it would be an idea to go to a system where you explain hp, not depending on the strengths (hps means that the last factor has to go from both formulae, and you can go to easier to understand forms like SR pointed out too)

              DeepO

              Comment


              • #37
                Originally posted by DeepO
                Then, the unit that won the round does damage to the other unit. The damage the unit does is, if the attacker wins:

                (3A+D)/(3D+A) * 0.2 * D

                If the defender wins:

                (3D+A)/(3A+D) * 0.2 * A
                By the way, where did you get that formula? Is it a reliable information?

                Originally posted by DeepO
                hitpoints after battle
                If the archer would have won, he would roughly have 70% chance of being hit 4 times, 23% chance of being hit 3 times, 5% chance of being hit 2 times. (forget the rest, you catch the drift) This works out to .7 * (100 - 4 * 24) + .23 * (100 - 3 * 24) + .05 * (100 - 2 * 24) + ... = 2.8 + 6.4 + 2.4 + .. = 11.64 hp. Which means, given his initial strength of 2.5, he would on average have 0.3 strength left. That is, assuming he has won, in 90% of the cases he would have lost...
                IMHO chance to be hit 3,2,1 times is actually lower. It's not a chance to be hit X times, it's a chance to be hit no more than X times. There may be a situation where last hit(s) should have happened when losing unit is already dead and so don't deal damage.
                Example:
                AAAAAAAHHHA - 0 hits
                AAAAAAHHHAA - 3 hits

                Originally posted by DeepO
                Heh... I wanted to do something similar in the weekend. You beat me to it, Solver

                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.
                I saw here on the forums that there are 2 types of first strikes - one of them always hits and another has a to-hit roll. If it's true, then it's probably more complicated than that. For example, do differents kinds of first strikes cancel each other or they don't?
                Last edited by Ellestar; October 31, 2005, 07:03.
                Knowledge is Power

                Comment


                • #38
                  I have a question, is the stuff in my combat log just junk then?

                  I had my pikeman attack a enemy horse archer. In my combat log it said 6.60 pikeman vs 3.33 horse archer. Combat -100%(pikeman bonus vs cav)
                  Extra combat +20%
                  Extra combat -10%

                  Now the extra combat modifiers were from my pikeman with the first strength promotion and the enemy with 2 strength promotions.

                  I find it odd that instead of getting +100% strength like the bonus says, I get -100% strength to the enemy. I also have no idea where the 3.33 for the denfenders modified strength comes from.

                  Hey and if you are bored, DeepO, could you figure out how much collateral damage is done by siege and if number of successful attacks or first strikes matter?(I forget if its even possible for siege to get first strike)

                  Oh yeah and what does 2-3 first strikes mean, do I get 2 first strikes or 3 first strikes?

                  Comment


                  • #39
                    Originally posted by Ellestar

                    By the way, where did you get that formula? Is it a reliable information?
                    Yes it is reliable. The initial discussion arose from interpreting things, as both Solver and myself have the same sources... plus, alexman corrected us, and Alex is a programmer at Firaxis.


                    IMHO chance to be hit 3,2,1 times is actually lower. It's not a chance to be hit X times, it's a chance to be hit no more than X times. There may be a situation where last hit(s) should have happened when losing unit is already dead and so don't deal damage.
                    Example:
                    AAAAAAAHHHA - 0 hits
                    AAAAAAHHHAA - 3 hits

                    You are right in what you want to say, however as far as I see, I took care of that. But perhaps you're quoting the wrong part of my thread:
                    The easiest way to calculate the total chance of at least 7 wins out of 11 rounds is to add the chances together of 7, 8, 9, 10, and 11 wins. There is a complicated formula which does this automatically, but in a program it is easier with a simple for loop... Chance_of_destroying the horse archer = chance of hitting 7, 8, 9, 10, or 11 times.

                    It doesn't matter what the order is for the situation without first strikes: the chance of hitting 7,8,9,10 or 11 times is the same as not getting hit more than 4 times.
                    It is tempting to simply up the number_of _needed_hits_to_die for the horse archer in the example used, but that's not exactly correct.
                    Suppose the sword hits the first 2 rounds. The results are ignored, thus the sword needs to hit the archer 9 times, not 7. The n used above would increase from 11 to 13, virtually.

                    Suppose on the other hand that the archer hits the first 2 rounds. That means the sword needs to hit 7 times out of 9 of the following rounds. The total number of possible rounds n remains at 11.

                    The correct way of calculating it, is to calculate the chance of winning the first strike for the archer, times the chance of winning the rest of the battle. this has to be done for each combination of first_strike_wins, and added.

                    And taking care of fs, the order of the battle does matter. The battle splits in 2 parts: one fs part, and the rest. I might be wrong, but I thought I caught that in the formula.


                    I saw here on the forums that there are 2 types of first strikes - one of them always hits and another has a to-hit roll. If it's true, then it's probably more complicated than that. For example, do differents kinds of first strikes cancel each other or they don't?

                    I'm not 100% sure... the information I've got starts from having calculated how many fs will occur (so after comparing the number on both units). Once that number is calculated, the rest of the battle goes like described... How that number is calculated is only something that I heared others talking about.

                    Up until yesterday or so, I thought the 1-2 fs was simply a way of saying you get 2 fs, but in reality it is more likely that 1 or 2 of them will hit. So, just a display thing, while the underlying code works with fs=2. Add one fs to an archer, and he goes to 1 fs (guaranteed to be fought, not guaranteed to hit). Add one more fs, and the display goes to '1-2 fs', while the combat is fought with 2 fs (guaranteed to be fought, not guaranteed to hit).

                    I don't know the answer there... as I said, I always assumed my interpretation, but it wouldn't be the first time interpretation is not everything in CIV

                    DeepO

                    Comment


                    • #40
                      No, i meant only that you can't use a probability to be hit X times (chance of hitting/basic_chance_of_success in your example) when calculating average damage recieved by survived unit because it's actually a probability to be hit no more than X times.
                      When you count chance of a unit to win, you count all battle rounds even if some of the units will die before the last round. But when you want to calculate average damage recieved by a survived unit, you shouldn't count as hits rounds when dead unit is already dead.

                      By the way, v0.1 of a combat calculator (on JavaScript) is here http://c4combat.narod.ru/c4c.htm
                      Last edited by Ellestar; October 31, 2005, 09:46.
                      Knowledge is Power

                      Comment


                      • #41
                        Originally posted by xxFlukexx
                        I have a question, is the stuff in my combat log just junk then?

                        I had my pikeman attack a enemy horse archer. In my combat log it said 6.60 pikeman vs 3.33 horse archer. Combat -100%(pikeman bonus vs cav)
                        Extra combat +20%
                        Extra combat -10%

                        Now the extra combat modifiers were from my pikeman with the first strength promotion and the enemy with 2 strength promotions.

                        I find it odd that instead of getting +100% strength like the bonus says, I get -100% strength to the enemy. I also have no idea where the 3.33 for the denfenders modified strength comes from.
                        Heh... can you believe I never opened the combat log before? It's relatively new I am trying to figure it out, but one thing is for sure: it shows very nicely the different rounds, how much damage is done in one round (and yes, the formula I used is correct), and when you ran out of XP. I'm not sure the quoted percentage is correct, though, I'll ask to look into that.

                        As to the numbers: it looks like it is just displayed so that all the positive bonusses add to the defender's strength, while the negative bonusses are added to the attacker's strength. How exactly the +100% is added is a bit strange to me too: I would add it to the pike (so that it gets to 6+110%=12.6), where the horse get 6+20%=7.2. Instead, it looks like it is distracted from the horses strength instead, but I don't see the connection to 3.33. 3.77 makes sense and 3.6 makes sense, not 3.33. You're sure it was not wounded?


                        Hey and if you are bored, DeepO, could you figure out how much collateral damage is done by siege and if number of successful attacks or first strikes matter?(I forget if its even possible for siege to get first strike)

                        Collateral damage only happens once, at the start of the battle. Hitting multiple times during the battle does not influence the amount of damage done by CD, nor does it matter if you have fs or not.

                        As to how much damage is done: I'm not sure. The problem is I cleared out my beta install when the release version came out, so now I only have bits and pieces to work from. I see the damage being done once, I don't see how much damage is done.

                        However, I wouldn't be surprised if the damage is equal to one round of normal battle, done to all the units except the one defending. It feels like it takes into account relative strengths. Adding bombard 1-3 certainly feels like it does a difference too. I'll keep an eye on the numbers next time I fight. If I'm not to sucked into the flow of the battle, at which time I'm certainly not calculating odds

                        DeepO

                        Comment


                        • #42
                          Originally posted by Ellestar
                          No, i meant only that you can't use a probability to be hit X times (chance of hitting/basic_chance_of_success in your example) when calculating average damage recieved by survived unit because it's actually a probability to be hit no more than X times.
                          When you count chance of a unit to win, you count all battle rounds even if some of the units will die before the last round. But when you want to calculate average damage recieved by a survived unit, you shouldn't count as hits rounds when dead unit is already dead.
                          But I thought I didn't count rounds when the unit is dead: in my average strength, it takes into account the chance of staying alive... only the formula I gave is the average under assumption that the archer lives. Combine that with the chance of living, and you get a better formula, but one which is harder to interpret. That's why I split it up.

                          DeepO

                          Comment


                          • #43
                            Originally posted by DeepO
                            Collateral damage only happens once, at the start of the battle. Hitting multiple times during the battle does not influence the amount of damage done by CD, nor does it matter if you have fs or not.
                            I have a different expirience from my 1st game. Catapult that dies or retreats very fast doesn't deal any significant damage to other units. Catapult with 50% collateral damage that kills enemy unit in town deals close to 50% damage to all other units. I saw the same pattern several times, and i upgraded all but 1-2 first catapults with 50% collateral damage (after i decided just to use them as a fodder to weaken all units in a defending town).

                            By the way, how to check that combat log?

                            Originally posted by DeepO

                            But I thought I didn't count rounds when the unit is dead: in my average strength, it takes into account the chance of staying alive... only the formula I gave is the average under assumption that the archer lives. Combine that with the chance of living, and you get a better formula, but one which is harder to interpret. That's why I split it up.

                            DeepO
                            Ok, i don't understand what are you talking about. Let's start from the beginning
                            Let's put aside a formula that calculates a chance that some unit will win or lose a battle. For now, we want to calculate average damage recieved by a surviving unit (no first strikes so not to clatter a formula, it's very easy to count them too anyway).
                            Last edited by Ellestar; October 31, 2005, 10:04.
                            Knowledge is Power

                            Comment


                            • #44
                              Ellestar, it is possible that it has changed from what I know, please keep that in mind. I'm absolutely positive that collateral damage only happened once before, not sure how it is now. It also used to be completely separate from your rounds of battle, independent of the outcome. You could lose a cat without hitting once, or destroying a unit: it didn't matter to how much damage the others received.

                              combat log: above the place where you see the little messages scroll, you find a button with pencil and paper. There are your logs...

                              DeepO

                              Comment


                              • #45
                                Originally posted by Ellestar
                                Ok, i don't understand what are you talking about. Let's start from the beginning
                                Let's put aside a formula that calculates a chance that some unit will win or lose a battle. For now, we want to calculate average damage recieved by a surviving unit (no first strikes so not to clatter a formula, it's very easy to count them too anyway).
                                without fs, the flow of the formula goes like this:

                                1. calculate the maximum rounds of battle both units can sustain. Say max_A for attacker, max_D for defender. We're A, so we want to caluclate the average strength of A after winning the battle

                                2. calculate the chance of A winning the battle with exactly R hits (where R obviously is below max_A). e.g. exactly hit twice (so not once or three times). This is done, by adding up all combinations e.g. hit twice means 7 out of 9 plus 8 out of 10 plus...

                                3. calculate the leftover hp (hp_R) in with R hits.

                                4. calculate the average, where each case adds chance_R * hp_R to the average.

                                fs makes it a bit more complicated, but follows the same idea. Is this any clearer?

                                DeepO

                                Comment

                                Working...
                                X