@Charles555nc
Higher minimum defense is also a bit of a tricky issue. Keep in mind that the AI can't simply just have more defenders. Putting more defenders in the inner cities would mean putting fewer defenders in the more vulnerable cities... Sometimes that might work out well for them, but often it would not. When I play, I usually have almost no defenders in cities that I'm confident are safe. I put everything I've got in the border cities, and I make sure that if someone tries to charge at one of my undefended cities, I have some proper defences somewhere nearby that can get to the city first - or at least block the path. -- Unfortunately, the AI can't really play like that; but what the do try to do is to put most of their guys in the border cities, and then counter-attack any stacks that come into their territory. I think it works alright most of the time, but if they run out of counter-attacker, then they're a bit stuffed. It obviously isn't a great strategy, but I suspect that it wouldn't be any better to simply have more guys standing around doing nothing in fairly safe cities.
You are the programming genius, not me. But as a human player, I know that I have to have a certain number of defensive units (even units in cities by the ocean or in cities near "friendly" ais) just to cover myself for military police (hereditary rule) happiness,to thwart a potential naval invasion, or stop a potential back stab by the ai. Hell, really just not to look like a juicy target to the ai.
6 units per city (medieval period and after) wont stop a big invade, but it'll do a much better job of defending- perhaps requiring the invading army to bombard first, before straight attacking the city. Perhaps start at base 3 defenders for the bronze age, and add one for each age after...
Maybe we have different playstyles but I try never to have less than 6 defenders in a city, and if I dont, Im building up troops desperately and not even thinking about invading anyone else until I do. If anything your mod has taught us, that there are no safe cities.
My suggested solution would be to have the Ai have increased military production efforts/focus, through slaving, regular production, or drafting, until this minimum requirement is met. Maybe have the AI more heavily exploit their cheaper unit upgrades by producing cheap units when they can still upgrade (archers into longbows, pikemen into rifles, grenadiers into machine guns etc etc).
I divide my cities into 3 different types (tech, production, and hybrid-does well at tech and production). Does the ai do the same thing? Maybe have more production focused cities for the ai...
The ai usually has no problems teching and whoring wonders, so a little more focus on extra military production wouldnt hurt them imo- especially with your new war adjustments, and difficulty bonuses.
Im still finding success by launching a mega stack at the enemy capital or most powerful city, ignoring its other cities, and burning it to the ground, although its been getting harder to do and they generally hate me for the rest of the game. I do this because capitals are huge part of the ai (and player) economies, and I can generally snuff out holy cities, and alot of their great general specialists that are extremely powerful and almost impossible to replace. My experience with all this stuff is on emperor difficulty only tho.
Then there is the situation like you probably see, where one Ai declares war on the other, and then their two mega stacks pass each other and they both lose a city...but thats probably much farther away of an adjustment.
I want to be clear that I love your mod and this is not a huge issue. Im a big fan and I get a kick out of providing the mega modder with my best constructive feedback. I would love the ai out thinking/out playing me, strangely enough lol.
Thank you so much for keeping me playing this game for so long! I love reading about new updates!!
p.s. Btw can you post the donate link again? Youve saved me so much in gaming fees.
Edit: O, for the "Desperate state of mind" ai mindset. They probably shouldnt trade military tech/resources TO adjacent ais that dont like them. In my mind, they should trade FOR military tech/resources (possiblely at a larger price than they usually would pay, since they are desperate) but trading away military tech to angry neighbors might be a bad condition. But then theres the trading military tech FOR military tech situation...lol. But you know better than I do about what to do.