@mexxico Hey, I was looking at the new troop upgrade code (in UpgradeReadyTroops and CalculateUpgradeChance), and I wanted to point a few things out that might affect snowballing. I think Khuzait npcs are actually upgrading their recruits to the cavalry branch at a
higher rate than they were prior to the change.
Before the change, I think how it worked is that they would just split troops 50/50 between the two upgrade branches. The problem now is that when they recruit a bunch of T1 Khuzait Nomads, this pulls down their cavalry ratio below 0.36 (because Nomads count as infantry), so they start funneling upgrades into the cavalry branch at a >50% rate. This means a higher proportion of their Nomads get sorted into the cavalry branch than the non-cavalry branch than before. Here's an example of what I mean:
Anat already has more Khuzait troops upgraded into the cav branch than non cav branch, but since she has 71 Nomads in her party, her cav ratio is only listed as 0.233, and the game therefore calculates a ~70% chance to upgrade her Nomads into the cavalry branch vs. 30% to non-cav. If you plug in the numbers, even at a 0.3599 cav ratio, the game will still be funneling Nomads into the cavalry branch at about a 63 to 37 split. After her cav ratio rises above 0.36, the upgrade split will return to 50/50. Compare that formula to 1.5.6, where the overall split would be a constant 50/50, regardless of cav ratio.
This means Khuzait as a whole will be getting more cavalry, at a faster rate. If you look at this comparison of the troop composition of two Khuz. armies from 1.5.4 (left) and 1.5.7 (right), you can see that the 1.5.7 army has a higher proportion of troops from the cavalry branch than non-cavalry branch (especially when looking at Tribal Warriors vs Footman):
I'm not offering this as hard proof, since it's only two data points, but it helps illustrate what I mean.
Then the other point I wanted to make is that for the other factions there is a significant amount of "lag" time between when a T1 recruit gets sorted into the half of the troop tree with cavalry, and when it actually becomes a cavalry troop. Specifically for the Empire, they only have one cav troop at T5 in their main line of troops, so a high proportion of recuits get sorted into the archer branch, but relatively few of them survive long enough to become horse archers. This isn't much of an issue on its own, but it makes the tactics perk Tight Formations (Infantry deal 10% more damage to cavalry in auto-calc) less useful against Khuzait since fewer troops get sorted into the infantry branch. Here's another screenshot of an Empire army in 1.5.7 with many more archers than infantry, but relatively few cavalry (only a ratio of 0.04):
So two possible solutions:
- Only count T2+ troops in the cav ratio. There are no T1 cav troops in the game, but most non-bandit T1 troops have the potential to upgrade into cavalry eventually. This will hopefully prevent the game from sorting so many Nomads into the cavalry branch of Khuzait parties.
- Allow npcs to recruit more tavern mercenaries (specifically Watchmen and Scouts). This gives factions more abundant access to cavalry troops quicker, but currently npcs don't recruit many mercenaries because there is a high gold requirement in place that only clan leaders can meet (though make sure there are still plenty of mercs left for the player ). As a side note, it seems the mercenary selection code might be bugged, because it isn't spawning any troops from the Scout branch of the merc tree that I can tell (unless that's intended).
This method gives huge advantage to cav based armies because the buff is big enough that cavalry unit at T5 can kill any infantry/ranged unit up to T4 at first try.
That's overstating the advantage a bit though, as
any unit can kill any other unit first try, since it's all probability based. If you crunch the numbers from the auto-calc model, a T5 cav unit has about a 40% chance on average to kill a T4 infantry unit on any given hit, but a T4 infantry unit
also has a 22% chance to kill a T5 cav unit on any given hit. If you compare T5 cav vs T5 inf, it's a 34% vs 26% chance respectively. So even though the cavalry unit has a 20% bonus applied to its power level, this only shakes out to be roughly an 8% greater chance to kill a non-cav unit of equivalent tier than vice versa.
Lets give them some strategic reason for moving, attacking and defending.
Strategic reasoning is the hard part though. You can add as many rules as you'd like to the actual auto-calc model (TW has already implemented conditional terrain and unit-countering perks in the tactics tree, for instance), but with those extra rules thrown in, making the AI understand
how their party strength compares to every enemy they come into contact with
before they attack isn't exactly trivial. I'm not an expert, but you'd probably have to run a bunch of strength comparisons for each of the different troop types between parties for every hostile party that comes close to every other party, or if the ruleset is too complex, just execute the auto-calc code in advance. Considering mexxico said this:
Also we have to understand what to do in miliseconds for each party in world because these calculations are done in all map (1000s of parties) so these calculations should be done so effectively means we cannot check all parties in a large area for each party
a few pages back, I think they probably want to keep that aspect of the AI code streamlined.
(Sorry for the novel, guys
)