Announcement

Collapse
No announcement yet.

The Civ IV Combat System

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

  • #61
    Originally posted by Ellestar

    Once again, it's correct if you want to know chance to win, but you shouldn't use it to calculate average damage recieved by a survived unit.
    Aha, if that was the original idea, it took me a whole to pick up

    I've got to admit the average damage is something I added without much thought going into it. And you are right, I shouldn't be using the same formula. So the average should be lower than the number I showed. It can be corrected by distracting certain fractions from the chances in order to make these indepent again (and hence adding up to 1), but I'm not going into that right now. The important parts are the probabilities for the whole battles(, including fs).

    Thanks for pointing it out, and my apologies for not getting the precise problem sooner.

    DeepO

    Comment


    • #62
      Originally posted by Arkalius
      These tell you the hits required to win and lose the combat. I'm not sure if these will give perfectly accurate numbers. If the in-game system actually determines an integer hitpoint damage level and subtracts it from a pool of HP in each round, the hits required to win can be slightly different in some cases. It can be adjusted to reflect that possible issue if needed, however we will assume this is right for now.
      Inside, the damage is rounded yes. Which is why I didn't go to a hp=1 system like you are proposing. It can be slightly different in cases, and this is one of the pecularities for CIV combat: there are sweet spots, and jumps. I.e. a 4 vs 6 battle might have a 10% chance of winning, while a 3.9 vs 6 battle might only have a 4% chance of winning. (the numbers in this example or wrong, but the idea is right)

      We can treat first strikes like a whole seperate combat really... First we need to consider the chance that we fail all our first strikes, which means we need to do the full number of hits to win during normal combat. Then we consider the probability of winning one first strike which means we need one less hit to win during normal combat, then up to winning 2 first strikes etc up until we reach the max first strikes.

      However there is a stipulation and this is where DeepO's formula breaks. What if we have enough first strikes so that we could defeat the opponent entirely with first strikes?

      I was always aware of this. However, my system keeps this in mind as well... or at least that's how I read it (I might have needed to write it more clearly). If the battle is decided within fs, it means that the chance of winning the rest of the battle is 1. In those cases, you run into negative parameters for my formula, which are easily said to lead to a chance of 1. And even if you have 20 fs and you only need to hit 4 times, there is still a very remote chance that battle is not over once fs are done...

      Also, we need to consider the situations in which it wins enough first strikes to win the whole battle differently than situations in which it does not do this, since we'll never see regular combat.

      Not like I did it, unless I messed up one of the subscripts (which is not such a long shot). These situations are part of the deal...

      At this point it becomes kind of hard to represent the situation with pseudocode as it becomes pretty confusing. I will try however using some psuedocode adapted from the Java code I wrote to test this out.

      If you got this in code, do everyone a favour and give the community a program to calculate odds. I can help with the rounding issues as well (which basically means you'll need to go to the 100-20hp system like I used)


      If we're not going to finish the whole battle with first strikes, then we need to figure out how likely we are to win if we do win s first strikes.
      I've got that as part of my whole formula. I suspect that if you combine everything into one formula, you're going to end up in perhaps a different form, but in the same formula... Basically you're calculating the odds to hit n fs, after which you calculate the rest of the battle. That's what I did

      The current thing I would like to know is how the game determines the first strikes a unit gets when it has a range. Many units are listed as having "1-2 first strikes" or such. Drill I gives you 1 first strike chance, where Drill II gives you 1 first strike. If you have Drill II then you have 1 guaranteed first strike and 1 first strike chance, which reads as 1-2 first strikes. How do you know how many first strikes the unit gets?

      I can't help you there for the moment: I do not have a beta version installed right now. And I didn't searched for this in the code when I did the formula work

      Hmmm... wait a moment... I might have a backup copy laying around... I'll see what I can do about the fs thing.

      DeepO

      Comment


      • #63
        okay, I found it. It's like Solver already mentioned, but this time it's not something I heared or seen indications of, I'm pretty sure this is how it works.

        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.

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

        I'm also adding this to my post on the first page for easy reference.

        DeepO

        Comment


        • #64
          Wow this is all incredible. In layman's terms how does one interpret the combat odd??

          Obviously i understand that if its 6.1 v 2.3, I'm probably going to win.

          But what about:
          6.1 v 5.9
          or
          6.1 v 7??

          What's a good rule of thumb?

          Comment


          • #65
            So it is a fact that the Modified Strength-Values for Attacker and Defender aren´t adjusted in every Combat Round for the falling HPs of the units, but remain the same from the beginning of the combat till the end?
            (An example for the adjustments I mean:
            Attacker (A) and Defender (D) both with full HPs start with Strenght of 6.0 (A) and 4.0 (D) [i.e. Chance to hit for Attacker 60%] but due to some bad luck, after some turns the Attacker has only 50% of his HP remaining, whereas the Defender still has full HP which would, if adjustments were made for each round, mean that now the Chance of the Attacker to win the round would have fallen to 42,8 % [because his Adjusted Strenght now would be 3.0])
            Tamsin (Lost Girl): "I am the Harbinger of Death. I arrive on winds of blessed air. Air that you no longer deserve."
            Tamsin (Lost Girl): "He has fallen in battle and I must take him to the Einherjar in Valhalla"

            Comment


            • #66
              Originally posted by HomersHeineken
              Wow this is all incredible. In layman's terms how does one interpret the combat odd??

              Obviously i understand that if its 6.1 v 2.3, I'm probably going to win.

              But what about:
              6.1 v 5.9
              or
              6.1 v 7??

              What's a good rule of thumb?
              In short:

              - battle occurs in rounds
              - each round, a unit A=6 has twice as much chance as winning the round then a unit D=3.
              - each round, the amount of damage done by unit A is twice as large as damage done by unit D.

              For 6 vs 4, you end up at 90% success rate. 6 vs 3 will most likely be something like 95% or higher. 6 vs 5.9 is nearly 50% chance.

              DeepO

              Comment


              • #67
                Originally posted by Proteus_MST
                So it is a fact that the Modified Strength-Values for Attacker and Defender aren´t adjusted in every Combat Round for the falling HPs of the units, but remain the same from the beginning of the combat till the end?
                Yes, most definately. The damage for each round is fixed the moment a battle begins, it does not change over the different rounds.

                BTW, for those who haven't found it yet: try peeping in the combat log (the pencil and paper icon above the scrolling messages). In there, you will find for each battle a breakdown of modifiers, and you will see the chance of each battle round (for 6 vs 4, it would say 60%). You can also see the hp's decreasing nicely, from 100 down.

                What it also shows it the ratio between the damages, and this is where the damage formula above really comes from: divide one damage by the other, and you get the same ratio (60%) as the chance to win a round. The formula for the damage looks so complicated because it is centered around the value 20, the idea behind is rather easy.

                DeepO

                Comment


                • #68
                  Originally posted by DeepO


                  In short:

                  - battle occurs in rounds
                  - each round, a unit A=6 has twice as much chance as winning the round then a unit D=3.
                  - each round, the amount of damage done by unit A is twice as large as damage done by unit D.

                  For 6 vs 4, you end up at 90% success rate. 6 vs 3 will most likely be something like 95% or higher. 6 vs 5.9 is nearly 50% chance.

                  DeepO
                  Ok that helps quite a bit DeepO, Thanks

                  So when i attack (considering no other data -- like strategy, other uses as such) how much should i rate higher than my opponent. Have a 1/3 higher?
                  Thanks!

                  Comment


                  • #69
                    Something important I noticed, which wasn't mentioned before: units will start at 100 hp at full health. A unit that has been injured to 80% starts at 80 hp, not the full hundred.

                    This means that injured units don't need that many hits, which increases the chances for the full health units.

                    An example: suppose a archer, wounded to 2 gets bonusses up to 4. Suppose it is attacked by a horse archer of full health, srength 6.

                    That archer starts at 67 hp, whereas the HA starts at 100 hp. The chance of winning each round is still 60% for the HA, and it will do 24 hp damage. Which means that after only 3 hits, the archer is dead, instead of the 5 hits needed like reported above.

                    Which means that slaughtering wounded units gets an additional boost!

                    Damn. I thought I had it with the formula, and still something else creeps up. I'll adjust the reference post tomorrow or so.

                    DeepO

                    Comment


                    • #70
                      Originally posted by HomersHeineken


                      Ok that helps quite a bit DeepO, Thanks

                      So when i attack (considering no other data -- like strategy, other uses as such) how much should i rate higher than my opponent. Have a 1/3 higher?
                      Thanks!
                      It depends on your situation: if you want to conserve units, it might be better with 50% higher (so 6 vs 4).

                      DeepO

                      Comment


                      • #71
                        Originally posted by DeepO

                        It depends on your situation: if you want to conserve units, it might be better with 50% higher (so 6 vs 4).

                        DeepO
                        Great that's the kind of info i'm lookin for
                        I know each situation is different, but having a decen baseline on when to gamble (and not too) help!!

                        Thanks!!!!

                        Comment


                        • #72
                          Originally posted by DeepO

                          Yes, most definately. The damage for each round is fixed the moment a battle begins, it does not change over the different rounds.

                          BTW, for those who haven't found it yet: try peeping in the combat log (the pencil and paper icon above the scrolling messages). In there, you will find for each battle a breakdown of modifiers, and you will see the chance of each battle round (for 6 vs 4, it would say 60%). You can also see the hp's decreasing nicely, from 100 down.

                          What it also shows it the ratio between the damages, and this is where the damage formula above really comes from: divide one damage by the other, and you get the same ratio (60%) as the chance to win a round. The formula for the damage looks so complicated because it is centered around the value 20, the idea behind is rather easy.

                          DeepO
                          Pity, that the strength (and therefore the probability to win the next combat round) doesn´t change during combat,
                          after all it would make for some more realism
                          (losses of troops/weapons of the unit during the combat, which negatively affect the capacity to continue fighting)
                          and would also make it harder to calculate the combat results
                          Tamsin (Lost Girl): "I am the Harbinger of Death. I arrive on winds of blessed air. Air that you no longer deserve."
                          Tamsin (Lost Girl): "He has fallen in battle and I must take him to the Einherjar in Valhalla"

                          Comment


                          • #73
                            Yeah, to complicate things a little wrt my previous post:

                            - If you are attacking with a wounded unit, your chances will go down (even if the modified strength is higher). Always put a full health unit on top of wounded ones.

                            - the inverse is of course also true: a MA, wounded to strength 9 (modified) can be easy defeated by a musket of strength 9. The MA has to hit the musket 5 times, while the musket only needs to hit the tank once. The chance of that occuring is 50% each round.

                            - first strikes don't add a lot to the chance, but do add a lot to how much strength will remain after battle. For the chance, they are about equal to a 10% strength increase. But if the unit was going to win anyway, fs means it won't get hurt (or nearly not hurt)

                            - retreat only happens when attacking, and when the unit would normally have died

                            - collateral damage happens independent from the rest of battle

                            - unit-specific (or task-specific) promotions like cover (+25% vs archers) or city defender I (+25% defense in cities) are always the best in order to pick a better chance. In an equal battlefield (so everyone at the same tech level), these are our your shot at making a difference. But they do require more units as you need some for each different task, and they do need to be able to resist counterattack sometimes. In those cases, the more general one (combat, fs) are better choices.

                            DeepO

                            Comment


                            • #74
                              - retreat only happens when attacking, and when the unit would normally have died

                              :sigh: I really would have liked the game to allow both attackers and defenders to retreat from combat. I would then have modded it so ALL combatants have at least 10% withdrawl chance.

                              Comment


                              • #75
                                Originally posted by DeepO

                                Inside, the damage is rounded yes. Which is why I didn't go to a hp=1 system like you are proposing. It can be slightly different in cases, and this is one of the pecularities for CIV combat: there are sweet spots, and jumps. I.e. a 4 vs 6 battle might have a 10% chance of winning, while a 3.9 vs 6 battle might only have a 4% chance of winning. (the numbers in this example or wrong, but the idea is right)
                                Yeah I figured as much. However I don't think my system will creat that much of a discrepancy... but who knows. At any rate, I'll modify it to use the integer HP system when I get home tonight. I figure I should multiply my damage formula result by 100 to get the HP damage and then... round up? down? or round off? Then I can take that number to figure out the hits needed to win.

                                However there is a stipulation and this is where DeepO's formula breaks. What if we have enough first strikes so that we could defeat the opponent entirely with first strikes?


                                I was always aware of this. However, my system keeps this in mind as well... or at least that's how I read it (I might have needed to write it more clearly). If the battle is decided within fs, it means that the chance of winning the rest of the battle is 1. In those cases, you run into negative parameters for my formula, which are easily said to lead to a chance of 1. And even if you have 20 fs and you only need to hit 4 times, there is still a very remote chance that battle is not over once fs are done...

                                Also, we need to consider the situations in which it wins enough first strikes to win the whole battle differently than situations in which it does not do this, since we'll never see regular combat.

                                Not like I did it, unless I messed up one of the subscripts (which is not such a long shot). These situations are part of the deal...
                                Perhaps you're right... I didn't make my binomial coefficient function very robust so perhaps that was throwing me off. At any rate, as I tried to figure out the probability equations on my own, I was lead to the formula I came up with which seems more intuitive to me than yours, but that's just me

                                The way I had programmed yours into java, it was giving me screwy results for lots of first strikes, but it's entirely possible that it's my fault.

                                If you got this in code, do everyone a favour and give the community a program to calculate odds. I can help with the rounding issues as well (which basically means you'll need to go to the 100-20hp system like I used)
                                Well the program is just a command line app at this point and is not very interesting. I may try to make it a little more fully featured down the line though, and I'll be sure to release it if I do.

                                If we're not going to finish the whole battle with first strikes, then we need to figure out how likely we are to win if we do win s first strikes.

                                I've got that as part of my whole formula. I suspect that if you combine everything into one formula, you're going to end up in perhaps a different form, but in the same formula... Basically you're calculating the odds to hit n fs, after which you calculate the rest of the battle. That's what I did
                                Yours probably is fine... it was just harder to follow for me so I thought it would be good to put my own take on it to help people understand the probability calculations a bit better... no disrespect intended
                                -Arkalius

                                Comment

                                Working...
                                X