Feature Requests & Ideas
@prastle Not sure about the downvotes. I can see them No Problem. (On a phone btw)
About the topic: Not an expert on maths, but I don't think there's a way to calculate some sort of strength of an army without knowing the opponents, there are just too many factors involved.
Because of this the hard AI at least simply uses the BattleCalculator to determine whether or not it's a good idea to attack a certain territory.
Also the reason the AI is relatively CPU-Heavy.
@VictorIn_Pacific The solution to the linear equations when all units have the same power gives the remarkably simple and elegant solution of sqrt(A^2 - B^2) for the expected number of units surviving, where A is the total initial strength of the stronger side, B is that of the weaker one. Despite being a continuous approximation, it seems to have an error margin of only around 5% for larger stacks (relative to A), and is invariably an upper estimate. This result is absolutely anticlimactic, by the way.
In actual game play, the Army A defeats Army B, and B defeats C, but A loses to C is virtually unheard of, so I wouldn't focus on this. It basically only happens if there are huge mismatches of power and fodder. A good player would be actively building to avoid this situation.
There isn't a great mystery on how to predict battle outcomes, especially if you are doing low luck only. Probability trees do it, most battles don't see more than 4 or 5 rounds of combat so they aren't difficult to use.
A few extremely common battles have been done out with a probability tree on the axis and allies forums (dice and low luck).
Ah, I see there is a miscommunication here. When I wrote unit-strength function at the top, I did not mean "strength of a unit", but "strength of an army as a function of its number of units and combat strength", shortened to unit-strength function. I considered using the header unit/strength function instead, and for this very reason, but decided it wasn't that important, and that the specific meaning would come out in the discussion. In any case, I was myself only starting to think about the concepts and develop the required language.
So let's call it the "stack power function" instead.
There is a practical purpose to this. Supposing you have some collection of units, and some territory to defend, and the bad guys could attack you with some other collection of units. How much do you need to put there to secure the territory? Or a similar question. Now, you could eyeball it and hope you are right. Or you could move a tentative stack there and then run the Battle Calculator with hypothetical enemy attack stacks, that would be all possible hypothetical attack stacks, unless you want to trust to luck. OK, that may be doable, but it could take a long time. But what if the hypothetical attack is going to happen 3 turns in the future, and it's your capitol, and the outcome of that future hypothetical battle will be used to decide your strategy for the next few turns? Pretty hard to use the Battle Calculator in such a situation, and remember, if you get it wrong, you're out of the game.
So what we seek is some sort of a "stack power function" that will give an approximate but very good estimate of whether your stack will beat the enemy stack. That's what I'm trying to do here. And I think I have something useful - stay tuned.
Now, before I get into more detailed calculations, I will show a graphical solution to the paradox A > B > C > A. In the context of the AAA combat system, we know that both number of hit points and combat power are essential in evaluating an army. Thus we are looking at 2-D vectors, and perhaps higher dimensionalities. Add 3 vectors together: you can easily form a triangle, and in fact, in the context of this problem, the evaluation A->B, B->C, C->A must form a triangle. However, it can be seen that if you add only the lengths of these vectors (i.e. attempting to express the values as scalars, you get no useful result.
Next, let me show a "stack power" function that can properly solve the paradox Alkexr posed in post 3 of this thread.
Stack A is 10x6. Stack B is 2x6 plus 27 padding. Stack C is 1x6 plus 55 padding. A beats B, B beats C, and C beats A.
Now, it may be obvious, but this is a clear example of the competition between combat power and hit points. Thus I propose a "stack power" function P = U + C, where U = Unit differential, C = combat strength differential. But wait, you say! You promised that you would consider Skewness as well. I won't do that yet, but I will introduce a new term R to express the relative Reduction in the combat strengths as the rounds progress. Let P = U + C - R. It is important, as you know, because if you bring a whole bunch of padding to your gunfight, the other guy can shoot and shoot, and have no effect on your combat strength. On the other hand, the unpadded stack suffers near-linear reduction in its combat power over time. For a linear decrease, the effective combat strength is just 1/2 of the maximum. But wait, you say! The combat strength acts over a number of combat rounds. Of course; my test function is actually P = U + N*(C - R)/6. N is the number of combat rounds; division by 6 is necessary because it takes 6 combat points to get a hit.
The calculations: Stack A has zero padding, and thus suffers a linear strength decrease. Stacks B and C suffer no decrease over time. In the BC combat, the relative strength reduction is zero. In the CA combat, stack C shoots at padding only, so the Reduction factor is applied to every combat round. The effective value of C is 5.5x6 (R = 27). In the AB combat, stack C shoots at padding for 4 rounds. The effective value of C is 7x6 (R = -18).
In the AB combat, there are 5 rounds. In the BC combat, it takes 27 rounds to hack through the padding, and there are 28 rounds. In the CA combat, there are 10 rounds. In each case, the winner has exactly one unit left.
P(A->B) = -19 + 5*(48 - 18)/6 = + 6
P(B->C) = -27 + 28*(6 - 0)/6 = + 1
P(C->A) = 46 + 10*(-54 + 27)/6 = + 1
You will note that all the U's sum to zero, all the C's sum to zero, and all the S's sum to zero, but the weighting of the factors differs in each case.
But mostly, you will note that all the relative stack power functions evaluate positive, which means that A > B > B > C.
Still, although I have showed that it is possible to construct a function that models several situations correctly, this is not the real stack power function that I will be proposing. More later.