Resource icon

AI+ v13.1

Hey Siesta, glad to see you around... sooo, some finetuning, eh? :)

Would you advise using the mod as v11.1 with the autumn patch?
 
Yeah I would still recommend it if you preferred it before the fall patch. It seems to mostly run as it used to. Settle rates, building choices and ability to capture stuff seem to basically be the same and I haven't noticed any other anomalies.
Finetuning will be done if necessary.
 
Will 11.1 'interfere' with the new naval changes they added?
 
So it shouldn't, but it could. I can only confirm that the new fall patch naval operations still run, which means it probably works. However, there may be some small interference. I've not been able to confirm a successful naval attack in testing yet.

I'm currently testing it, but it's a rather annoying process, so any feedback is very welcome.
Why is it annoying: For any kind of certainty I'd have to analyze like 5+ full games both with and without the mod since naval assaults are not something that'll happen every game anyway. It takes me like 5 hours to run a match and I have to actually watch it since the log files won't be clear enough.
 
Last edited:
Hi Siesta,
I ran several games on the autoplay mod (island plates, 8-10 players, Emperor/Deity difficulties) after the fall patch mainly without AI+ and noticed the following:

1. Settling team behaviour:
a) on Island maps AI settles quite far from the original homeland. This sometimes leads to crazy situations when AI set a city right next to another AI on the opposite end of the world, despite having several empty islands next to it. (I think this can be corrected easily by changing preferences to closer settlements)
b) AI sometimes takes most of its army to accompany a settler - I think there is no limit on number of max combat units in settlement operations)

2. Military behaviour:
Naval assaults: I also haven't seen any city being taken by ships (I thought maybe I missed it as I don't monitor closely autoplay games).
At the moment there are two naval actions in the game: Naval_superiority operation with its own behaviour tree and team name "City Naval Attack Force" which uses normal siege operations with condition that target should be coastal (seems that someone in Firaxis reads this thread).
AI certainly does run Naval_Superiority operation - it builds number of ships and moves them across the oceans as coordinated groups but rarely use them in sieges, using them more as an escort formation.
When it comes to sieges AI prefers to use land units, I see several reasons for it:
* Naval teams have a condition of min percentage of ships just 1%. I don't know why it is so low - if AI can't get ships to the target of Naval assault, it can always use normal siege operation (there is no condition for it)
* AI always prefers to use normal city siege operation rather than the Naval attack (not sure why)
* Min odds of success and new unit requirement ("Must Have Units" condition) are too high - AI just can't get that many units in a close proximity to the city (this is more a general observation for both land and naval operations - I started seeing AI amassing large groups and moving them close to the border but not attacking opponent at all).

To be honest I am not sure about this Naval Superiority thing - it is good that Firaxis tries to make AI think about escorting transport ships but this might be also preventing AI from using naval units in Naval city siege operation. I will try to change some of these parameteres to see if this will result in better naval attacks. It seems that now we got some tools for Naval AI, we just need to use them to tune the AI.
 
Thanks Lion King!

What you describe sounds very similar to what I've seen in the couple of games I've ran with AI+. So I suppose that, and the fact that the logs do show that the City Naval Attack Force operation is still running with AI+ sounds like a pretty good confirmation that they still work.

I've also noticed the settler armies and mentioned it somewhere a few pages back. It seems to have started at the summer patch and it feels like they just straight out removed/broke the operation max unit limits. The minpercentage thing is new afaik and may indicate that some kind of rework happened to the whole operation team limit system. The minpercentage thing doesn't seem to do more than to just require a single unit of the type, so I don't know either why they'd be picked over just simply requiring a single unit.

Kind of doubting the devs are reading this based on the naval operation implementation, unless they recently started. Naval operations have been a discussion point for a while.
In case some dev does, please support a lua based override of AI behavior! Some AI related actions can be done, like moving a unit, but the AI ignores the fact a unit is already moved (even if movement points are reduced) so units move twice. Same deal with basically all other types of behavior, either its outright impossible through lua, or if it is possible, the AI will still do its own thing. The information obtainable in lua is pretty good so all it takes it better action control (movement, attacking, worker actions etc. construction, picking policies/research, diplomacy) and the ability to override AI functions to be able to do quite a lot. (a bit of documentation would also help)
If that'd be too impactful/too much work, is some kind of lua integration possible? Perhaps we could call a lua method in the StrategyConditions, have lua integrations in custom behaviortree nodes or have some condition on operations based in lua. Any of these would massively increase the amount of things we can do
 
