1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Combat Explained....

Discussion in 'Civ4 Strategy Articles' started by Arathorn, Nov 4, 2005.

  1. Heroes

    Heroes Heroes of Might and Magic

    Joined:
    May 19, 2005
    Messages:
    869
    I am not sure here, because Arathorn says: "Both the attacker and the defender always begin with 100 hps, regardless of whether they are injured or not at the start of combat." So, to kill an injured unit still needs knocking down 100 HP?
     
  2. snepp

    snepp King

    Joined:
    Oct 27, 2005
    Messages:
    667
    Location:
    Sioux Falls, SD
    That was part of his initial article, I'm sure he simply overlooked it when making corrections/additions, as we've discussed the effects of HPs since that time.
     
  3. snepp

    snepp King

    Joined:
    Oct 27, 2005
    Messages:
    667
    Location:
    Sioux Falls, SD
    More stuff...

    All combat screens available HERE

    Test 2: Tank vs Archer, Drill 1-4 (4-7 FS)

    Test 3: Archer, Drill 1-4 (4-7 FS) vs Tank

    Test 4: Tank vs Archer, Drill 2 & 4 (4 FS)

    Test 5: Tank, Flanking 2 (immune to FS) vs Archer, Drill 2 & 4 (4 FS)


    Test 6: Tank, Drill 2 & 4 (4 FS) vs Archer, Drill 2 & 4, Flanking 2 (4 FS, immune to FS)


    Test 7: Tank, Drill 2 (1 FS) vs Archer, Drill 2 & 4 (4 FS)
     
  4. Mujadaddy

    Mujadaddy Geheim Grammar Polizei

    Joined:
    Oct 19, 2005
    Messages:
    1,082
    So what you're saying is First Strikes are only important when Strengths are relatively equal?
     
  5. eg577

    eg577 Warlord

    Joined:
    Jun 1, 2002
    Messages:
    211
    I'm a little confused about the way hitpoints are handled. A damaged unit will have a lower strength which adversely affects R, AND suffers from having less hitpoints to kill it?

    I'm sure you guys are already aware, but you can changes things in XML to make data collection easier. For example, making some promotion give 100 first strikes would be an easy way to test the "Flanking 2 Keshik vs Archer" question in one go.
     
  6. Luhh

    Luhh Chieftain

    Joined:
    Nov 7, 2005
    Messages:
    67
    No. First strikes are a lot better when you are stronger than your opponent by a large margin.

    The effects are very small when you are a little bit weaker, and also not big when you are only a little big stronger.

    In those cases you'd be much better off upgrading other things than drill.

    Edit: A good example where first strikes are very bad compared to strength upgrade is naval units.
     
  7. Arathorn

    Arathorn Catan player

    Joined:
    Jan 10, 2002
    Messages:
    3,778
    Location:
    Illinois
    Yes. Injured units are significantly weaker than fully-healthy ones.

    @snepp:
    Thanks. I've started looking through those results. Most of them seem to make a lot of sense to me. I think there are some theories I can disprove from the data. The one that really confuses me is set 7. Are you certain all your tanks were upgraded to Drill 2 in that set? My quick glance through makes me wonder. It's very confusing in light of all the other data. I *think* my theories from before are mostly supported by the data, but set 7 doesn't fit my notions.

    I'll be looking through them more later and writing up my thoughts on a theory. Mostly it's what I said before, though. Thanks for all the data! And if you could reverify set 7, I'd hugely appreciate it!

    Arathorn
     
  8. BomberEscort

    BomberEscort Don't be alarmed; this is a kindness Supporter

    Joined:
    Jul 28, 2003
    Messages:
    1,125
    Gender:
    Male
    Location:
    Kansas City
    Just a minor note, I don't know if this is testable since simulating a battle where a spearman defeats a moden armor is unlikely. I noticed in GlobalDefines.xml the maximum XP for any encounter is capped at 10. (see MAX_EXPERIENCE_PER_COMBAT tag). If this is the case, then this penalizes the weaker unit, but since they would almost never win this battle. All is well.

    But, if you get max experience, even for damaged units, then this is a gameplay balance issue. On a sidenote, maybe this has been covered, I didn't notice, but does the Spear in the case above get the 20 XP (or 10XP if the cap is in effect) from defeating a severely damaged Modern Armor (reduced to 4 STR for instance)? I have not found a way to simulate damaged units in WorldBuilder...
     
  9. Arathorn

    Arathorn Catan player

    Joined:
    Jan 10, 2002
    Messages:
    3,778
    Location:
    Illinois
    Hmm....no, that had not actually been tested. Winning an upset of that size is impossible with normal testing time, of course, but....I think I might be able to set up a big enough upset to get "11" xps and see if it works...I'll check into it. Thanks.

    XPs are culculated by relative strength at the beginning of the battle -- NOT from pure potential strength. So, the spear defeating a Modern Armor with 10 hps (strength 4) would only get 4 xps on the attack and 2 on the defense. It's hard to get a ton of xp fast.

    Arathorn
     
  10. snepp

    snepp King

    Joined:
    Oct 27, 2005
    Messages:
    667
    Location:
    Sioux Falls, SD
    Can't be 100% certain and it wouldn't be the first time that a click in the world builder didn't register. I'll run that set again, in bulk, making use of eg577's suggestion to edit the xml to speed things up.
     
  11. snepp

    snepp King

    Joined:
    Oct 27, 2005
    Messages:
    667
    Location:
    Sioux Falls, SD
  12. Celebithil

    Celebithil Warlord

    Joined:
    Sep 2, 2004
    Messages:
    219
    It is quite fascinating to see the complications of the intricacies of the combat system of Civ 4. I immediately put it to good use in my second game (especially the bit about jump points).

    This might be more suited for modders, but I might have a "simple" solution to remove the jump points (which I think are undesirable, I want units which are almost as strong to have about 50% change of winning, not more than 60% vs. less than 40%). Instead of units doing a fixed amount of damage one could randomize this using an appropriate distribution. The one that springs to mind is that the damage given is decided according to a Poisson distribution with parameter 20*(3R+1)/(3+R) (so on average as much damage is done as is now.) I did some calculations and indeed the winning probabilities are a continuous version of the function with jump points as it is now, see the graph below.

    As for testing whether there is a cap of 10xp gained per battle you could make a 1 strength unit fight a very wounded (1 hp left) 275 strength unit. Chances are pretty good he wins, and should get 11 xp. Of course you should first mod those units in ;) .
     

    Attached Files:

  13. Aminor

    Aminor Chieftain

    Joined:
    Nov 13, 2005
    Messages:
    12
    I like the smooth curve *far* better than the present system and would suggest you try to bring it to Firaxis attention. The proposed curve also seems to be slightly less severe for the higher ratios which is fine by me. While I have been following this thread with great interest I didn't realize that ~equal opponents was a 60:40 advantage for the attacker? But I already know a re-reading of this thread would be helpful.

    EDIT: I assume this revised formula also has 'nice' behavior for the <1.00 ratios as well?

    If I recall correctly, somewhere up in this thread or a thread nearby on XP there was mention that XP is based on the adjusted strength of the opponent. But this ought to be relatively easy to test in the world builder and this might be more appropriate to explore than starting a new game tonight.

    Of course, both also sounds like a fine idea other than the sleep impact. ;)
     
  14. Celebithil

    Celebithil Warlord

    Joined:
    Sep 2, 2004
    Messages:
    219
    The point of the XP testing based on a very wounded very high strength unit is that the adjusted strength does determine the chance to hit and the damage done, but is still relatively too high as a measure of the real strength of a unit, as it doesn't show how much damage needs to be done to the unit to kill it. Hence the adjusted strength of a 1 hp 275 str. unit is 2.75, whereas the chance it wins is much less than that of a full health 2.75 strength unit. Since the minimum damage done per hit is 6, you can probably just take a 6 hp 45 5/6 str unit to achieve the same goal (and then maybe you don't need to create new units).

    The curve for R<1 in the smoothed curve is just as smooth, as the winning probability P satisfies P(1/R)=1-P(R), and hence a sort of symmetry around R=1 (as does, by the way, the original curve). I, too, noticed that weaker units have more change against stronger opponents. At first I thought it was some rounding effect (also due to the fact that before the jump point at 47/19 (where the weaker unit goes from 13 damage to 12 damage) the two curves are again equal. However now I believe that part of it is also determined by the fact that it is more probable for weak units to be lucky in hitting and requiring one hit less than it is for them to hit one extra time.

    I also hope that this curve will remove the strange optimal order-of-attack dependence on the health of units you attack with, as was acutely noted by Arathorn. I also wonder what it does to the "first strike or combat 1" debate. I have got to do some calculations on that to be sure though.
     
  15. LeSphinx

    LeSphinx Bachogwa

    Joined:
    Sep 21, 2001
    Messages:
    662
    Location:
    Paris, France
  16. Luhh

    Luhh Chieftain

    Joined:
    Nov 7, 2005
    Messages:
    67
    GW on being off topic. Also, it's not nice to threaten people. :rolleyes:

    Yeah, I kind of wonder how firaxis could have missed how their own combat system work, like the erroneously calculated combat odds regarding damaged units. It would really help to preserve your veterans if this was calculated correctly.

    Also, I dislike that my modern armors so often are the ones defending against gunships instead of the mechanized infantry in the stack. Perhaps they do sometimes have a marginally higher strength, because of more experience, but that should be a reason why the computer should NOT use them for defence. They are an offensive units, and used defensively is just plain waste. I would like to see better use of this, or preference settings. If for instance there were 2 equally strong units or one marginally stronger, but the other had the hill defense or city defense upgrade, it could perhaps have a higher priority because of this? Not necessary, just a thought, and some peculiarities regarding always strongest units now that they only have one strength value.

    Also, are you guys sure that experience is based on combat odds only? Because I think I've seen combat instances where the odds were similar, but one unit reveived more experience than the other victorious unit (both on offense) because it received more injury in the fight. Unless I'm mistaken here there seem to be a factor of damage received in experience as well. Most unfair fight in my games so far - level 6 modern armor at strength 48 against a catapult at 0.3 strength. :D
     
  17. LeSphinx

    LeSphinx Bachogwa

    Joined:
    Sep 21, 2001
    Messages:
    662
    Location:
    Paris, France
    Sorry Luhh if you think I was not nice.
    I was not my intention. Just a little humor!

    all the thread are very interessting.
    As I only completely read the threat according to information of culture, building, wonders, opening strategy... and so on. I never read war thread...
    except today, and I learn a lot reading this thread.
    So maybe some people in contrary only read war thread and missed something elsewhere...

    Happy civing!!
    LeSphinx
     
  18. Beamup

    Beamup Higgs boson

    Joined:
    Jun 8, 2001
    Messages:
    1,318
    Location:
    Boston
    They're correctly calculated. They just aren't the combat odds.
     
  19. Arathorn

    Arathorn Catan player

    Joined:
    Jan 10, 2002
    Messages:
    3,778
    Location:
    Illinois
    Interesting chart on the Poisson data, Celebethil. That seems much more intuitive to me. Interesting how it seems to give lower odds for those high-odd attacks. Something I can think about while driving across Illinois tomorrow.

    So, here's what I have gleaned from snepp's first strike tests....

    Test 2:
    You CAN see first strike misses when the first striker is defending. They show as "Defender is hit for x dmg (orig_hps/100)". x is apparently just the last damage it had calculated (more testing could confirm this, I believe). My guess is that if the non-first-striker wins, the "damage" module is just never called, so that the damage value is never updated and so the old damage value is just displayed out to the combat log.
    And 4-7 appears to mean 4-7. The number of first strikes was 5/6, 6, 4/5/6, 4, 5, 5. Never 7. The /s indicate that it couldn't be determined from the log (because the archer hit). Diminishing chances of each successive first-strike hitting? Fixed chance? We can rule out a hypothesis that "A failed first strike means no more first strikes" or that "A successful first strike means no more first strikes" or any hard and fast rules like that. Softer, odds-changing rules can't be, of course.

    Test 3:
    I can conclude nothing, for certain. Do attackers not get first strikes? That's possible, but then an archer hit first in all 6 cases, which is definitely against the odds. Are attacking first strikes not displayed? That could well be, as the distribution isn't too out-of-whack for what we might expect if the archer is getting 4-7 first strikes and only the hits are displayed. Does the attacker with a first_strike advantage just get one guaranteed first strike hit? Again, not ruled out by the data. A larger sample of something like test 3 would be good -- maybe with 4 fixed first_strikes with drill 2 and 4 or something (but see comments on test 7). It might help clarify some of these cases.

    Test 4:
    Exactly what I would expect after test 2. The defender has exactly 4 first strike rounds (successful or not telling whether the damage is actually updated/accrued or not).

    Tests 5 and 6:
    Immune to first strikes puts the opponent's first strikes value down to 0. The unit with immunity still gets its total number of first strikes. A unit with one first strike and immune to first strike facing a unit with 100 first strikes would still get one first strike and the opponent zero. That seems pretty well determined.

    Test 7:
    I would expect the archer to always get 3 first strike rounds. That would follow the DeepO/Solver article. BUT it's not the case. Sometimes the archer gets 4 first strike rounds. Sometimes 3. It doesn't appear to be the archer gets 4 first strikes then the tank 1 (although that's hard to eliminate) because of results like...
    That's clearly 3 first strikes and NOT a fourth one. But other results clearly have 4 first strikes for the archer.

    I just don't know what to do with test 7. I think x first_strikes against y first_strikes is very uncharted territory. That's where I'd focus our efforts. That combat-logger utility is very handy. Probably easier to test and definitely easier to read!

    First step: I'd like to narrow down the attacker has first strike, the defender doesn't case. That's test 3. 20 iterations of 4 weak first strikes should be enough to make some fairly compelling arguments one way or another, I think.

    After that, we can look at x vs. y in more detail. I need to think about what I would even hypothesize for that case and try to test. Any suggestions of what's going on would be greatly appreciated! I just can't even get a first feel for what's happening. I still have to wonder if snepp got Drill I and Drill II messed up or something. If I weren't so lazy and did my own testing (cough, cough), that would be the first thing I would retest -- several times.

    Arathorn
     
  20. Luhh

    Luhh Chieftain

    Joined:
    Nov 7, 2005
    Messages:
    67
    No sorry. I tried to be funny, but I realize I wasn't. :blush:

    Threat - to intimidate someone with possible future repercussions if you don't get will through.

    Thread - This is one.
     

Share This Page