Are you still working on improvements?
Not really these days. Without more access to new tools, there's not much that can be improved on still. I've also stopped playing civ, so don't really see the small tweaks that may still be improvements unless they're mentioned here.
@Siesta Guru Would you be so kind and post a small guide on how to modify AI behavior? But not dry explanation of behavior node types or how tables are structured, but rather 2-3 practical examples. Let's say we want AI to do this and this, then this is how you do it. Etc.
Hmm, well I'd say the best guide is probably in the AI+ files itself. Essentially though, the modding process here comes much more from the other side. Instead of starting with 'I want the ai to do x, let's find a way', you're generally looking more for 'what do these files allow me to do, and would any changes make the ai better'. The reason of course is that there's almost no 'clever' behavior that can be created through the tools here. And if I were you, I'd start by looking at those tools. Otherwise you'll get stuck very quickly, like wanting to make archers fire over skipping their turn, and then finding out that there's nothing with which individual unit behavior can be altered.
There's essentially two main areas in which you can meaningfully change things. Building preferences, and military operations.
For building preferences, here you'll probably want to start, we have the useful <PseudoYields> and <AiFavoredItems>. Changing pseudoyields allows you to alter large overall preferences for certain categories. For xample if you want to increase the desire of all AI players, regardless of circumstances to build military units, then you'd look at the current value in the base file yields.xml. PSEUDOYIELD_UNIT_COMBAT is 1.0, so we can increase it to say 1.5:
<Update>
<Set DefaultValue="1.5"></Set>
<Where PseudoYieldType="PSEUDOYIELD_UNIT_COMBAT"></Where>
</Update>
Alright great, they build more units now. Set it to 40 for some fun.
AiFavoredItems is a little more intelligent, and it allows you to alter multiple things. You start with creating an AiLists (andan AiListTypes). This list has a type (such as yields, which does a similar thing to pseudoyields, or buildings, which allows you to force the ai to make certain buildings), and it has some activation criteria. The activation criteria are found in other tables. When a list is activated, all of the AiFavoredItems which are attached to it start functioning. There's essentially two ways of activating a list, either you attach it to a trait, or to a strategy. Trait based lists are activated throughout the entire game, and can be attached to specific civs, all civs, all city states, etc.
Let's start with a trait based one. Say, if you want to force all civs, to build an industrial district whenever they can.
You start with defining a list:
<AiListTypes>
<Row ListType="DistrictForcer"/>
</AiListTypes>
Then you tell it what type/system of list it is, and to what trait it is attached, in this case, we want to deal with districts, and have it be attached to all civs.
<AiLists>
<Row ListType="DistrictForcer" LeaderType="TRAIT_LEADER_MAJOR_CIV" System="Districts"/>
</AiLists>
Then, we put an AiFavoredItems into the list, with the change we actually want:
<AiFavoredItems>
<Row ListType="DistrictForcer" Item="DISTRICT_INDUSTRIAL_ZONE" Favored="true"/>
</AiFavoredItems>
Now you'll see them all start building industrial districts.
Some of the favoreditems systems allow a Favored="true", which forces production. Sometimes a Favored="false" makes them avoid the object, sometimes if you set it to false, they just won't care about it in some special way. Others, allow finer control using values. The Yields system is one of those, which allows you to change a desire for science etc, for example, if we want cleopatra to build more science buildings:
<AiListTypes>
<Row ListType="sciencelover"/>
</AiListTypes>
<AiLists>
<Row ListType="sciencelover" LeaderType="TRAIT_LEADER_MEDITERRANEAN" System="Yields"/>
</AiLists>
<AiFavoredItems>
<Row ListType="sciencelover" Item="YIELD_SCIENCE" Value="10"/>
</AiFavoredItems>
You should now see cleo prioritize science higher. You're going to have to play with these types of values and do tests till you figure out how powerful they are and how much they impact things. Ill warn you, this is a very painful process when a simple test run takes 3 hours and you're never entirely sure whether a perceived change is the placebo effect or not. In fact, I'm still not sure myself on the yields system.
So, I mentioned strategies. Which is a more interesting thing to work with. Ailists can be attached to a couple of conditions (see victories.xml). One useful condition that is available is the amount of wars that a civ has going on. You can test whether a civ is at peace, and attach an ailist to it if it is. Let's say that we want the ai to build more wonders if it's at peace.
Create a strategy
<Strategies>
<Row StrategyType="STRATEGY_PEACETIME" NumConditionsNeeded="1" />
</Strategies>
Set the conditions at which this strategy will activate.
<StrategyConditions>
<Row StrategyType="STRATEGY_PEACETIME" ConditionFunction="Major Civ Wars" ThresholdValue="0" />
</StrategyConditions>
Create a list, with our increased wonder desire:
<AiListTypes>
<Row ListType="buildwonders"/>
</AiListTypes>
Note here that that this list shouldn't have the trait variable set:
<AiLists>
<Row ListType="buildwonders" System="PseudoYields"/>
</AiLists>
Psueodyields in favored items actually start affecting behavior somewhere around the 100-200 mark, whereas 1000 is nearly forcing them to always get something of this type. See the ai logs on building choices to get a bit of a grip on how high you want these values to be (it keeps picking the highest rated item)
<AiFavoredItems>
<Row ListType="buildwonders" Item="PSEUDOYIELD_WONDER" Value="200"/>
</AiFavoredItems>
Last step, attach the list to the strategy
<Strategy_Priorities>
<Row StrategyType="STRATEGY_PEACETIME" ListType="buildwonders"/>
</Strategy_Priorities>
Some of the strategy conditions can be a bit confusing. It's worth checking the logs to see whether your conditions are activating as expected. In the case of this war based one in particular, if you set the threshold value to 0, the strategy will activate if the civ is not at war, if it's set to 1, it will activate if the civ is in 1 or less wars. But strangely, there's no way to set it so your strategy only activates if the civ is at war.
A typical trick I use, is that if you want to increase some desire while a civ is at war by x, to raise the base desire by x, and the set the peace desire to -x.
So that about sums it up for building preferences. I'd encourage you to just look through the AI+ and base game files to find out what your options here are. Which strategies you can use, what things you can change, etc.
On (military) operations. Well, there's not as much of an easy way to describe this I'm afraid.. The process of changing this is much less organized.
Essentially you have a couple of tools to change this behavior. Inside of operations.xml you'll see most of the tools here. It allows you to have some control over the amount and type of troops send into war or as settle operations, and how quickly they are send. It for example allows you to set the ai to be much more/less warlike, by setting a different MinOddsOfSuccess on the AiOperationDefs for city attacks.
I'd encourage you to just look at the files (both operations.xml and my changes in military.xml) and play with the variables and prepare mentally for the fact that there's no smart ways of controlling which operations activate when, so that you also can't do things such as changing the required troop counts dynamically over time.
Oh right, it's important to keep in mind here too that these operations largely control the troops that civs will build. If there is no operation that requires them to build a siege unit, they will never build siege units.
A lot of my changes here are essentially 'dumbing' things down so they work better. For example by having less units dedicated to defense operations, since it would often mean that it wasnt actively using half of its army.
Besides this, you also have some control through behaviortrees. Changing these is a tedious process with lots of crashes in your future. They also miss a lot of conditionals and actions that you'd want/expect, so even if you try to really get into changing these, you'll probably discover you can't actually do that much better than what's already there. The main things I managed to improve through these, was that I just took something out that would often cause them to retreat needlessly (a recruit units tag), and I fixed some bugs where units would get stuck. For example originally, it required that all units get within 2 range of their target before moving on to the next step, which would sometimes never happen if their army was too big, they had stragglers, or the terrain doesn't allow it.
There should be a guide on behaviortrees out there somewhere by delnar
Lastly, you have some more minor tools lying about. You can do some diplomatic changes (see diplomaticactions.xml) that allow you to change how likely civs are to initiate some diplomatic actions. There's a few modifiers that can be changed, mostly to affect how friendly ais are to you (like agendas). This is the one area I feel I might've underutilized
Then lastly there's a few variables in globalparameters that deal with ai things.
I hope that helps! If there's anything specific you want to know more about you can always ask (although Im not very active here anymore). After months of testing there's quite a few quirks I found that aren't immediately obvious so I could probably help speed you up. But I'd first encourage you to just play with some things yourself and to rip whatever you want from the ai+ files. Good luck!