Hi Siesta,
I ran several games on the autoplay mod (island plates, 8-10 players, Emperor/Deity difficulties) after the fall patch mainly without AI+ and noticed the following:

1. Settling team behaviour:
a) on Island maps AI settles quite far from the original homeland. This sometimes leads to crazy situations when AI set a city right next to another AI on the opposite end of the world, despite having several empty islands next to it. (I think this can be corrected easily by changing preferences to closer settlements)
b) AI sometimes takes most of its army to accompany a settler - I think there is no limit on number of max combat units in settlement operations)

2. Military behaviour:
Naval assaults: I also haven't seen any city being taken by ships (I thought maybe I missed it as I don't monitor closely autoplay games).
At the moment there are two naval actions in the game: Naval_superiority operation with its own behaviour tree and team name "City Naval Attack Force" which uses normal siege operations with condition that target should be coastal (seems that someone in Firaxis reads this thread).
AI certainly does run Naval_Superiority operation - it builds number of ships and moves them across the oceans as coordinated groups but rarely use them in sieges, using them more as an escort formation.
When it comes to sieges AI prefers to use land units, I see several reasons for it:
* Naval teams have a condition of min percentage of ships just 1%. I don't know why it is so low - if AI can't get ships to the target of Naval assault, it can always use normal siege operation (there is no condition for it)
* AI always prefers to use normal city siege operation rather than the Naval attack (not sure why)
* Min odds of success and new unit requirement ("Must Have Units" condition) are too high - AI just can't get that many units in a close proximity to the city (this is more a general observation for both land and naval operations - I started seeing AI amassing large groups and moving them close to the border but not attacking opponent at all).

To be honest I am not sure about this Naval Superiority thing - it is good that Firaxis tries to make AI think about escorting transport ships but this might be also preventing AI from using naval units in Naval city siege operation. I will try to change some of these parameteres to see if this will result in better naval attacks. It seems that now we got some tools for Naval AI, we just need to use them to tune the AI.




Where can I find the file that has ("Must Have Units" condition) and others as I would like to mess with them myself, please?
 
Where can I find the file that has ("Must Have Units" condition) and others as I would like to mess with them myself, please?

Original data is stored in Base/Assets/Gameplay/Data. The two most relevant files will be Operations.xml and Behaviortrees.xml. Operations is quite easy to mess up.
However, I wouldn't recommend changing BehaviorTrees without good understanding of how the tree works - it is quite easy to break. Also don't change original files - you better use Siesta's mod and delete all files apart from military.xml. This file contains a lot of similar information on operations and teamrequirements.

Thanks Lion King!

What you describe sounds very similar to what I've seen in the couple of games I've ran with AI+. So I suppose that, and the fact that the logs do show that the City Naval Attack Force operation is still running with AI+ sounds like a pretty good confirmation that they still work.

Hmm, it is possible, but because of minpercentage=1 I hardly saw any ships attacking cities in the unmodded game. I tried to amend naval superiority tree to force ships to attack cities, however it didn't work. I decided to choose another path and create minimod with additional Naval operation, also amending teamrequirements to increase presence of naval units. Now I clearly see AI building mixed naval/land forces and successfully taking cities by using ships. Would be good to try it with AI+ to see the results.
 

Attachments

Thanks! I'll give it a shot to see what happens.

I noticed your comment that "Max is set because the AI cant handle logistics above a certain number of units"
While that comment is generally true, there's an important setting to control this you may not have found yet. So just in case:
In the behaviortrees there's a value set to 2 on the move units node right before they get into the attack city part (the name of the variable escapes me). This variable controls the minimum distance that units need to be at before the game allows moving past that node. It so happens that since it's set to 2, if armies get too big or if there are many mountains, it very frequently fails to get all of its units within that distance of 2. So it never moves past that node and it ends up just standing around the city with its armies while not doing anything. If you set this one to 3, it's much less likely to get stuck and ends up handling big armies a bit better.

I also noticed you haven't included a particular fix to operations which ends up making it significantly less likely that enemies attack in the lategame. Some of the operations (the city defense and the return worker operations IIRC) dont have an operation type set. This seems to end up interfering with the maximum limit of operation types. If you slap operationtypes on them it ends up launching more city attack operations late game.
 
Original data is stored in Base/Assets/Gameplay/Data. The two most relevant files will be Operations.xml and Behaviortrees.xml. Operations is quite easy to mess up.
However, I wouldn't recommend changing BehaviorTrees without good understanding of how the tree works - it is quite easy to break. Also don't change original files - you better use Siesta's mod and delete all files apart from military.xml. This file contains a lot of similar information on operations and teamrequirements.



