ALT key Roll-Over Combat Calc Bug

The bug appears to only be when an attacking unit, which has a bonus against certain units, attacks a defender for which he has a bonus against (see here).

It does not appear when the defender has a bonus against a unit and that unit attacks (see here).

If odds are indeed used to calculate damage per round as noted in the posts above, then the attacker in this case is not getting his full +50% bonus and is not doing the correct damage per round.
 
BomberEscort said:
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.

Stack attacks are simply a convenience factor as far as I know, a time saver and nothing more.
 
snepp said:
Stack attacks are simply a convenience factor as far as I know, a time saver and nothing more.

True, but statistically three archers would have a better chance defeating one musketman, than one archer would. I see it going something like this...

Battle #1
3.0 Archer v. 9.0 Musketman

1st Archer dies and reduces Musketman to 5.5

Battle #2
3.0 Archer v. 5.5 Musketman

2nd Archer dies reduces Musketman to 1.5


Battle #3
3.0 Archer v. 1.5 Musketman

3rd Archer defeats Musketman and has 0.7 power left.

Odds can be calculated for this based on statistical calculations.
 
BomberEscort said:
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?

I really don't understand you. If, if if... and then bug. First off, until when you prove what you're supposing you can't talk of bug. Hence you can't talk of fixes. I prefer 1.000 times more to have odds with at least an integer number.
 
BomberEscort said:
True, but statistically three archers would have a better chance defeating one musketman, than one archer would. I see it going something like this...

I see, I misunderstood what you were saying.
 
BomberEscort said:
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%)

they are correct in either case. Bonus or malus is most probably applied to the defending unit. Can archers have attack bonus against fire weapons ? You can verify this by trying it.
 
The first thing we have to do is determine whether the text or the calculation is the bug. That is, we have to determine if the displayed numbers are wrong or if the displayed justification for the numbers is wrong. That is, is the engine actually calculating 12.5 vs. 4.5 or is it calculating 10.0 vs. 3.8. Once we know that, we'll know where the bug is and can better proceed.

Arathorn
 
I just realized something, there's a combat log that tracks each battle. Neat.

Well, I obviously missed something in that thread concerning damage. I'm testing Knights vs Archers on a hill (10 vs 4.2) and the knight is dealing 30 damage per round, 4 rounds to kill the archer, according to the combat log in-game. These numbers are consistant with the combat calculator that is located in the Apolyton thread.

http://c4combat.narod.ru/c4c_v0_13.htm
 
Here comes my crow, good thing I'm hungry....

After looking through the combat thread more closely, this is how the previous example I posted works out:

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

Attacker 13.5 vs Defender 3
A wins roughly 81.8% of rounds, D gets the other 18.2%
A deals 39 damage per round win, D deals 10 per win
 
OK, got some numbers. We won't even have to run more than a few experiments, if my numbers are right.

IF it's calculating 12.5 vs. 4.5, the knight will win with 88 hps and a strength of 8.8 about 38.6% of the time, but he'll never have 8.7 strength remaining. The knight will have strength 10, 8.8, 7.6, 6.4, 5.2, 4.0, 2.8, 1.6, or 0.4 left.

But IF it's calculating 10 vs. 3.8, the knight will win with 87 hps and a strength of 8.7 about 38.0% of the time, but he'll never have 8.8 strength remaining. The knight will have strength 10, 8.7, 7.4, 6.1, 4.8, 3.5, 2.2, or 0.9 remaining.

Just a few battles should tell us which it's calculating. I can't access the game right now, but it looks like others can. Run that knight with cover attacking an archer in forest battle a few times. What results do you get? That will be very helpful in starting to pin down where the error is.

Arathorn
 
Yeah. For cases where there's no "rounding error", it appears that either method gives identical results. That could probably be proven, if we were so inclined. However, in some cases, like the one I listed above, there's a different set of odds depending on how the bonuses are calculated, because of rounding. That leads to differences in combat.

I'd like to get it nailed down.

Arathorn

[Edit] The proof that the ratio is all that's important for damage is very simple.
Damage is 20(3a+d)/(3d+a). We're saying d=na, that is, the defender's strength is some fixed fraction of the attacker's strength. Then damage reduces to 20(3a+na)/(3na+a) = 20(3+n)/(3n+1), where n is the ratio of strengths. So, yeah, the absolute numbers don't matter..... (except in the rounding case)
 
Arathorn said:
But IF it's calculating 10 vs. 3.8, the knight will win with 87 hps and a strength of 8.7 about 38.0% of the time, but he'll never have 8.8 strength remaining. The knight will have strength 10, 8.7, 7.4, 6.1, 4.8, 3.5, 2.2, or 0.9 remaining.

This is how it is calculated.
 
I just checked out that calculator. It looks pretty good, except for a few problems/concerns.

