AI recruitment in 1.5.7

Currently viewing this thread:


Until this patch the AI just did 50/50. So Mods that changed the troop trees had to be aware of that.
With 1.5.7 this changed and the AI should focus on having a mixed force, by selecting upgrade path that lead to cav.

How does this work?
How does the AI know wich upgrade path to take?
Are the percenteges modable?


Interesting, I would like to know too. Also to add a question, does the AI need to follow the actual entrances in "upgrade targets" in the spnpccharacter.xml or does it use it's own (unmoddable) upgrade file?


Small code block I added at 1.5.7, somebody who dealt with programming before can look and explain system and conditions and math behind it :



Master Knight
@mexxico here to save the day again. :smile:

Now I just need someone to translate it for my dummy a**

Looks like it ups the chances of all factions except Khuzaits of recruiting or upgrading cav from an initial 12% to now 20%

Parties with an already high Cav ration looks like 0.36 or 36% shouldnt do this but looks like there is still some chance they may. It says it wants to prevent parties from hitting the 45% Cav ratio mark as that badly imbalances the game.


If I understood the code correctly the AI looks if the unit can upgrade into a cav and then chooses the cav option, if the cav/inf ratio is below 36%.
And I think it looks for the shortest route to cav troops?!
The code does not distinguish between mounted archers and meele cav, I think.

Am I right?
Top Bottom