Those working on this mod do so in their own free time and for no pay.
Show your support for them by enabling ads on this site!

Author Topic: Autoresolve and AI_Combat_Power  (Read 4929 times)

0 Members and 1 Guest are viewing this topic.

January 22, 2018, 01:40:12 AM

Offline Mord

  • Stormtrooper Captain
  • ***
  • Posts: 23
  • Approval: +3/-0
  • Princess Leia has had enough of your shit.
    • View Profile
Autoresolve and AI_Combat_Power
« on: January 22, 2018, 01:40:12 AM »
I've been trying to figure out how autoresolve works for the last couple of days, and so far I have a few answers and a few questions I just can't crack. I hope that we can share our knowledge, since many of you good people here have been at this whole modding thing much longer than I have. If nothing else, maybe someone else starting out can benefit from this info.

I've been doing most of my tests with fleets of attacking and defending ships modded to have <AI_Combat_Power> (AICP) values of 1. I've been throwing a variable number of Corellian Corvettes against 100 Interdictor Cruisers. Overall it appears that AICP is the only XML tag that affects units' autoresolve performance and that game difficulty makes no difference.

Victory/defeat is calculated before casualties and will affect the losses on each side. If the sum of the AICP values of all the attacker's forces is greater than or equal to 75% of the sum of the defending forces' AICP, the attacker will win.

Casualties for a side are based on a percentage of the initial sum of AICP on the other side, modified by which side won.

If the attacker won, they will take losses of units with AICP totaling up to 37% of the defender's initial sum of AICP. If the attacker lost, they will take losses of up to 40% of the defender's initial sum of AICP.

If the attacker won, the defender will take losses of units with AICP totaling up to 80% of the attacker's initial sum of AICP. If the attacker lost, the defender will take losses of up to 75% of the attacker's initial sum of AICP.

Each unit appears to be evaluated individually for whether it will be taken as a casualty. If the number of AICP points of "damage" that are assigned to a unit is greater than 2/3 of that unit's own AICP value, it will be destroyed.

As an example, imagine you send 74 Corellian Corvettes (each with AICP 1, total fleet AICP 74) against 100 Interdictors (each with AICP 1, total fleet AICP 100). Because the sum of AICP for the attacking force is less than 75% of the sum of AICP of the defending force, the attacker loses. Therefore, the defender inflicts 40% casualties on the attacker - since the defender's total AICP is 100, the attacker will assign 40 points of "damage" among his 1-hitpoint-each ships, therefore losing 40 of the corvettes. The attacker inflicts 75% casualties on the defender - 75% of 74 is 55.5, so the attacker destroys 55 Interdictors.

If the attacker in the previous example had sent 75 corvettes against the same 100 Interdictors, the attacker would have won. In that case, the defender would have sustained casualties equal to 80% of the attacker's total AICP, or 56 EDIT: 60 Interdictors. The attacker would have lost 37 Corvettes.

If you crank up the number of corvettes past 75, the number of casualties the 100 Interdictors inflict on the corvettes will never exceed 37. At 125 corvettes and up, the defending Interdictor force will be utterly destroyed.

If you dial down the number of corvettes below 74, the number of casualties the corvettes receive will never exceed 40. Sending a force of 40 or fewer corvettes will result in the entire fleet being lost. Sending 1 lone corvette will result in its loss and it will take 0 Interdictors with it.

The part I can't figure out is how the game chooses the order in which to evaluate units as potential casualties. This is crucial in realistic game cases where fleet composition will be varied (and ships will have more than 1 AICP apiece). I've done several trials throwing corvettes against a mixed force of Acclamators (set to 10 AICP) and Interdictors (still 1 AICP each), and I get different results with different trials with the same number of corvettes. It appears that the order is semi-randomly determined, or at least determined by factors that have thus far eluded me.

I've run several tests with some number of corvettes against 50 Interdictors and 5 Acclamators. With 110 corvettes, I've destroyed 45 Interdictors and 4 Acclamators in one attempt and destroyed 48 Interdictors and 4 Acclamators in another. Even weirder, with 115 corvettes, I've destroyed 50 Interdictors and 4 Acclamators in one attempt and 42 Interdictors and 5 Acclamators in another. Dialing up the number of corvettes one at a time between 105-120 has yielded a pattern of casualties on the target force that I find really bizarre.

This is the part where I hope someone else can chime in with a solution. ;) If anyone is interested, I can post the full results of my mixed-force trials as a table.
« Last Edit: January 25, 2018, 12:33:49 AM by Mord »

January 22, 2018, 01:11:42 PMReply #1

