Hello,

I wouldn't say that this is a guide, but it is helpful. I will be testing it with my mod in the next few days. All credit goes to dvk901, as this is a conversation I had with him a few years ago when all the factions in my mod were spamming militias and light troops.

Regarding units, the one thing we learned on the RS2 team in tearing RTW apart and doing intensive internal testing was that you have to 'compromise' quite often between what makes sense for the player, as opposed to what makes sense to the AI. The player, for example, will recruit units based on personal preference, even emotion at times because he\she has a particular affinity for a unit, or experience because he\she knows that this or that combination of units 'works' in battle. The AI, on the other hand, has no emotions, no preferences, and no experience. It recruits based on an algorithm that combines cost, strength of offense\defense, and how a unit matches a perceived threat from the player. All of these are important to the AI, but they are also issues that moddlers stumble over because it can make it easier for the player if you give the AI what it needs to function well.

Let's deal with cost first. Many people assign cost to units based upon what 'makes sense' to the human mind. An elite unit should cost xxx number of denari more than a lower level unit because...well, it's elite. That makes total sense to the player....but it makes little sense to the AI because the AI doesn't know what an 'elite unit' is. It only knows that unit 'a' costs more than unit 'b' because it has a certain mathematical difference in its statistics. The key here is finding a 'sweet spot' where the AI is 'satisfied' that the statistical difference is worth the extra cost, because if the AI doesn't think it's worth it, it will rarely recruit the unit. This is particularly essential when it comes to cavalry. What people don't realize is that the AI only sees a unit of cavalry as a unit that has less men in it.....doesn't give a hoot about the horse. The horse and the rider are one unit, glued together, fighting together, and they die together. We had the biggest fights about this on our team, because the human brain argues that 'of course' a cavalry unit has to cost a LOT more....you've got the horse, the man, the upkeep of the horse, the expense of the horse itself.....why, it has to cost a LOT more! Unfortunately, the AI doesn't care about any of that. The horse is 'invisible' to the AI....it's only the man and how he compares to the non-horse units that matters. This was proved over and over in our testing, to the point where we had to cost cavalry much lower than 'makes sense' in order for the AI to recruit it. For example, here is the cost of a Roman Triarii:

stat_cost 0, 1584, 616, 80, 112, 198 .................this unit has 50 men. Now here is a Roman Equite:

stat_cost 0, 340, 217, 18, 25, 43 ......this unit has 30 men.

People look at the difference in the cost and go ballistic, but if you want the Roman AI faction to recruit a few Equites in an army of Polybians and Triarii, you HAVE to make the cost of the Equite look attractive because it has fewer men and lesser stats.

What I have found out.....mostly experimenting on my own and playing a long campaign in a variation of RS2 that is my own personal mod, is that UNIT SIZE and UNIT COST are absolutely the most important factors in balance. For example, consider a 'horse culture' based faction like Scythia. If you use the 'standard' RTW thinking that gives cavalry units 30 or less units, at a cost that is 2 or 3 times that of an infantry unit, you will get armies largely based on infantry because the AI favors unit SIZE over its hard coded inclination to recruit cavalry. People argue that cavalry 'should' cost more because, after all, you've got a horse involved, but the AI doesn't care about the horse. Both horse and rider die at the same time, so the AI favors more men in a unit, not what's IN the unit.

Stuff like this makes it hard to balance a mod that allows for one 'Grand Campaign' configured in one set of EDB and EDU test, because you end up giving the player the same advantages you give the AI....which was why RS2\3 has multiple campaigns and folders that allow individual files for each faction you want to play.

Still, I have found that having cavalry units with 40 men, missile units with 50-60, and infantry units with 60.......and unit costs 'relatively' close to each other results in very balanced armies that the AI recruits. Factions that WANT cavalry, and lots of it, will recruit a cavalry unit that costs about the same as an archer unit that has 40 men in it, for example. The cheaper you make the cavalry, the more cavalry units a horse culture will recruit...(up to a point that that's ALL it will recruit!). So with a horse culture (Scythia, Parthia) you have to keep infantry and cavalry very close in terms of cost, with cavalry slightly less. I've actually had Scythia set up so that cavalry costs were so low that the AI recruited all cavalry, and particularly loved horse archers.....they were nearly impossible to beat in an open field battle! So you have to balance cavalry and infantry a little better.

For infantry based cultures (Greeks, Romans, etc) the hard coded tenancy is to recruit infantry....even if cavalry is dirt cheap. So the key is to keep cavalry costs about the same as a very low level infantry unit, and unit costs no more that 50 denarii or so as you go up the scale. The natural tendency, again, is for RTW modders to make a low level unit cost, say, 300 denarii, and a high end unit cost 3-5 times that......but the result will be armies full of low level units and battles where you crush the AI constantly. The AI formula for recruitment is a combination of total units + total defense + total offense + cost to recruit (with more emphasis, it seems, on total offense vs def.). So when you cost a unit, you have to keep in mind at all times that the AI is deciding whether that unit is WORTH recruiting, and keep the cost within the sphere of how much 'better' one unit is over another. If it is only 'slightly better', then the cost can only be slightly more...no matter what the unit's name is. Sure, you may think an 'Elite Hoplite' is a lot better than a 'Militia Hoplite', but the AI won't see it that way if you make it cost MORE than the improvement in recruiting it. You have to throw out the 'common sense' of the difference of handing a guy a spear and calling him a militia hoplite, as opposed to a veteran Hoplite with years of experience who knows what he's doing. The AI operates within a formula that CA wrote, not the common sense of our experiences.

Another issue that plays to this involves equipment, elephants and chariots. I've finally gotten the AI to recruit scorpions and onagers by reducing the cost to 'about' that of a medium to high level unit, and increasing the number of men to that of a cavalry unit (40). Now, to my dismay , the AI brings them to the battle! Still working on elephants and chariots, which are more difficult because of the way they work....but again, I suspect the reason the AI rarely recruits them is because the unit number\cost ratio is way out of whack. You typically have 12-18 units in a chariot or elephant unit, and then charge the price of a Mercades Benz for them. I keep reducing the cost (now BELOW a low level infantry unit), and the AI still won't recruit them. So I suspect they need to be dirt cheap if you want to see them at all.
Hope this helps anyone who is finding that the ai is relentlessly throwing tier 1 units at them, even though they can recruit tier 4-5 units!