Not sure how You calculated this
Sure, I'll walk through the steps. There
have been changes made to autocalc over the course of EA, but I'm not sure when they happened. Also, keep in mind my numbers were just the base kill chances without any perks or tactics skill multipliers applied.
First, the power level of each troop is calculated based on this code:
For those that can't read code, the power formula for a regular troop is [(2 + tier) x (10 + tier) x 0.02], and if it's a mounted troop, multiply that by 1.2.
The power level for a T5 cav troop is 7 x 15 x 0.02 x 1.2 =
2.52
The power level for a T4 inf troop is 6 x 14 x 0.02 =
1.68
The next part of the equation happens in the SimulateHit method:
I'm just going to focus on the parts I've put in the red and yellow boxes. For reference though, PowerBasedOnContext just determines the troop power depending on if the battle is a siege or not, strikerAdvantage is the tactics skill multiplier of the party leader, and the part in the if statement deals with perk multipliers.
So in the red box you have [(PowerLevelOfAttacker / PowerLevelOfDefender) ^ 0.7] x 40. This determines the troop's *max* damage output.
Max damage for the T5 cav troop against the T4 inf troop is [(2.52 / 1.68 ) ^ 0.7] x 40 =
53.
Max damage for the T4 inf troop against the T5 cav troop is [(1.68 / 2.52 ) ^ 0.7] x 40 =
30.
I said that's the
max damage, because in the yellow box you can see it uses the function MBRandom.RandomFloat, which rolls a random decimal between 0 and 1, with the
average outcome being 0.5. This randomly modifies the damage a troop will deal within a range.
If the random roll is 0, then the result of the arithmetic in the yellow box is [0.5 + (0.5 x 0)] =
0.5.
If the random roll is 1, then the result of the arithmetic in the yellow box is [0.5 + (0.5 x 1)] =
1.
If the random roll is 0.5,
which is what you expect on average, then the result of the arithmetic in the yellow box [0.5 + (0.5 x 0.5)] =
0.75.
What that means is that each troop has a
range of possible damage outputs, with 0.75x the max being what you'd expect on average.
For a T5 cav troop against a T4 inf troop, the damage range is 26-53, with
39 being the average (I said 40 in the other post but it's actually 39).
For a T5 cav troop against a T4 inf troop, the damage range is 15-30, with
22 being the average.
Then finally, this damage is "applied" in the ApplySimulationDamageToSelectedTroop method, but the only relevant part is this line:
This rolls a random integer between 0 and the defending troop's max HP. The max HP of regular troops is almost always 100, so the roll is between 0 and 100. It will kill/wound the troop if the outcome of the random roll is < the damage number. So if the
average damage of T5 cav vs T4 inf is 39, then there is a
39% chance the cav kills/wounds the inf on average (because any random roll outcome between 0 and 38 will kill).
The fact that it is based on probabilities and not cumulative damage is acceptable in my opinion, because the two methods aren't
that much different in practice. If a troop deals 20 actual damage to another troop, it will take 5 hits to kill them guaranteed; while if they instead have a 20% chance to kill them, it will take on average (1/0.2) = 5 hits to kill that troop as well, sometimes less, sometimes
more. Using probabilities makes the system less deterministic, and in my eyes more realistic, since sometimes a soldier will catch an arrow in the gap of their armor which kills them outright, if that makes sense.
Well it sounds like what your saying is -they forget to develop the awareness of Auto-Calc perks and the anticipation of them -into the cake from the beginning which is a major no-no but also should be easily remedied. The fact that the Empire Lord isnt aware of Khuzaits WIDELY KNOWN +20 Cav bonus on the world stage except sieges is borderline moronic. Parties should be aware of the strengths and weaknesses of other factions -Thats what all medieval warfare has always been about!
Your other complaint of them being stuck in the same predictable loop because they are always recruiting the same exact troop types -i would offer up -they are already at a zero for dynamic fighting -they can only improve. Again i ask -where are you seeing interesting strategic gameplans unfolding? I see none. So again -they need to address that thru smarter recruitment tactics to battle certain troop types, to being aware of perks both factionwide and Lord wise that will help their crusade as well as taking advantage of terrain that would better their odds.
Just because none of this is in GetPower now -doesnt excuse them from trying -thats why we have a public EA to let them know this is unacceptable. We dont just shrug and go "Oh well -too late now i guess...would have been nice to have had some depth..."
Yes, the AI not being made aware of the cav bonus not applying in sieges is likely just an oversight (and in that case, easily fixable). But the second part of my comment about the Empire/Khuzait field battle was just a hypothetical situation to illustrate what happens when the AI can't properly estimate it's own strength.
Currently, the AI sums up the total power level of all of the troops in their party to get one single number that represents their total "strength." This is a bit of a simplification, but they more or less use this number to estimate their strength vs another party in the area to determine if they should engage/flee from that party. Using this one number to compare strengths works because the auto-calc model is heavily based on this troop power formula. There
are other things in the auto-calc formula right now which will introduce some error into the AI's ability to judge an engagement, but generally it probably isn't enough to make much of a difference.
Now, if you base the auto-calc formula on a bunch of conditional rock/paper/scissors factors, then in order to give the AI a reasonable approximation of their strength, they will need to do a bunch of conditional checks of their strength vs another party on the campaign map in realtime. For instance, if each of the four main troop types has an advantage/disadvantage against every other troop, then you will now have 16 strength checks to do for each party that the AI is considering engaging (i.e. Party A's infantry vs Party B's infantry, A's infantry vs B's archer, infantry vs cav, infantry vs HA, then archer vs infantry, archer vs archer, archer vs cav, etc). That's 16x more strength checks than we had before, and that's without adding any other factors into the model.
I'm just trying to temper expectations about what kind of strategic thinking we can realistically expect a video game AI to be capable of. I'm not sure I'm being as clear as I'd like, but it's a difficult concept to put into words.
But I don't think we're going to agree, and that's ok.
Edit:
It should be very easy to let factions know when an enemy will enjoy a battlefield advantage and when not.
I guess my point is that it's only easy when auto-calc is simplified. The more situational variables you start adding into the ruleset, the harder and harder it becomes to quickly and accurately estimate one party's strength vs another in an efficient way, and the more irrational their behavior will seem.
But another semi-related issue is that current camps seem split between making auto-calc a battle simulator in its own right vs. auto-calc being an accurate reflection of the mission side outcomes. Like @froggyluv mentioned the AI doesn't get a bonus for fielding pikemen against heavy cavalry and my first thought was, "Well, that's just the autocalc being accurate: pikes don't do a damned thing to cav in this game." Making the autocalc take into account stuff like terrain when terrain, frankly, barely matters to battle outcomes on the mission side (exception: cramped village maps) is going to create another divergence between expectations and actual performance.
Yep, different people want different things. I'm not really for or against anything, but my main point was only that creating a complex autocalc model and coding the AI to make
rational/strategic decisions based on it is a tall order, and it's not just a matter of wanting to or not. Not everything is feasible and all projects have constraints.
You're right though, adding a complex autocalc ruleset isn't going to necessarily result in an outcome that matches realtime physics based battle results.