Offline Slornie

  • Mod Team Member
  • Moff
  • ****
  • Posts: 2,759
  • Approval: +54/-13
  • Every Silver Lining has a Cloud
    • View Profile
Re: Autoresolve and AI_Combat_Power
« Reply #1 on: January 22, 2018, 01:11:42 PM »
Interesting that you've managed to narrow it down to purely AI_Combat_Power, seeing as every unit normally also has values for Autoresolve_Health and Damage.  However most of your figures do tally with those recorded in GameConstants.xml:

Code: [Select]
<AutoResolveAttritionAllowanceFactor>0.333333</>
<AutoResolveTransportLosses>0.333333</AutoResolveTransportLosses>
<RetreatAutoResolveLoserAttrition>0.65</RetreatAutoResolveLoserAttrition>
<RetreatAutoResolveWinnerAttrition>0.50</RetreatAutoResolveWinnerAttrition>
<AutoResolveLoserAttrition>0.80</AutoResolveLoserAttrition>
<AutoResolveWinnerAttrition>0.75</AutoResolveWinnerAttrition>

Autoresolve is something I've always been curious about but never actually gotten around to looking into.

EDIT: Something to consider with your second set of tests using the Acclamator is that ship carries squadrons of starfighters/bombers whereas your Interdictor and Corellian Corvette don't.  We know that the AI counts the value of carried fighters towards fleet composition, so maybe the autoresolve engine does something similar?
« Last Edit: January 22, 2018, 01:18:42 PM by Slornie »
Quote from: RonMaverick291 (Gametrailers)
why do u hate america? if it were not for us u guys would be lost. i mean we invented the tv, we invented the internet, cars and we even went to the planet moon. we won all the wars and we always help the little countries who cant fight and we give food to poor people.

January 25, 2018, 12:32:25 AMReply #2

Offline Mord

  • Stormtrooper Captain
  • ***
  • Posts: 23
  • Approval: +3/-0
  • Princess Leia has had enough of your shit.
    • View Profile
Re: Autoresolve and AI_Combat_Power
« Reply #2 on: January 25, 2018, 12:32:25 AM »
I've been deep-diving in the large space vessels' XML files for a project of my own and trying to figure out exactly what each XML tag does. Turns out, a good number of them do nothing whatsoever that I've been able to figure out. I would guess that the <Damage> tag is a leftover from a phase of development before projectiles had their own <Projectile_Damage> tags. No idea why the <Autoresolve_Health> is in there, since you can set it to some really wacky values and not see a difference in autoresolve results. The same thing happens in term of autoresolve outcome when I set these tag values to 0 as when I set them to 99999 (or when I comment them out entirely), so either they don't do anything or I'm not performing the right test.

The tags you pointed out in GameConstants might be related here. When I did a quick search through the rest of the file I also dug up <Auto_Resolve_Tactical_Multiplier>, which could also be relevant. Your idea about the fighter complement on the Acclamators messing with my results is a good one. I'll see what happens when I comment out their garrisons. It looks like various projectile types have their own <AI_Combat_Power> values as well, which doesn't make a whole lot of sense to me. Let's see what happens when I comment them out...

You mentioned that in some cases the AI count carried fighters towards fleet composition - what case is that? Is this part of the "assemble taskforce" AI?

---- Results of diddling with the tags in GameConstants.XML:

<AutoResolveAttritionAllowanceFactor>
Dialing it down to 0 had no visible effect, but dialing it up to 1, 10, 20, and 100 definitely did. It looks like this is a static value added to the total amount of "damage" points handed out to both sides at the end of the battle. It does not appear to be a multiplier, though its default value of 0.333333 makes it look like one. Evidence: when this is 10, I kill 10 more Interdictors and lose 10 more Corvettes than default, when this is 20 see 20s, and when it's 100 I see all the Interdictors die and lose all but 1 Corvette. I suspect the game won't let you lose literally your entire force if you "won" the battle. For future tests I dialed this down to 0.

<AutoResolveLoserAttrition>
This is a multiplier that appears to be applied to the winning side's total AICP. If you increase this to 1.0 when attacking with 75AICP, you deal 75 points of "damage." If you decrease this to 0, you don't destroy any enemy ships even when you "win" the battle. Combining this with the previous tag could set a casualty floor for autoresolved battles.

