AI Modding

Many of the values the AI uses when deciding what to do are available in globals.xnt; look below. To edit a value in globals.xnt, create a mod and place a new globals.xnt in it, all of its information in one globals tag. You don't need to copy every value in globals, only the ones you want to change. For example, a mod that just had 5 in its globals.xnt would do nothing but change constaithresholdexpert down to 5, which would make the ai launch attacks more frequently on expert difficulty. Some of the ai globals are inside aiconst goal types and will only apply to plans of a certain type so if you do              8 It'll increase how likely the AI is to target farms instead of other targets during raids but not affect how it behaves when trying to capture a new building or city.

Unfortunately a lot of the basic AI routines aren't very moddable right now. This includes decisions on managing its own empire (capturing resources, building upgrades, constructing camps/bridges, etc) as well as deciding what player targets to attack. This is partly because there's a ton of calculations going on that would be too slow if we ran them as scripts and also because we're continually adjusting the AI and we don't have the resources to be updating a modding interface at the same time.

When picking targets to attack the AI does do a value vs threat comparison but it also factors in a lot of other things like game difficulty, time since last attacks, faction hostility, resources of potential launching points for the attack, etc. While the AI technically knows the size and position of all of the players units, we specifically avoid factoring these into the scale of AI attacks so players aren't indirectly penalized for better defense.

All of that said, Longbow has been expanding the scripted portions of the AI significantly in Hegemony III. In 3.1 all diplomacy, AI vs AI conquests, and all city rebellions are determined by scripting that can be modded and many attacks such as those that occur after breaking/rejecting truces are triggered by scripts.