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

ALT key Roll-Over Combat Calc Bug

Discussion in 'Civ4 - Bug Reports' started by BomberEscort, Nov 4, 2005.

  1. BomberEscort

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

    Joined:
    Jul 28, 2003
    Messages:
    1,125
    Gender:
    Male
    Location:
    Kansas City
    In this demonstration of what I believe is a minor bug, I have modified the Musketman to have a +50% Bonus against Archery Units. All other values remain as their Civ IV defaults.

    In this first picture (Musketman v. Archer #01) the values should be as follows:

    Musketman -- 9 Strength + 50% v. Archer = 13.5 Strength
    Archer -- 3 Strength

    What shows is 9.0 v 2.0, Now the ratio is the same for both. but notice the green highlighted +50% text is meant to be added to the green 9.0 attacker text, but it is instead taken from the red 2.0 defender text (actually it is 3.0 / 1.5 = 2.0, where the 1.5 represents the attackers 50% bonus, but it is removed from the defenders value not added to the attackers value like it should be. This caused me much confusion)
     
  2. BomberEscort

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

    Joined:
    Jul 28, 2003
    Messages:
    1,125
    Gender:
    Male
    Location:
    Kansas City
    Now for the next one...

    Notice it should be (following the color codes)

    Musketman 13.5
    Archer 5.25 (5.3 since it goes to the nearest tenth)

    What Civ is doing is leaving the 50% attack off of the attack value and removing it from the defenders value (I don't even know how they get the 3.8 here)
     
  3. BomberEscort

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

    Joined:
    Jul 28, 2003
    Messages:
    1,125
    Gender:
    Male
    Location:
    Kansas City
    And the final one...

    This is the way it should work.

    8.0 for the Preatorian vs 4.5 (3.0 + 50% for forest)
     
  4. BomberEscort

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

    Joined:
    Jul 28, 2003
    Messages:
    1,125
    Gender:
    Male
    Location:
    Kansas City
    With Promotions (Combat 1 & 2) all is well...

    Knight 12.0 (10 Base + 20% from Combat 1 & 2)
    Archer 5.3 (3 Base + 75% from Terrain and River)
     
  5. BomberEscort

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

    Joined:
    Jul 28, 2003
    Messages:
    1,125
    Gender:
    Male
    Location:
    Kansas City
    Throw in unit specific promotions (Cover : +25% vs Archery Units) and the wheels fall off again...

    Should be:

    Knight 12.5 (10 Base + 25% v Archers)
    Archer 4.5 (3 Base +50% from Forest)
     
  6. ainwood

    ainwood Consultant. Administrator

    Joined:
    Oct 5, 2001
    Messages:
    30,078
    Some bonuses are added to the attacker; some are removed from the defender. Its a bit confusing and not at all intuitive, but the actual results are OK though.
     
  7. BomberEscort

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

    Joined:
    Jul 28, 2003
    Messages:
    1,125
    Gender:
    Male
    Location:
    Kansas City
    There is something wrong with the calculations of the odds when unit specifics are throw into the mix. It appears that the bonus is subtracted from the defender instead of added to the attacker.

    I tried looking for the combat calcs in python/XML files but I couldn't find exactly what I was looking for. It appears to be a simple math error though and should be any easy fix if one knows where to look. Comments welcome...
     
  8. BomberEscort

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

    Joined:
    Jul 28, 2003
    Messages:
    1,125
    Gender:
    Male
    Location:
    Kansas City
    My point exactly... It is confusing and should be consistent. Notice in my first post I say the results (the ratios) are right on, some are off a bit, but not too much. I'd just like to know how to fix this for myself :-( Little things like this *bug* me....
     
  9. snepp

    snepp King

    Joined:
    Oct 27, 2005
    Messages:
    667
    Location:
    Sioux Falls, SD
    Here's how it came up with 3.8 (note, confirms exactly what you've been saying).

    50% Tile Bonus + 25% River Bonus - 50% Attacker Bonus = 25% total bonus

    3 * 1.25 = 3.75 (rounded to 3.8)

    Curious, how do these same scenarios calculate when the archer is doing the attacking?
     
  10. onedreamer

    onedreamer Dragon

    Joined:
    Oct 21, 2004
    Messages:
    6,580
    Location:
    Torino - Italia
    I don't see how we could consider this a bug or wrong calculation of odds.

    13.5 to 3 and 9 to 2 gives the same mathematical result. Hence there is no mathematical error.
    The problem here is that you missuse the meaning of odds. Odds does not mean sum of bonus of a unit vs sum of bonus of another unit, it means chances of a unit to win against another unit. Now, since it is not relevant if the bonus is added to the attacker or subtracted from the defender, the choice the programmers made is obvious and not at all confusing to me, but actually quite helpful. In fact, if you're going to tell me that I have 13,5 against 3 chances to win, or much worse 13,5 against 5.25... I'll have to think about it a while. If it's my wife she'll probably have to pick up a calculator and do some maths. To find what ? To find that odds are 9v2 or 9v3,8. It's quite obvious how clearer it is for the human mind to understand odds if the first number is an integer. Hence fractional operations are done on the second number, the one of the defender, and not on both number. It's a very handy operation which saves us a lot of thinking and I would thank the programmers for thinking about it ;)
     
  11. snepp

    snepp King

    Joined:
    Oct 27, 2005
    Messages:
    667
    Location:
    Sioux Falls, SD
    Yes the ratio for round wins is the same, but the damage dealt is considerably different. Of course this is moot given that it is implemented the way it is, but still interesting.

    Attacker 9 vs Defender 2
    A wins roughly 81.8% of rounds, D gets the other 18.2%
    A deals 8.1 damage per round win, D deals 0.09 per win

    Here's the fun part. :lol:

    Attacker 13.5 vs Defender 3
    A wins roughly 81.8% of rounds, D gets the other 18.2%
    A deals 12.15! :eek: damage per round win, D deals 0.13 per win
     
  12. onedreamer

    onedreamer Dragon

    Joined:
    Oct 21, 2004
    Messages:
    6,580
    Location:
    Torino - Italia
    ???

    I'll have to repeat myself:
    Odds are simply the chance of winning, where do you get the information that the odds will be used in the calculation of damage ???
     
  13. snepp

    snepp King

    Joined:
    Oct 27, 2005
    Messages:
    667
    Location:
    Sioux Falls, SD
  14. BomberEscort

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

    Joined:
    Jul 28, 2003
    Messages:
    1,125
    Gender:
    Male
    Location:
    Kansas City
    Based on snepp's observation of the Apolyton quote and the information provided in that quote, it does make a difference if the bonus is added to the attacker or subtracted from the defender. Hence, like I said, a minor bug.

    Now, the question remains, what can be done about it? Is it something we can fix with python and/or XML knowledge (of which I have neither) or is it a hard coded problem?
     
  15. Arathorn

    Arathorn Catan player

    Joined:
    Jan 10, 2002
    Messages:
    3,778
    Location:
    Illinois
    Really weird. If we had a good combat estimator (I'm working on one right now), we could determine whether the displayed odds are correct or if the actual computed odds as presented were right. A big ole stack combat (say 10,000) would probably be statistically significant enough to determine which behavior is actually calculated.

    Arathorn
     
  16. BomberEscort

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

    Joined:
    Jul 28, 2003
    Messages:
    1,125
    Gender:
    Male
    Location:
    Kansas City
    They appear to be correct

    Archer attacks Musketman (Modified for +50% v Archery Units, all other values are default):

    Archer = 3.0
    Musketman = 13.5 (9.0 + 50%)
     
  17. BomberEscort

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

    Joined:
    Jul 28, 2003
    Messages:
    1,125
    Gender:
    Male
    Location:
    Kansas City
    Here is an Archer attacking a modified musketman of Hills...

    Again all is well.

    Archer = 3.0
    Musketman = 15.8 (9 + (50% + 25%))
     
  18. Arathorn

    Arathorn Catan player

    Joined:
    Jan 10, 2002
    Messages:
    3,778
    Location:
    Illinois
    BomberEscort...would you be willing to create a stack of 10000 of this combat and run it? Should be able to make them all on 2 squares and just stack attack. Hopefully I'll have an answer to what the values SHOULD be for both 12.5 vs. 4.5 and the displayed 10 vs. 3.8 then.

    Note: It'd be easier without the first strike odds. That wasn't displayed. Are knights immune to first strike?

    Arathorn
     
  19. BomberEscort

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

    Joined:
    Jul 28, 2003
    Messages:
    1,125
    Gender:
    Male
    Location:
    Kansas City
    Just to confirm the odds for 1 Archer v 1 Musketman or 3 Archers v 1 Musketman are the same. This doesn't seem right. I don't think the calc takes into account stack attacks.
     
  20. BomberEscort

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

    Joined:
    Jul 28, 2003
    Messages:
    1,125
    Gender:
    Male
    Location:
    Kansas City
    Yes. I think "first strike" is like Civ III defensive bombard but I have not tested this.
     

Share This Page