<AutoResolveWinnerAttrition>
Second verse, inverse of the first. Interesting fact, it looks like there is a hidden static 0.5 multiplier that this stacks with to determine attacking losses. The default value of 0.75 causes the expected loss of 37 Corvettes against 100 Interdictors, and dialing it up to 1.0 increases losses to 50, so there's obviously another 0.5 involved here somewhere. It doesn't involve winning or losing, because I get the losses I expect on both sides based on pure AICP regardless of winner. It looks like there is just a flat hardcoded "attackers take 50% losses" in the game. That's quite an incentive not to autoresolve a defense!

<RetreatAutoResolveLoserAttrition>
<RetreatAutoResolveWinnerAttrition>
Has a very slight effect on casualties when you enter a tactical battle and then choose "auto-resolve" from the retreat menu. The default casualties for the usual matchup were 53 corvettes and 78 Interdictors and increasing this from the default to 1 and then all the way to 10 only raised the casualties to 79 Interdictors. It seems like entering tactical mode at all enforces a +3 floor to the casualties on both sides as if you had increased <AutoResolveAttritionAllowanceFactor> by 3.

<AutoResolveTransportLosses>
I discovered to much lol that AICP from units in transports is included in the calculations for winner/loser. Whoopsie. Five Gallofrees full of Rebel infantry put to flight a hundred Interdictors. Zero casualties on both sides, so not sure at all how this is calculated. If you hop into tactical and then autoresolve, you lose all 5 transports and take out 14 Interdictors(!?). There's clearly something totally different at work when it comes to calculations involving land units brought to space.

<Auto_Resolve_Tactical_Multiplier>
This is interesting. The lower this is it appears to tilt battles more strongly in favor of attackers. Has no effect on normal autoresolve, but autoresolve from tactical is affected. As this value rises from 0, defending casualties appear to decrease and attacking casualties first increase, then also decrease (or maybe setting it to 10 just glitches it out). When you set it to 2, each side takes half of the expected casualties, but setting it to 0.5 doesn't double them, so I have no idea what exactly is going on with this one.

aaaand, finally, to wrap it up:

Removing the fighters from the Acclamators doesn't make a difference to the weird patterns I'm seeing. The best guess I have for what's going on is as follows:

When the game is picking casualties, it will never pick as a casualty a ship that will cause the amount of AICP damage inflicted to exceed the formula amount. It does, however, seem to stop evaluating for casualties as soon as it attempts to evaluate a ship it doesn't have enough AICP to destroy, even if it could apply enough of its remaining AICP to inflict at least 2/3 damage on it, UNLESS there is only one ship in the force to begin with... This would explain why in my tests where I got a "wrong" number of casualties, it was always lighter instead of heavier, except versus one enemy ship. Admittedly, even I don't think this is a guaranteed explanation for what is going on here. :(

Whatever order it works in, it obviously doesn't pick strictly in order of descending AICP, since in that case you would preferentially lose big ships like Star Destroyers (it doesn't appear that you do). There might be some kind of cycle of descending AICP it goes through with exceptions for cases where the opposing force couldn't generate enough damage to harm your largest ships... who knows. The order it does pick in is still a mystery to me, and at this point frankly I'm tired of wrestling with it. I have a good enough grasp on the overall situation with autoresolve for my purposes and I don't see any need to sweat the details. Still, I think we all learned something here today.

« Last Edit: January 25, 2018, 12:39:08 AM by Mord »

March 01, 2018, 10:56:18 PMReply #3

Offline Mord

  • Stormtrooper Captain
  • ***
  • Posts: 23
  • Approval: +3/-0
  • Princess Leia has had enough of your shit.
    • View Profile
Re: Autoresolve and AI_Combat_Power
« Reply #3 on: March 01, 2018, 10:56:18 PM »
So, a follow-up for posterity... The <damage> tag does not have anything to do with auto-resolve. Instead, it has an effect on whether or not a unit can be used properly by the AI. I realized this when I pulled the <damage> tags off all my spaceships and suddenly the AI got stupid - there's a programmer comment in uniqueunits.xml on the Swamp_Speeder, of all places, that points to the culprit directly:
Quote
<!-- Obsolete, but required for"combatant" behavior, which lets the AI use a unit -->

So, that's one case of a mysterious, apparently useless tag's function solved.

March 12, 2018, 04:46:38 PMReply #4

Offline demcalves

  • Stormtrooper Captain
  • ***
  • Posts: 18
  • Approval: +0/-0
    • View Profile
Re: Autoresolve and AI_Combat_Power
« Reply #4 on: March 12, 2018, 04:46:38 PM »
Interesting find on the <Damage> tag. I can finally start implementing other units into the mod!

 

Those working on this mod do so in their own free time and for no pay.
Show your support for them by enabling ads on this site!