You have to do your own translation from remaining hps to remaining strength. That's fine, because displayed strength does not generally equal inherent strength, or the unit's starting number.

The calculator seems to be doing floor for damage instead of round. That can make a huge difference. For example, doing 10 vs. 3.8, he's showing damage of 31. I calculate 20*(3*10+3.8)/(3*3.8+10) = 31.588785.... which rounds to 32, but the calculator is showing 31 damage for the knight. Again, this should be easy to check. A couple times in a thousand, when the archer wins, he'll either have strength 2.0 or 2.1 left (most likely), depending on which is right.

Arathorn
 
Just tested the 10 vs 3.8, the damage does in fact come out to 31 in-game.

The archer hits for 12, while the calculated is 12.66.
 
SO, if it's displaying what it's calculating, that's good. What it means, though, is that the description of "Pinch" is wrong. It doesn't give +25% strength vs. archers, it cuts defending archers' strengths by 25% and gives a 25% bonus when defending against archers. OY! Why couldn't they just be consistent. It seems such a minor point, but....

Consider a unit with strength 5.7 (injured knight, say) with that 25% bonus vs. archers, attacking an archer with a 25% terrain bonus....

Doing the add thing, we get 7.1 (5*1.25) vs. 4.5 strength (3*1.5). This gives the stronger unit a 93.80% chance of winning with an average of 84.9 hps left.

Doing the subtract the 25% bonus thing, we get 5.7 vs. 3.8 (3*1.25). This gives the stronger only an 85.67% chance of winning with an average of only 69.3 hps remaining.

Both examples were computed using my rounding of damage. Using floor of damage, a similar example could be constructed. It matters greatly which method is used. And it would be nice to know.

[EDIT] Example took a little time to construct. I missed the last message. Will change my calculator to floor for damage and try to find a similar example.

Arathorn
 
OK. I've got a system down now.

Same archer. Attacking unit now has strength 5.9.

Adding strengths, it's 7.4 vs. 4.5. Attacker wins 95.98% of the time, with 67.00 hps remaining.

Doing the goofy subtract thing, it's 5.9 vs. 3.8. Attacker wins 91.04% of the time, with 56.34 hps remaining.

(Why the big jump? 25 hps damage vs. 24 hps damage and 5 rounds needed vs. 4. Similar jumps will probably occur at 19/20 hps damage and even 16/17, I'd guess. After that, my intuition starts to falter.)

It CAN make a big difference which is done. :(

Arathorn

[EDIT: 20 is even strength. OY! But...consider 3.7 strength with that 25% bonus attacking the archer in the woods. I'd expect from reading to have 3.7*1.25=4.6 strength attacking 4.5 (3*1.5), so I would hope to have the odds in my favor. BUT, it'd be my 3.7 against their 3.8 (3*1.25). So, in actuality, the odds would be against me!]
 
Arathorn said:
It CAN make a big difference which is done. :(

It definately appears so, I guess the basis of my initial post wasn't as far off as I thought.

Here's another tidbit for you, the combat log shows the archer's unrounded strength at the start of the battle, 3.75.
 
Since most calaculations ADD the values correctly, the goofy subtraction case, which is the minority, should be changed for consistencies sake to match what the other values do. It seems the programmers intent was to be consistent and this slipped through the cracks. The alternative is that they had some reason to make an exception for this one type of calculation. Did we determine if combat is displayed inconsistently but calculated properly? Or displayed inconsistently and calculated improperly?
 
Here is the combat log for a Musketman (w/ 50% vs Archers) verses an Archer on Grassland.
 
Here's another tidbit for you, the combat log shows the archer's unrounded strength at the start of the battle, 3.75.

Oh, now, that's a whole 'nuther can of worms. Is rounding NOT done? The Apolyton thing was wrong in at least one other case. I wish I'd seen this combat log before. It seems to have a lot of answers (assuming it's always correct, which is a big assumption, considering how this discussion started). Still, that doesn't fix everything. The 3.7 with pinch vs. archer case is still different depending on how it's calcuated, whether rounding is done or not.

@BomberEscort: We're feeling reasonably confident that the displayed value is what the combat engine is using. So it's calculating the strengths inconsistently, and then using those odd strengths. I'd call it just flat-out a bug myself. I can't imagine why they'd do it differently in this case. Any inconsistency just doesn't make sense.

Can you build wounded units? Can you make a 3.7 strength unit with pinch attack an archer in the forest? And then check the combat log to see what it says? The next step would be to run a few thousand tests of that combat to verify the combat log is right. The difference between 3.7 attacking 3.75 (36.87% attacker win) and 4.625 attacking 4.5 (63.98% attacker win) are pronounced enough we should be able to determine what exactly is going on fairly easily.

Arathorn
 
Top Bottom