Hmm, it is possible, but because of minpercentage=1 I hardly saw any ships attacking cities in the unmodded game. I tried to amend naval superiority tree to force ships to attack cities, however it didn't work. I decided to choose another path and create minimod with additional Naval operation, also amending teamrequirements to increase presence of naval units. Now I clearly see AI building mixed naval/land forces and successfully taking cities by using ships. Would be good to try it with AI+ to see the results.




Thanks for the info. Okay, so I have not look at that yet since I really do not know what I am doing yet... I wanted to know if you or Siesta Guru were planning to update the changes in one of these mods?
 
One other thing I have never seen the AI players make any carriers all game long, are the AI players able to use carriers and can the AI players be made to at least look into getting one or two carriers?
 
Thanks! I'll give it a shot to see what happens.

I noticed your comment that "Max is set because the AI cant handle logistics above a certain number of units"
While that comment is generally true, there's an important setting to control this you may not have found yet. So just in case:
In the behaviortrees there's a value set to 2 on the move units node right before they get into the attack city part (the name of the variable escapes me). This variable controls the minimum distance that units need to be at before the game allows moving past that node. It so happens that since it's set to 2, if armies get too big or if there are many mountains, it very frequently fails to get all of its units within that distance of 2. So it never moves past that node and it ends up just standing around the city with its armies while not doing anything. If you set this one to 3, it's much less likely to get stuck and ends up handling big armies a bit better.

I also noticed you haven't included a particular fix to operations which ends up making it significantly less likely that enemies attack in the lategame. Some of the operations (the city defense and the return worker operations IIRC) dont have an operation type set. This seems to end up interfering with the maximum limit of operation types. If you slap operationtypes on them it ends up launching more city attack operations late game.

Thanks for looking on this! I tried not to touch anything apart from Naval groups and just new operations but will definitely amend operations and behaviortree. Regarding behavior tree issue - how did you spot this in the game? I saw so many times AI not doing anything because of this issue and was always wondering whether they are trying to hire more units.

Thanks for the info. Okay, so I have not look at that yet since I really do not know what I am doing yet... I wanted to know if you or Siesta Guru were planning to update the changes in one of these mods?

I am now focusing on adding proper naval city attacks, AI is relatively okay with doing land combats in AI+ (even in base game it became better). I believe Siesta is waiting for a better modding tools but we can always try to ask him for an update...)

One other thing I have never seen the AI players make any carriers all game long, are the AI players able to use carriers and can the AI players be made to at least look into getting one or two carriers?

Yeah, same thing, I never saw AI using them. I believe AI just consider them "inefficient" because they cost a lot but cannot attack units or cities.
AI definitely can be made building them, there are several potential ways of doing it:

1. Simple way (not sure if it works): by adding it to AiFavoredItems and also checking that carrier unit belongs to Unit_Naval class.
2. More complicated: Creating separate class for these units (unit_naval_carrier), creating new team (Naval Base strike team) with minimum number of unit_naval_carrier at least one, creating new operation linked to this team (Naval base strike operation) with ideally its own operation type. Then you can give this operation type allowed limit and put it in favored items with the precondition of player reaching tech which allows building of carriers. There is a "ZergRush" type of operation done in AI+, you can create carrier operation using this as a template.
AI should build carriers and use them as part of naval formation (if you put siege city assault as behavior tree) however I believe it won't be putting airplanes into carriers and using them - this is where the whole behavior tree needs to be created. Siesta can better advise on this.
 
Yeah I'm just doing maintenance now really. Without better tools I don't feel I can add much more, inspiration for truly fundamental changes has run out so it's mostly just doing weight tweaks now. And while doing that can improve AI skills, it's too difficult to say to what extend they truly help the AI, especially since there's no way of having different players use different weights.

Regarding behavior tree issue - how did you spot this in the game? I saw so many times AI not doing anything because of this issue and was always wondering whether they are trying to hire more units.

Do you mean the issue where they get stuck around a city? Or the operations not being launched thing?
I noticed the 'stuck around city' thing by looking at the operation and behaviortree logs when I saw a particularly awful case where Scythia surrounded a city near mountains for hundreds of years and never attacked. It turned out they just got stuck in a movement node. I saw movement nodes has a variable for the minimum distance required, and saw that there were simply too many too units to be able to fit them all within a 2 tile radius (like 15 units for 7 tiles) so it could never get them all in range. Turns out there are actually 2 variables for distance. As far as I understand it now, there's basically a sort of 'center' (or leader?) of the operation. To complete a movement node, the center of the operation must be within a certain tile radius of the target goal, and all units must be within a tile radius of the center. Especially the latter is impactful.

