grimjaw
General
Posts: 506
Joined: Wed Feb 09, 2011 5:38 am
Location: Arkansas

AIPowerAffinity improperly applied in CW2 1.06?

Sun Jan 03, 2016 12:11 am

I came across this when I was creating additional militia units and copying from game files as templates. I originally mentioned it in an unrelated post, and the response from Pocus made me look into it more closely.

This particular issue doesn't exist in my base (1.00), unpatched game and I'm not sure when it was introduced. In my *unmodified* game (CW2 base (1.00), patched directly to 1.06) there are 86 unit files that have an area alias for AIPowerAffinity (list below). The description I could find for AIPowerAffinity is (from Pocus I believe):

"affinity for big stacks, number is a sub category/family, i.e if several have same number, the code understand they have the same function and won't add one each in the stack."


I *think* Pocus meant that it will only add one of the same function to each stack because to do otherwise would be redundant. When I look at the units targeted by AIPowerAffinity in the 1.05 DB, that makes sense. The definition of "big stacks" plays an important part here, but I couldn't find how many elements in a stack it takes for AIPowerAffinity to kick in. All I can tell you from playtesting is that it seems to be more than two.

Even if AIPowerAffinity contains an alias, it won't cause an obvious error. You usually won't see the problem because you usually aren't watching over the Athena's shoulder. If I'm correct about the way AIPowerAffinity is supposed to work, marine and other amphibious units get the number "2" to prevent the AI from combining them in "big stacks" and wasting their amphibious function. That's at least in the 1.05 *DB*, which does not have this issue. The area alias, like most aliases, is converted to a number. Since the area alias for Vermont ($VT) also converts to "2", you won't see the AI combining Vermont militia with marines in "big stacks". Big deal, right?

New Jersey's area alias converts to "7", which is the same number applied in the DB to Union medical companies, so for any "big stacks" containing NJ militia the AI will avoid adding medical companies (or any qualifying unit with AIPowerAffinity "7"). If you think that isn't a problem, see the lone NJ militia unit in the region with McDowell's army in the full campaigns. If Athena grabs it and combines it into McDowell's army, it might prevent her from also stacking a medical company. The AI might also avoid combining militia from the same state in "big stacks".

Whether I'm right or wrong about AIPowerAffinity, are the values in my game by design? If so, why was I corrected when I attempted to copy the values into new units of the same type?

The AIPowerAffinity area alias value is not universally applied to militia or volunteer units. Some state militia battalions don't have the issue, nor do Mexican militia.

