Due to a sudden burst in spammer activity, account creation has been temporarily disabled. Sorry for the inconvenience to any new potential contributors.
AI Leaders Affinity toward stacks
From AGEWiki
The concept is 'leader affinity toward a given stack'.
Let's say a leader is an Infantry commander. You'll want to seek mostly infantry stacks, not cavalry stacks. You can be more precise even. A leader is a siege expert. He will want to go to stacks with some infantry (+), artillery (++) and siege artillery (++++ !!). A militiaman will want to be among militias...
In the end, it boils down to two things: creating lists and giving a list reference to the leaders.
// #Infantry commander
AIAffinity0 = $famElite|150|$famLine|250|$famCavalry|25|$famMedArty|125|$$famLightInf|150|$famSkirmisher|150
// #Militia commander
AIAffinity1 = $famElite|25|$famLine|50|$famMilitia|400|$famCavalry|25|$famHvyArty|0|$famMedArty|0
// #Siege expert
AIAffinity2 = $famElite|125|$famLine|125|$famMilitia|50|$famCavalry|0|$famSupply|150|$famHvyArty|300
// #Cavalry commander
AIAffinity3 = $famElite|0|$famLine|25|$famMilitia|0|$famCavalry|300|$famSupply|0|$famHvyArty|0|$famMedArty|0
// #Bad commander
AIAffinity4 = $famElite|0|$famLine|25|$famMilitia|50|$famCavalry|0|$famSupply|0|$famHvyArty|0|$famMedArty|0|$famLightInf|0|$famSkirmisher|0
// #Raider
AIAffinity5 = $famRaider|300|$famLightInf|125|$famSkirmisher|125|$famLine|25|$famMilitia|20|$famCavalry|50|$famSupply|0|$famHvyArty|0|$famMedArty|0|$famElite|0
// #Artillerist
AIAffinity6 = $famElite|25|$famLine|50|$famMilitia|25|$famCavalry|0|$famHvyArty|300|$famMedArty|300
0 means not interested. 100 is the norm. Above 100: interested
If a family is not cited, the value is -1. -1 means auto-calculate: if the general is a land commander it means 100 for all land families and 0 for all ships, and the reverse if he is an admiral.
Thus, you don't have to specify for a General that he doesn't want to see ships in his stack.
How do the parameters work?
- With these values, when the code checks for the affinity of a leader toward a stack, it will get a consolidated number between 0 and xxx (can be above 100).
- 100 would means 'average', i.e if you don't add a specific affinity list to a general, as the defaults will be 100, then you are back to the previous code.
- Under 100, the leader will have less interest than the norm for the stack. Above 100 ... you guess.
So the feature allows to have generals with several varying interests for different types, and can calculate what will be the average, weighted affinity, of this general toward a stack, even if the stack is a complete mix of units...
Affinity will alter the probabilities, but the algorithm by itself can't match a human mind. Still, just expect in some cases that the choices of how to repartitate leaders will be better with than without.
Don't hesitate to go a bit above the roof. Example, siege artilleries are rare, so even if you have an affinity at 300% for it, as there can be perhaps only 2 such elements in a stack of 100+ elements, this won't change much the affinity! So here, don't hesitate to go to a value of 1000 or even 2000!
For affinities toward more common elements, like cavalry, artillery, you can still target the 300 mark...
The second part of adding affinities is to give to the leaders, in the models DB, what is their affinity list. With the lists created, you will do these aliases (in WIA, found in AI_Interest.ini in the /Aliases folder):
- $AIAff0_inf = 0
- $AIAff1_mil = 1
- $AIAff2_siege = 2
- $AIAff3_cav = 3
- $AIAff4_bad = 4
- $AIAff5_Raid = 5
- $AIAff6_Arty = 6
In the models.xls file, add (or edit) the column AIAffinity, leave the value as NULL if there is no special ability, or add one (and only one) of the aliases if the leader has a particular affinity for a role. Then extract your new models (using the csv -> csv Splitter method)
Remember to delete Model.Cached file (in /GameData/Models), then restart the game for your changes to take effect.