Operations not being launched took me much longer and was one of the last genuinely impactful changes I did. For a while I had noticed that in late game, civs would build very few units. Later on I noticed in the logs that city attack operations would frequently just not start whatsoever, even if the civ in question has a sizeable army through upgrading medieval units. If operations don't even start, they never get to the recruiting phase, nor to the building contracts, which is their prime way of building military units. So the operations not starting seemed like the key, but I couldn't find a solution. For the longest time I thought it was that they simply felt too weak to attack cities lategame, possibly because of the large walls. Eventually though it became obvious that no matter what tweaks I did to minoddsofsucces, to min troop requirements, to unit combat strengths; the issue wouldn't disappear. Civs would also miss possible attacks on incredibly weak backwards civs.
After lots of looking through logs, I noticed one civ in particular that had 2 'return civilian' operations running, which for some reason didn't end for hundreds of turns. During the entire time, not a single city attack operation was launched. The pattern showed up in more games, so I had a look if there was anything special about the return civilian operation, and there was, no opeartiontype was set. The same ended up being true for the city defense operation, which was also frequently present in lategame. Adding proper operationtypes to both of them basically instantly did the trick and civs became way more active late.


One other thing I have never seen the AI players make any carriers all game long, are the AI players able to use carriers and can the AI players be made to at least look into getting one or two carriers?

Count me in as never having seen them make use out of carriers the proper way. Sometimes they build them, but use them only as melee ships. Any support units in general are generally either never build or nor handled well. Sometimes a battering ram or one of those scout balloons is carried along, but I've yet to see a great general, admiral or medic being used. And I've watched a lot of games...
 
At Siesta Guru and Lion King, anyway you two can combined your mods as I run a game using both on a duel map, set to immortal, starting in the Renaissance era and the AI player was able to take my city within like 15 to 20 turns (I was not really trying to hold them off to much for this test run) that was much faster than I have ever seen from the AI players (as they usually dance their units around my city), they also had a few ships that also attacked. The problem is when I run both of your mods the game becomes really unstable and starts to crash randomly a lot, so yeah I am hoping you two could make a more stable mod.
 
And Siesta Guru, can you check your mod (AI+) to make sure the AI players are using Bombers, Jet Bombers, Fighters and Jet Fighters correctly (I see them building them but not using them for anything). Right now the default fall patch AI is using them (not that good but is using them).
 
I am sorry to keep asking for help but where in the “BehaviorTrees.xml” and “Operations.xml” files or just wherever files would I go to fix the AI players units getting stuck around a city and late game wars not getting launched by the AI players? I have really looked and just do not know what I need to change.
 
I am sorry to keep asking for help but where in the “BehaviorTrees.xml” and “Operations.xml” files or just wherever files would I go to fix the AI players units getting stuck around a city and late game wars not getting launched by the AI players? I have really looked and just do not know what I need to change.

I'm pretty sure Siesta is at a loss regarding this as well...
 
Operations not being launched took me much longer and was one of the last genuinely impactful changes I did. For a while I had noticed that in late game, civs would build very few units. Later on I noticed in the logs that city attack operations would frequently just not start whatsoever, even if the civ in question has a sizeable army through upgrading medieval units. If operations don't even start, they never get to the recruiting phase, nor to the building contracts, which is their prime way of building military units. So the operations not starting seemed like the key, but I couldn't find a solution. For the longest time I thought it was that they simply felt too weak to attack cities lategame, possibly because of the large walls. Eventually though it became obvious that no matter what tweaks I did to minoddsofsucces, to min troop requirements, to unit combat strengths; the issue wouldn't disappear. Civs would also miss possible attacks on incredibly weak backwards civs.
After lots of looking through logs, I noticed one civ in particular that had 2 'return civilian' operations running, which for some reason didn't end for hundreds of turns. During the entire time, not a single city attack operation was launched. The pattern showed up in more games, so I had a look if there was anything special about the return civilian operation, and there was, no opeartiontype was set. The same ended up being true for the city defense operation, which was also frequently present in lategame. Adding proper operationtypes to both of them basically instantly did the trick and civs became way more active late.

I wish I knew more about the "operationtypes" I just keep poking at it. Also, are there any self help guides for Civ 6 AI modding yet?
 
Back
Top Bottom