I am wondering what's driving the AI desire to a)create a group to attack city and b)actually attack city when it is surrounded
I see there are 4 parameters, which might be responsible for the operation moves:
a) min odds of success
b) initial strength advantage
c) ongoing strength advantage
d) priority
All of these factors (except for c), only deal with the likelyhood they will send their troops over and surround your lands.
After they do that, there's basically three main factors we can kind of control that remain. The first is that apparently sometimes it can be stuck in this position without meeting the minimum team requirements. I don't really know how this happens yet, but seems to be rather uncommon.
The first is that it may at this point decide for diplomatic reasons that they won't declare war. This is an irrelevant point if there's already war of course.
After that, the behaviortree is most important. If they aren't stuck in some behaviortree node (like requiring another unit to walk in closer first), they should now walk up to your city. While there, except for the changes I've already made to the behaviortree, there doesn't seem to be anything that can be done to make them attack the city more.
While fighting, the option c you mentioned may be relevant in determining whether they should back off. But I haven't been able to prove this conclusively.
On this point, I was wondering whether strategies "if strong" have too big numbers - I see that the last strategy "STRATEGY_AM_VERY_STRONG" needs 1,000 points (I assume that's the military score difference bw attacking and defending civs) and as I see this is the only strategy which values Zerg_rush operations. I have a feeling that I never saw these operations in the late game.
I'm considering phasing both that one and the zerg operation out, but the results were so nice that I was worried I'd break it by doing anything like that.
My best suspicion for the meaning of the 1000 points is not the difference with the target, but the military score difference to the number 2 on the rankings. However, testing suggests that may be inaccurate.
All these strategies are at the least global, in that civs either have them or they don't. So it can't be dependent on a 'target'
Yeah, I changed parameter city_strength_per_pop to 1 but it doesn't create that much difference. Do you know how is the technology scaling factor named in the game? I scanned through global_parameters.xml but can't see any exact parameter named after city defence scaling.
If you decrease city_strength_per_pop you should see higher defense values. It's the amount of strength added per x pop.
The only value that appears to relate to the tech scaling is COMBAT_GARRISON_MILITIA_MODIFIER. Basically their strength will be the highest melee combat strength on units you have, minus COMBAT_GARRISON_MILITIA_MODIFIER, except if there's a garrison, in which case it'll pick the combat strength of the garrison. Have a look at gamechangers.xml in my mod to see basically everything it seems you can influence.
I noticed that AI normally doesn't build ships apart from navy civs (England/Norway) and some strange situations (not sure what they are, but mainly when AI is locked on small piece of land). I increased general desire to build ships by 200 and decreased desire for it for navycivs by 250 and after this change AI started building ships in relatively normal numbers. Sadly, there are currently no operations for "Naval assault".... is it possible to create this type of operations for ships (e.g. including 2-3 melee ships and 3 ranged ships and mb 1-2 melee land unit)?
Yeah so far I've decided to make them kind of underbuild navy and air while they're incapable of even using them properly. I've not tried a proper naval assault operation yet, and may give it a shot when I do some more water map changes. Have mostly been focussing on land-dominated maps so far, especailly because naval cities are so weak now in civ 6 anyway.
I am not sure whether the issue is in the mod or is it after winter patch but I started seeing AI building tons of inquisitors - I saw stack of 10-11(!) Sumerian inquisitors.... I have a suspicion that AI incorrectly defines this type of unit or has some weird preferences towards building it. Mb this is something to do with newly added code for religion picking.
I think it was the fall patch actually that made this happen. They added a new inquisition behaviortree that seems to be causing this.
Sometimes I see that AI grabs all its forces and move them to weird places, e.g. snow deserts in map ends. I have a suspicion that AI probably tries to create either massive escort for its settlers/workers or it tries to attack enemy city but the target is unreachable. The problem is that it takes ages for AI to dismiss this move and start behaving back normally. Even if it is DoWed by other civs, AI won't relocate its units quickly.
Yeah it's mostly settle escorts that do this. For some reason, the max units values on settle operations have stopped working properly. It's a bit annoying indeed
By the way, I noticed that defence operations are switched off in the code.... can we change to give AI a bit more ability to defend it? Because sometimes AI is about to lose its capital but it is careless about this fact because it is fighting another civ on the opposite end of his empire.
They're only switched off now when their cities aren't under threat. It used to be that it would keep some units locked in a defense operation that didn't even know where to go because all of its cities were safe, resulting in much smaller attack forces. When a city does become under threat, these will start up again.