If the value is a mistake and you have this issue, it is easy to correct the it by applying a NULL value to the AIPowerAffinity field in the 1.06 DB and recreating your units via the CSVSplitter. If you aren't patched up to 1.06 I suspect you don't have the issue but I can't swear to it. If you don't have the 1.06 DB (I don't) you can edit the specific unit files to remove the line containing AIPowerAffinity.

List of affected units in 1.06 (number in parentheses is the line # in the file):

Searching for: AIPowerAffinity = $
1117GBRCanadian Militia (CA).uni(17): AIPowerAffinity = $Canada
1138INDCherokee Warriors.uni(15): AIPowerAffinity = $West
172CSAVolunteers (AL).uni(18): AIPowerAffinity = $AL
173CSAVolunteers (AR).uni(18): AIPowerAffinity = $AR
174CSAVolunteers (FL).uni(18): AIPowerAffinity = $FL
175CSAVolunteers (GA).uni(18): AIPowerAffinity = $GA
176CSAVolunteers (KY).uni(18): AIPowerAffinity = $KY
177CSAVolunteers (LA).uni(18): AIPowerAffinity = $LA
178CSAVolunteers (MS).uni(18): AIPowerAffinity = $MS
179CSAVolunteers (MO).uni(18): AIPowerAffinity = $MO
180CSAVolunteers (NC).uni(18): AIPowerAffinity = $NC
181CSAVolunteers (NM).uni(18): AIPowerAffinity = $NM
182CSAVolunteers (SC).uni(18): AIPowerAffinity = $SC
183CSAVolunteers (TN).uni(18): AIPowerAffinity = $TN
184CSAVolunteers (TX).uni(18): AIPowerAffinity = $TX
185CSAVolunteers (VA).uni(18): AIPowerAffinity = $VA
186CSAState Militia (AL).uni(18): AIPowerAffinity = $AL
187CSAState Militia (AR).uni(18): AIPowerAffinity = $AR
188CSAState Militia (FL).uni(18): AIPowerAffinity = $FL
189CSAState Militia (GA).uni(18): AIPowerAffinity = $GA
190CSAState Militia (KY).uni(18): AIPowerAffinity = $KY
191CSAState Militia (LA).uni(18): AIPowerAffinity = $LA
192CSAState Militia (MS).uni(18): AIPowerAffinity = $MS
193CSAState Militia (MO).uni(18): AIPowerAffinity = $MO
194CSAState Militia (NC).uni(18): AIPowerAffinity = $NC
195CSAState Militia (NM).uni(18): AIPowerAffinity = $NM
196CSAState Militia (SC).uni(18): AIPowerAffinity = $SC
197CSAState Militia (TN).uni(18): AIPowerAffinity = $TN
198CSAState Militia (TX).uni(18): AIPowerAffinity = $TX
199CSAState Militia (VA).uni(18): AIPowerAffinity = $VA
236INDApache Warriors.uni(15): AIPowerAffinity = $West
237INDIndian Warriors.uni(15): AIPowerAffinity = $West
238INDSioux Warriors.uni(15): AIPowerAffinity = $West
239INDCheyenne Warriors.uni(15): AIPowerAffinity = $West
240INDCommanche Warriors.uni(15): AIPowerAffinity = $West
241INDMescaleros.uni(15): AIPowerAffinity = $West
443USAVolunteers (CA).uni(18): AIPowerAffinity = $CA
444USAVolunteers (CT).uni(18): AIPowerAffinity = $CT
445USAVolunteers (DE).uni(18): AIPowerAffinity = $DE
446USAVolunteers (IA).uni(18): AIPowerAffinity = $IA
447USAVolunteers (IL).uni(18): AIPowerAffinity = $IL
448USAVolunteers (IN).uni(18): AIPowerAffinity = $IN
449USAVolunteers (KY).uni(18): AIPowerAffinity = $KY
450USAVolunteers (MA).uni(18): AIPowerAffinity = $MA
451USAVolunteers (MD).uni(18): AIPowerAffinity = $MD
452USAVolunteers (ME).uni(18): AIPowerAffinity = $ME
453USAVolunteers (MI).uni(18): AIPowerAffinity = $MI
454USAVolunteers (MO).uni(18): AIPowerAffinity = $MO
455USAVolunteers (KS).uni(18): AIPowerAffinity = $KS
456USAVolunteers (NH).uni(18): AIPowerAffinity = $NH
457USAVolunteers (NJ).uni(18): AIPowerAffinity = $NJ
458USAVolunteers (NM).uni(18): AIPowerAffinity = $NM
459USAVolunteers (CO).uni(18): AIPowerAffinity = $CO
460USAVolunteers (NY).uni(18): AIPowerAffinity = $NY
461USAVolunteers (OH).uni(18): AIPowerAffinity = $OH
462USAVolunteers (PA).uni(18): AIPowerAffinity = $PA
463USAVolunteers (RI).uni(18): AIPowerAffinity = $RI
464USAVolunteers (VT).uni(18): AIPowerAffinity = $VT
465USAVolunteers (WI).uni(18): AIPowerAffinity = $WI
466USAVolunteers (MN).uni(18): AIPowerAffinity = $MN
467USAVolunteers (WV).uni(18): AIPowerAffinity = $WV
469USAState Militia (CA).uni(18): AIPowerAffinity = $CA
470USAState Militia (CT).uni(18): AIPowerAffinity = $CT
471USAState Militia (DE).uni(18): AIPowerAffinity = $DE
472USAState Militia (IA).uni(18): AIPowerAffinity = $IA
473USAState Militia (IL).uni(18): AIPowerAffinity = $IL
474USAState Militia (IN).uni(18): AIPowerAffinity = $IN
475USAState Militia (KY).uni(18): AIPowerAffinity = $KY
476USAState Militia (MA).uni(18): AIPowerAffinity = $MA
477USAState Militia (MD).uni(18): AIPowerAffinity = $MD
478USAState Militia (ME).uni(18): AIPowerAffinity = $ME
479USAState Militia (MI).uni(18): AIPowerAffinity = $MI
480USAState Militia (MO).uni(18): AIPowerAffinity = $MO
481USAState Militia (KS).uni(18): AIPowerAffinity = $KS
482USAState Militia (NH).uni(18): AIPowerAffinity = $NH
483USAState Militia (NJ).uni(18): AIPowerAffinity = $NJ
484USAState Militia (NM).uni(18): AIPowerAffinity = $NM
485USAState Militia (CO).uni(18): AIPowerAffinity = $CO
486USAState Militia (NY).uni(18): AIPowerAffinity = $NY
487USAState Militia (OH).uni(18): AIPowerAffinity = $OH
488USAState Militia (PA).uni(18): AIPowerAffinity = $PA
489USAState Militia (RI).uni(18): AIPowerAffinity = $RI
490USAState Militia (VT).uni(18): AIPowerAffinity = $VT
491USAState Militia (WI).uni(18): AIPowerAffinity = $WI
492USAState Militia (MN).uni(18): AIPowerAffinity = $MN
493USAState Militia (WV).uni(18): AIPowerAffinity = $WV
Found 86 occurrence(s) in 86 file(s)

User avatar
lodilefty
Posts: 7616
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Sun Jan 03, 2016 3:08 pm

Good catch!

Interestingly, the latest developers DB for Units has fixed this, by putting NULL in the AIPowerAffinity for these units....

I'm not up to speed on CW2 patch status, so: is there a Public Beta patch since 1.06?

To answer your question: simply delete that line in each unit.....
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]
[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]

[CENTER]Rules for new members[/CENTER]
[CENTER]Forum Rules[/CENTER]

[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

Return to “CW2 Technical support / Aide technique”

Who is online

Users browsing this forum: No registered users and 3 guests