Page 2 of 5 FirstFirst 1 2 3 4 5 LastLast
Results 31 to 60 of 148

Thread: The Civ IV Combat System

  1. #31
    DeepO
    Emperor DeepO's Avatar
    Join Date
    12 Jan 2002
    Location
    supporting Candle'Bre
    Posts
    8,773
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    07:59
    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

  2. #32
    DeepO
    Emperor DeepO's Avatar
    Join Date
    12 Jan 2002
    Location
    supporting Candle'Bre
    Posts
    8,773
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    07:59
    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

  3. #33
    Harovan
    Civ4: Colonization Content Editor
    Join Date
    04 Dec 2001
    Posts
    11,117
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    06:59
    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 Sir Ralph; October 27, 2005 at 19:55.

  4. #34
    DeepO
    Emperor DeepO's Avatar
    Join Date
    12 Jan 2002
    Location
    supporting Candle'Bre
    Posts
    8,773
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    07:59
    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

  5. #35
    Solver
    Deity Solver's Avatar
    Join Date
    24 Sep 2000
    Location
    Latvia, Riga
    Posts
    18,354
    Country
    This is Solver's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    08:59
    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

  6. #36
    DeepO
    Emperor DeepO's Avatar
    Join Date
    12 Jan 2002
    Location
    supporting Candle'Bre
    Posts
    8,773
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    07:59
    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

  7. #37
    Ellestar
    Prince Ellestar's Avatar
    Join Date
    19 Feb 2003
    Location
    Russian Federation, Moscow
    Posts
    367
    Country
    This is Ellestar's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    08:59
    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 at 06:03.
    Knowledge is Power

  8. #38
    xxFlukexx
    Prince
    Join Date
    27 Oct 2005
    Posts
    322
    Country
    This is xxFlukexx's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    05:59
    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?

  9. #39
    DeepO
    Emperor DeepO's Avatar
    Join Date
    12 Jan 2002
    Location
    supporting Candle'Bre
    Posts
    8,773
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    07:59
    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

  10. #40
    Ellestar
    Prince Ellestar's Avatar
    Join Date
    19 Feb 2003
    Location
    Russian Federation, Moscow
    Posts
    367
    Country
    This is Ellestar's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    08:59
    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 at 08:46.
    Knowledge is Power

  11. #41
    DeepO
    Emperor DeepO's Avatar
    Join Date
    12 Jan 2002
    Location
    supporting Candle'Bre
    Posts
    8,773
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    07:59
    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

  12. #42
    DeepO
    Emperor DeepO's Avatar
    Join Date
    12 Jan 2002
    Location
    supporting Candle'Bre
    Posts
    8,773
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    07:59
    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

  13. #43
    Ellestar
    Prince Ellestar's Avatar
    Join Date
    19 Feb 2003
    Location
    Russian Federation, Moscow
    Posts
    367
    Country
    This is Ellestar's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    08:59
    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 at 09:04.
    Knowledge is Power

  14. #44
    DeepO
    Emperor DeepO's Avatar
    Join Date
    12 Jan 2002
    Location
    supporting Candle'Bre
    Posts
    8,773
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    07:59
    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

  15. #45
    DeepO
    Emperor DeepO's Avatar
    Join Date
    12 Jan 2002
    Location
    supporting Candle'Bre
    Posts
    8,773
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    07:59
    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

  16. #46
    Ellestar
    Prince Ellestar's Avatar
    Join Date
    19 Feb 2003
    Location
    Russian Federation, Moscow
    Posts
    367
    Country
    This is Ellestar's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    08:59
    Originally posted by DeepO
    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...
    IMHO that total probability will be far more than 1.
    Also, if our unit needs 7 hits to kill a target, then there can't be 8 out of 10.
    Knowledge is Power

  17. #47
    DeepO
    Emperor DeepO's Avatar
    Join Date
    12 Jan 2002
    Location
    supporting Candle'Bre
    Posts
    8,773
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    07:59
    Originally posted by Ellestar

    IMHO that total probability will be far more than 1.
    No, I calculated it above. It adds up to 1 quite nicely.

    Also, if our unit needs 7 hits to kill a target, then there can't be 8 out of 10.

    Sorry to not have been clear, or even using not the best example. But it's two different rounds that are playing here: on one hand you need e.g. 4 hits for the attacker to kill the defender. On the other, the attacker can sustain 6 hits. So, you can have results where the attacker stays standing with 0,1,2,3,4 or 5 hits lost. Which means you can have 4 out of the first 4, 4 out of 5, etc.

    Hmmm... I see what you mean. 4 out of 4 is part of 4 out of 5... I must think on that, as I was sure that at the time of making the formula, I took it into account. Maybe I need to do the derivation again...

    DeepO

  18. #48
    Simplicity
    Warlord Simplicity's Avatar
    Join Date
    12 Dec 2002
    Posts
    218
    Country
    This is Simplicity's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    05:59
    Okay, I've read through this thread... And I haven't seen an answer to this question here. Maybe I missed it, but I don't think so.

    Does anyone know what the chance of a First Strike occurring in a combat is if a unit has ONLY the Drill 1 promotion? (That is, the unit has a "chance" of a first strike... What is that chance?)

  19. #49
    DeepO
    Emperor DeepO's Avatar
    Join Date
    12 Jan 2002
    Location
    supporting Candle'Bre
    Posts
    8,773
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    07:59
    Originally posted by Simplicity
    Okay, I've read through this thread... And I haven't seen an answer to this question here. Maybe I missed it, but I don't think so.

    Does anyone know what the chance of a First Strike occurring in a combat is if a unit has ONLY the Drill 1 promotion? (That is, the unit has a "chance" of a first strike... What is that chance?)
    AFAIK, it's the same as one round of battle. Drill 1 means 1 fs, so the first battle round will never be negative for the attacker. Either he wins it and delivers a blow (exactly the same as in the other cases), or he loses it and nobody is hurt.

    For an attacker with strength A, the chance of hitting 1 fs is thus A/(A+D)

    DeepO

  20. #50
    Ellestar
    Prince Ellestar's Avatar
    Join Date
    19 Feb 2003
    Location
    Russian Federation, Moscow
    Posts
    367
    Country
    This is Ellestar's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    08:59
    Originally posted by DeepO
    Also, if our unit needs 7 hits to kill a target, then there can't be 8 out of 10.

    Sorry to not have been clear, or even using not the best example. But it's two different rounds that are playing here: on one hand you need e.g. 4 hits for the attacker to kill the defender. On the other, the attacker can sustain 6 hits. So, you can have results where the attacker stays standing with 0,1,2,3,4 or 5 hits lost. Which means you can have 4 out of the first 4, 4 out of 5, etc.
    As i understand, 4 out of 4 means that you kill with 4 hits while sustaining 0 hits, and that is a probability that you'll sustain 0 hits right?
    So, if you sustain 1 hit it will be 4 out of 5 but it can't be 5 out of 6 like in your post above (or maybe i don't understand it?)

    Originally posted by DeepO Hmmm... I see what you mean. 4 out of 4 is part of 4 out of 5... I must think on that, as I was sure that at the time of making the formula, I took it into account. Maybe I need to do the derivation again...

    DeepO
    Yes, and so total probability will be more than 1.

    ************

    By the way, in our case last hit is always a killing hit. IMHO it should be counted separately. Chance to be hit with X attacks when attacker shoud hit with A strikes and defender should hit with D strikes, attacker wins a round with probability P
    ChanceToBeHitWithX(X,A)=C(A-1+X,X)*((1-P)^X)*(P^(A-1))*P
    or
    ChanceToBeHitWithX(X,A)=C(A-1+X,X)*((1-P)^X)*(P^A)

    Edit: C(A-1+X) should be C(A-1+X,X)

    That way, sum of ChanceToBeHitWithX when X=0..(D-1) is equal to a chance that this unit will win, as it should be.

    Edit2: X=0..(B-1) should be X=0..(D-1)
    Last edited by Ellestar; October 31, 2005 at 16:17.
    Knowledge is Power

  21. #51
    DeepO
    Emperor DeepO's Avatar
    Join Date
    12 Jan 2002
    Location
    supporting Candle'Bre
    Posts
    8,773
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    07:59
    Originally posted by Ellestar

    As i understand, 4 out of 4 means that you kill with 4 hits while sustaining 0 hits, and that is a probability that you'll sustain 0 hits right?
    So, if you sustain 1 hit it will be 4 out of 5 but it can't be 5 out of 6 like in your post above (or maybe i don't understand it?)
    That was more or less the idea, yes. 4 out of 5 means that the first 4 rounds, only 3 hits were taken. 4 out of 6 means that in the first 4 rounds, not 4 hits were taken and in the first 5 rounds you have 3 hits.

    5 out of 6 can happen to, though, but it will fall under the 4 out of 5 chance.

    Yes, and so total probability will be more than 1.

    I've got to see that in detail, I thought I took it into account (so the 4 out of 4 does not fall within the 4 out of 5 chance I'm using above). I'm not sure, though.

    At any rate, this only applies to the average strength left over after a battle, but that is important when quantifying fs as opposed to other promotions. I mean, it's obvious from how combat works that fs means more lefotver strength (and not a vastly increased chance of success of actually winning a battle), but if you want to have exact numbers for specific situations you need a working formula.

    By the way, in our case last hit is always a killing hit. IMHO it should be counted separately. Chance to be hit with X attacks when attacker shoud hit with A strikes and defender should hit with D strikes, attacker wins a round with probability P
    ChanceToBeHitWithX(X,A)=C(A-1+X)*((1-P)^X)*(P^(A-1))*P
    or
    ChanceToBeHitWithX(X,A)=C(A-1+X)*((1-P)^X)*(P^A)

    That way, sum of ChanceToBeHitWithX when X=0..(B-1) is equal to a chance that this unit will win, as it should be.
    Euh, can you write out the formula of C(A-1+X), please? I think it is included in my formula, you might be splitting out cases that can be combined again. The A-1+X factor does show up in my formulae as well, so perhaps we're talking about the same thing here.

    DeepO

  22. #52
    Ellestar
    Prince Ellestar's Avatar
    Join Date
    19 Feb 2003
    Location
    Russian Federation, Moscow
    Posts
    367
    Country
    This is Ellestar's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    08:59
    Originally posted by DeepO
    Euh, can you write out the formula of C(A-1+X), please? I think it is included in my formula, you might be splitting out cases that can be combined again. The A-1+X factor does show up in my formulae as well, so perhaps we're talking about the same thing here.

    DeepO
    Ops it should be C(A-1+X,X)
    C(n,k) is the binomial coefficient, C(n,k)=(n!)/(k!*(n-k)!) from your post
    Knowledge is Power

  23. #53
    Simplicity
    Warlord Simplicity's Avatar
    Join Date
    12 Dec 2002
    Posts
    218
    Country
    This is Simplicity's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    05:59
    Originally posted by DeepO


    AFAIK, it's the same as one round of battle. Drill 1 means 1 fs, so the first battle round will never be negative for the attacker. Either he wins it and delivers a blow (exactly the same as in the other cases), or he loses it and nobody is hurt.

    For an attacker with strength A, the chance of hitting 1 fs is thus A/(A+D)

    DeepO
    That wasn't the impression I was getting from the label of Drill I... I was under the impression that there was some probability that was checked *before* you even do a before battle strike.

    Drill I says there's a "chance of getting a first strike" (IIRC). Drill II says there's "+1 first strike."

    If Drill I were just a normal first strike... Why wouldn't it say: "+1 first strike" for both of them?

  24. #54
    DeepO
    Emperor DeepO's Avatar
    Join Date
    12 Jan 2002
    Location
    supporting Candle'Bre
    Posts
    8,773
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    07:59
    Originally posted by Ellestar

    Ops it should be C(A-1+X,X)
    C(n,k) is the binomial coefficient, C(n,k)=(n!)/(k!*(n-k)!) from your post
    Isn't this what I was saying? My factor n is comparable to your factor A-1+X if I'm reading it right. Only, you use A in a different context than I do, which might lead to some confusion.

    DeepO

  25. #55
    DeepO
    Emperor DeepO's Avatar
    Join Date
    12 Jan 2002
    Location
    supporting Candle'Bre
    Posts
    8,773
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    07:59
    Originally posted by Simplicity


    That wasn't the impression I was getting from the label of Drill I... I was under the impression that there was some probability that was checked *before* you even do a before battle strike.

    Drill I says there's a "chance of getting a first strike" (IIRC). Drill II says there's "+1 first strike."

    If Drill I were just a normal first strike... Why wouldn't it say: "+1 first strike" for both of them?
    I can tell you what I'm certain of, and what I don't know. That might help...

    1. I'm certain that somehow, the number of first strikes is calculated for a unit. This at least includes the difference in fs between the 2 units: if one has 3 and the other 1, I'm sure the one gets 2fs, the other none.

    2. I'm also certain that once you get that number, it is calculated as a battle round you can't lose, as described above.

    3. What I'm not sure about, is how the display translates into the actual number of fs a unit is legible to get. I always assumed that the higher number on the display is the actual number of fs. So, Drill II saying 1-2 fs means in reality 2 fs, period. I've seen reports as well that there might be a separate chance algorithm, so that '1-2' actually means at least 1, maybe 2 fs, but I don't see the point in doing it like that: why would you stack probabilities like that?

    4. What I'm also not sure about, but does make sense, is why you would display '1-2' for Drill II while it always is 2. There always has been a lot of confusion about fs, in that people thought that those fs were always hits without failure. It's easier to indicate '1-2', as that gives an idea that you are probably going to hit once, but it also could be twice. The display suggests a chance is at work there.

    But those last 2 points are entirely speculation.

    DeepO

  26. #56
    Simplicity
    Warlord Simplicity's Avatar
    Join Date
    12 Dec 2002
    Posts
    218
    Country
    This is Simplicity's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    05:59
    I'm not sure where the "1-2 fs" label is being seen...
    But one question I would have then is: Does a non-first strike unit with only Drill I say "1 fs" or "0-1 fs"?

    Does an archer unit say "0-1 fs" or "1 fs"?

    If there's a difference between a unit with only Drill I and no first strikes and a unit with only an inherent first strike, the question is answered.

    "1-2 fs" makes it sound like Drill I does only give a chance of getting an additional fs.

  27. #57
    Ellestar
    Prince Ellestar's Avatar
    Join Date
    19 Feb 2003
    Location
    Russian Federation, Moscow
    Posts
    367
    Country
    This is Ellestar's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    08:59
    Originally posted by DeepO

    Isn't this what I was saying? My factor n is comparable to your factor A-1+X if I'm reading it right. Only, you use A in a different context than I do, which might lead to some confusion.

    DeepO
    Hmm. May you give a link to your post? It's hard to guess what exact formula you have in mind. Anyway, n is constant in your formulas IIRC (we're not counting first strike here), but A-1+X isn't constant.

    ****

    CIV4PromotionInfos.xml

    PHP Code:
    Drill 1
    <iFirstStrikesChange>0</iFirstStrikesChange>
    <
    iChanceFirstStrikesChange>1</iChanceFirstStrikesChange>

    Drill 2
    <iFirstStrikesChange>1</iFirstStrikesChange>
    <
    iChanceFirstStrikesChange>0</iChanceFirstStrikesChange
    It seems that it's not just a difference in a civilopedia. There are two kinds of first strikes here and two different variables for it in the game code.
    Last edited by Ellestar; November 2, 2005 at 01:06.
    Knowledge is Power

  28. #58
    DeepO
    Emperor DeepO's Avatar
    Join Date
    12 Jan 2002
    Location
    supporting Candle'Bre
    Posts
    8,773
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    07:59
    Originally posted by Ellestar

    Hmm. May you give a link to your post? It's hard to guess what exact formula you have in mind. Anyway, n is constant in your formulas IIRC (we're not counting first strike here), but A-1+X isn't constant.
    It could be I made a mistake in that... here's the part I mean:

    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.


    So, the chance of success is
    basic_chance_of_success = Sum_(for j = k to n)_of_( f(j;n,p) )
    where
    k = needed_hits_opponent
    n = (needed_hits_opponent + needed_hits_yourself -1)
    p = chance of winning 1 round (=D/(A+D) for the defender)
    f(k;n,p)=C(n,k)*(p^k)*((1-p)^(n-k)) )
    C(n,k) is the binomial coefficient, C(n,k)=(n!)/(k!*(n-k)!)


    For the archer, this means that his chance of winning the battle is
    chance_of_success = f(7;11,0.4)+f(8;11,0.4)+f(9;11,0.4)+f(10;11,0.4)+f (11;11,0.4) = 0.0701 + 0.02336 + 0.00519 + 0.000692 + 0.0000419 = 0.09935.
    The archer has a 9.9% chance of destroying the horse archer.


    I thought this was correct, though. You see, I don't take into account in which order the hits fall, I only keep in mind that no 5 hits out of 11 should go wrong. Which means at least 7 hits. Which leads to the formula above.

    Is there something wrong with that?


    CIV4PromotionInfos.xml

    Drill 1
    0
    1

    Drill 2
    1
    0

    It seems that it's not just a difference in a civilopedia. There are two kinds of first strikes here and two different variables for it in the game code.

    I agree, it looks like that. I don't know the mechanism to that, though... I'll see if I can find it somewhere.

    DeepO

  29. #59
    Ellestar
    Prince Ellestar's Avatar
    Join Date
    19 Feb 2003
    Location
    Russian Federation, Moscow
    Posts
    367
    Country
    This is Ellestar's Country Flag
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 23, 2013
    Local Time
    08:59
    Originally posted by DeepO
    I thought this was correct, though. You see, I don't take into account in which order the hits fall, I only keep in mind that no 5 hits out of 11 should go wrong. Which means at least 7 hits. Which leads to the formula above.

    Is there something wrong with that?
    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.
    Knowledge is Power

  30. #60
    Arkalius
    Settler
    Join Date
    24 Feb 2002
    Location
    Southern California
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Local Date
    May 22, 2013
    Local Time
    21:59
    I've been lurking around here for a bit and been paying attention to this thread because the math behind these things really interests me.

    I think DeepO has a really good system but it seems to have a couple flaws... Using DeepO's system, if a unit has enough first strikes, the probability that it will win will increase beyond 100%. Not only is that impossible, but no unit is ever 100% guarnateed to win. I'd like to share my own similar method that takes this into account.

    So we know the basic formulas already for determining chance to win the round and damage done for each attacker.

    Note that for this entire system, we always assume that the attacker is the one that has first strikes, regardless of whether or not it is doing the attacking.

    strA is the attacker's modified strength, and strD is the defender's modified strength.

    winChance = strA / ( strA + strD );
    dmgA = ( 3 * strA + strD ) / ( 15 * strD + 5 * strA )
    dmgD is the same thing except swap the strA and strD in those equations.

    (always round these numbers up)
    hitsToWin = 1 / dmgA
    hitsToLose = 1 / dmgD

    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.

    So, we know that the attacker has to land hitsToWin hits before the defender lands hitsToWin hits. Lets just use an example with two units of exactly the same strength. That means the attacker would have to land 5 hits before the defender lands 5 hits. So at most, the defender can land 4 hits (and as little as 0), and the attacker is going to land 5.

    So first we need to know the probability that the attacker will simply land 5 hits in a row. That's simple, it's winChance ^ 5. There's only one way to do this so use this value to initialize our result probability.

    Next we need to determine the probability that the attacker will land 5 hits and the defender will land 1. The probability is simple, it's ( winChance ^ 5 ) * ( ( 1 - winChance ) ^ 1 ). 1 - winChance is basically the chance for the defender to win. Raising it to the power of 1 here is obviously meaningless but you see now that a pattern will emerge. You simply raise the chance to a power equal to the number of hits needed to win, then multiply the chance to lose by the number of losing hits we are working with (in this case 1).

    However we are not done with this one yet, we need to figure out how many different ways that we can land 5 hits and sustain 1. Obviously the 5th hit will always be the last one, so we can actually ignore that one. That means we have 5 wins + 1 loss - the last win we ignore, leaving us with the number 5. So we do C( 5, 1 ) where C is the binomial coefficient explained in previous posts. The 5 is that sum we came up with, and the 1 is the number of losses we incur. This gives us the result of 5. We multiply that by the probability we came up with above, then add this result to our overall win probability.

    We then do the same for 5 hits and 2 misses. So we have C( 5 + 2 - 1, 2 ) * ( winChance ^ 5 ) * ( ( 1 - winChance ) ^ 2 ) and we add this to our total probability. We do the same again for 3 and 4 misses.

    This basically boils down to:

    Sum ( n = 0 to hitsToLose - 1 ) begin
    C( hitsToWin + n - 1, n ) * ( winChance ^ hitsToWin ) * ( ( 1 - winChance ) ^ n )
    end

    This doesn't take first strikes into account.

    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? For example, in our equal strength match-up, what if the attacking unit had 5 first strikes? He could defeat the other unit without ever going into normal combat (of course he may not too). What if the unit has more first strikes than it would need hits to win (say 7 in this example)? We can't consider situations where it wins 7 first strikes because it can't, the battle would be over by the time it wins 5 of them.

    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.

    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.

    Code:
    for ( int s = 0; s <= ( firstStrikes > hitsToWin ? hitsToWin : firstStrikes ); s++ ) {
    	if ( s == hitsToWin ) {
    		for ( int n = 0; n <= firstStrikes - hitsToWin; n++ )
    			result += C( hitsToWin + n - 1, n ) * ( winChance ^ hitsToWin ) *
    								( ( 1 - winChance ) ^ n );
    	}
    	else {
    		subSum = 0.0;
    		for ( int n = 0; n < hitsToLose; n++ )
    			subSum += C( hitsToWin + n - 1 - s, n ) * ( winChance ^ ( hitsToWin - s ) ) *
    									( ( 1 - winChance ) ^ n );
    		result += subSum * C( firstStrikes, firstStrikes - s ) * ( winChance ^ s ) *
    						( ( 1 - winChance) ^ ( firstStrikes - s ) );
    	}
    }
    The first line is basically going to iterate through all the possible first strike victory counts, from 0 up to a max that is the smaller of the total first strikes and the hits required to win (remember we can't win more first strikes than we need to win the whole battle).

    The next line is checking to see if we're dealing with the situation where we're going to win entirely with first strikes. If we are, then the next line basically adds the probability of this happening. We basically treat this like normal combat. We have a minimum number of rounds which is hits to win, and a max which is the number of total first strikes.

    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. Since we've won that many first strikes, that's that many fewer wins we need during regular combat. We figure out how likely we are to win regular combat after winning that many first strikes, multiply by the chance of winning that many first strikes, and add it to our probability total.

    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?
    -Arkalius

Page 2 of 5 FirstFirst 1 2 3 4 5 LastLast

Similar Threads

  1. Combat System
    By Kc7mxo in forum Civilization IV Creation
    Replies: 1
    Last Post: November 1, 2005, 20:32
  2. Ooh, I am so P****ed at Combat System
    By RKC909 in forum Civ3-General-Archive
    Replies: 14
    Last Post: November 26, 2002, 02:01
  3. this combat system has to **GO**
    By self biased in forum Civ3-General-Archive
    Replies: 209
    Last Post: November 1, 2002, 04:23
  4. Does anyone else like the new combat system?
    By Pythagoras in forum Civ3-General-Archive
    Replies: 29
    Last Post: November 28, 2001, 08:39
  5. Civ 3 combat system
    By mrbilll in forum Civ3-General-Archive
    Replies: 0
    Last Post: November 20, 2001, 05:11

Visitors found this page by searching for:

civ 4 combat

civilization 4 combatcivilization iv combatcivilization 4 combat systemciv iv combatcivilization 4 battleciv 4 combat oddscivilization 4 battlescombat in civ 4civilization 4 combat mechanicsciv4 combatcombat civilization 4civilisation 4 combatciv 4 battlescivilization combat systemcivilization 4 combat odds civ4 combat mechanicshow does combat work in civ 4civ4 combat systemcivilization 4 how to fightciv 4 combat systemcivilization iv battlescivilization iv battleciv 4 combat sucksciv iv battle

Bookmarks

Posting Permissions