Modding AI flavors and Biases

Zen Blade

Warlord
Joined
Oct 31, 2008
Messages
247
Has anyone been able to successfully mod these various characteristics to actually affect AI gameplay in a large scale scenario/mod?


I am trying to get the AI players (in my mod) to act in a particular fashion. Specifically, I want them to be very interested in going to war (frequently), but also willing to have (reasonable) peace treaties once the war starts going poorly, followed by a willingness to go to war again.
And they need to be willing to start the wars (applying pressure to human players) within 50 turns of the mod starting... otherwise, the mod (much like Civ V in general) becomes boring.

My concerns extend to interactions with major civs and minor civs. Ideally, I would love to have a smart AI that realizes it should make friends with certain minor civs (perhaps to help fend off a major civ), while attacking other ones. I have tried a bunch of changes, but for the most part I am not pleased with the results.
Especially not with the hoarding of AI gold... they should spend it to build units, etc...

So, that being said, if anyone knows of a thread that discusses this in depth, please link to that thread.

Or, if you have personally made modifications that have resulted in significant changes to AI behavior, I would love to see/hear what you did.

Basically, I am looking for a tutorial in AI flavor/biases.

thanks guys,
Also, my Sengoku Jidai mod is looking good. This AI issue is the last main thing I want to resolve before releasing the first edition map/scenario/mod.

-Zen Blade
 
BUMP.

where is everyone? It seems like the modding forum has lost a lot of its posters.
 
BUMP.

where is everyone? It seems like the modding forum has lost a lot of its posters.

Not lost, just not found.... :lol:

Everyone's busy making their own mods and tools for mods and stuffs. I'm interested in this as well because once I've finished tweaking my mod, I'll be playing with my leader flavour values to try to get an accurate representation of my leader.
 
yes, I know how this works now to some extent. In fact, I should probably be making a tutorial on it soon, but I'm still working with A.I.

Okay here's how the (non-diplomacy) A.I. works (diplomacy A.I. is below):

-At the lowest level, there are unit and building flavors set for every A.I. Changing these values will change the likelihood of all A.I. building those things if it chooses that flavor value. The higher, the more likely. E.g. Say the warrior has a flavor_offense value of 10. That means, it has that relative value for being built if the A.I. wants an offensive flavor unit. Presumably, if you gave a unit all flavors and set them to 100000 it would only build that unit if it can build that unit. Same goes with buildings. (note that there are some rare flavors, like flavor science and flavor happiness, so you may not have them all when you think you do.)

-Above that level, are strategies, mostly found in AIEconomic strategies and AI grand strategies (and techincally above that are grand strategies, though they work the same). These further mold what flavors the A.I. chooses. For instance, the early_expansion flavor makes the A.I. more likely to choose flavor_expansion. An A.I. has more than one strategy running at the same time, so even if an A.I. has 100% chance to choose early expansion, it will only increase the chance of settlers, and not make them always build settlers. The likelihood of a strategy being chosen is based on some hardcoded things, some turn checking, AND their weight threshold. A higher threshold makes it less likely to occur (a negative one makes it always occur if the hard coded is choosing to look at the weight threshold). Exactly how the weight threshold works, I think, is it tallies up all the values for flavors found at the bottom page, and if that A.I. has enough flavors that it goes above the wiehg thtreshold, that strategy will be adopted when the turn check comes. Grand strategies are picked at the start of the game and last the whole game. Their chance of being chosen is affected ONLY by the ratio their four values for culture,space, etc. E.g. change the wieghts for culture, diplomacy, and science to 0, and they will only be conquest oriented.

-A.I. diplomacy, found in globalAIDefines.

Most of these are vaues that increase or decrease an A.I.s opinion of you. A positive number (lol most of them) makes them hate you more. A negative number makes them like you more. MOST of these are related to leader values.

Example: OPINION_WEIGHT_WARMONGER_MINOR at 15 means it will hate you a little if that leader has a high warmonger hate value and you onyl warmongered a little. Note: OPINION_WEIGHT_WARMONGER_CRITICAL is so high, 100!, even low warmonger leaders will hate you if outright kill several civs. Actually, it really needs to be higher.

Example: OPINION_WEIGHT_WONDER_FIERCE at 20 means ( I think) if it has a high wonder competitiveness and you build a wonder, it will hate you a lot. Changing all those weight_wonders to 0 will mean the A.I., more specifically egypt *rolls eyes*, doesn't care if you build wonders.

Some of these make no sense mind you, and really need to be changed. For instance, the mere ACT of asking you to settle somewhere else, whether you do or not, causes the A.I. to hate you.I have no idea as to the exact relation between approach (whether the A.I. kills your or not it seems), and opinion, I can only assume if it hates you it's more likely to have a bad approach. Edit: Actually it's probably the same relationship of weight thresholds and flavors.

Now, the A.I. for specific leaders is not in A.I., but in leaders. As far as minor civ approach biases go, it is again a ratio of the values there. E.g, set friendly to 10, and conquest/ignore to 0, and they should always try to ally with them. I currently have no idea how make them spend vast amounts of gold on city state.

-tactics

I'm really confused as to what exactly the tactics does. One thing I know is that higher priority things are more likely to be chosen, and only one thing is chosen on a given turn for a given unit. E.g. set pillage to 1000 and the A.I. will wander around your territory ignoring your troops trying to pillage stuff. So if you, like me, want to lower the chance of an A.I. falling for the worker bait trap, set the TACTICAL_CIVILIAN_ATTACK values lower.
 
Slowpoke,

Thanks for the information. I made some changes based on what you wrote, but I am doubtful that it had any affect on the AI's DOW.

Below is the information for one of the leaders.

Spoiler :
<Leaders>
<Row>
<Type>LEADER_UESUGI_KENSHIN</Type>
<Description>TXT_KEY_LEADER_UESUGI_KENSHIN</Description>
<Civilopedia>TXT_KEY_LEADER_UESUGI_KENSHIN_PEDIA</Civilopedia>
<CivilopediaTag>TXT_KEY_CIVILOPEDIA_LEADERS_UESUGI</CivilopediaTag>
<ArtDefineTag>Alexander_Scene.xml</ArtDefineTag>
<VictoryCompetitiveness>8</VictoryCompetitiveness>
<WonderCompetitiveness>5</WonderCompetitiveness>
<MinorCivCompetitiveness>5</MinorCivCompetitiveness>
<Boldness>8</Boldness>
<DiploBalance>4</DiploBalance>
<WarmongerHate>2</WarmongerHate>
<WorkAgainstWillingness>8</WorkAgainstWillingness>
<WorkWithWillingness>4</WorkWithWillingness>
<PortraitIndex>9</PortraitIndex>
<IconAtlas>LEADER_ATLAS</IconAtlas>
</Row>
</Leaders>
<Leader_MajorCivApproachBiases>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<MajorCivApproachType>MAJOR_CIV_APPROACH_WAR</MajorCivApproachType>
<Bias>9</Bias>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<MajorCivApproachType>MAJOR_CIV_APPROACH_HOSTILE</MajorCivApproachType>
<Bias>8</Bias>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<MajorCivApproachType>MAJOR_CIV_APPROACH_DECEPTIVE</MajorCivApproachType>
<Bias>4</Bias>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<MajorCivApproachType>MAJOR_CIV_APPROACH_GUARDED</MajorCivApproachType>
<Bias>5</Bias>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<MajorCivApproachType>MAJOR_CIV_APPROACH_AFRAID</MajorCivApproachType>
<Bias>3</Bias>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<MajorCivApproachType>MAJOR_CIV_APPROACH_FRIENDLY</MajorCivApproachType>
<Bias>5</Bias>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<MajorCivApproachType>MAJOR_CIV_APPROACH_NEUTRAL</MajorCivApproachType>
<Bias>4</Bias>
</Row>
</Leader_MajorCivApproachBiases>
<Leader_MinorCivApproachBiases>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<MinorCivApproachType>MINOR_CIV_APPROACH_IGNORE</MinorCivApproachType>
<Bias>4</Bias>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<MinorCivApproachType>MINOR_CIV_APPROACH_FRIENDLY</MinorCivApproachType>
<Bias>5</Bias>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<MinorCivApproachType>MINOR_CIV_APPROACH_PROTECTIVE</MinorCivApproachType>
<Bias>3</Bias>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<MinorCivApproachType>MINOR_CIV_APPROACH_CONQUEST</MinorCivApproachType>
<Bias>9</Bias>
</Row>
</Leader_MinorCivApproachBiases>
<Leader_Flavors>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_OFFENSE</FlavorType>
<Flavor>8</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_DEFENSE</FlavorType>
<Flavor>5</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_CITY_DEFENSE</FlavorType>
<Flavor>5</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_MILITARY_TRAINING</FlavorType>
<Flavor>5</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_RECON</FlavorType>
<Flavor>5</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_RANGED</FlavorType>
<Flavor>3</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_MOBILE</FlavorType>
<Flavor>8</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_NAVAL</FlavorType>
<Flavor>5</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_NAVAL_RECON</FlavorType>
<Flavor>5</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_NAVAL_GROWTH</FlavorType>
<Flavor>6</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_NAVAL_TILE_IMPROVEMENT</FlavorType>
<Flavor>6</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_AIR</FlavorType>
<Flavor>3</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>8</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_GROWTH</FlavorType>
<Flavor>4</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_TILE_IMPROVEMENT</FlavorType>
<Flavor>4</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_INFRASTRUCTURE</FlavorType>
<Flavor>4</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_PRODUCTION</FlavorType>
<Flavor>5</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_GOLD</FlavorType>
<Flavor>3</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_SCIENCE</FlavorType>
<Flavor>6</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_CULTURE</FlavorType>
<Flavor>7</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_HAPPINESS</FlavorType>
<Flavor>5</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_GREAT_PEOPLE</FlavorType>
<Flavor>6</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_WONDER</FlavorType>
<Flavor>7</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_RELIGION</FlavorType>
<Flavor>5</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_DIPLOMACY</FlavorType>
<Flavor>7</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_SPACESHIP</FlavorType>
<Flavor>8</Flavor>
</Row>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<FlavorType>FLAVOR_WATER_CONNECTION</FlavorType>
<Flavor>6</Flavor>
</Row>
</Leader_Flavors>
<Leader_Traits>
<Row>
<LeaderType>LEADER_UESUGI_KENSHIN</LeaderType>
<TraitType>TRAIT_CITY_STATE_FRIENDSHIP</TraitType>
</Row>
</Leader_Traits>


Specifically, how does "competitiveness" affect relations... and where can I see that code.

<Boldness>8</Boldness>
<DiploBalance>4</DiploBalance>
<WarmongerHate>2</WarmongerHate>
<WorkAgainstWillingness>8</WorkAgainstWillingness>
<WorkWithWillingness>4</WorkWithWillingness>

What do these each do/how do they interact with other code?
Does "DiploBalance" mean balancing the various Civs, depending on their power?
Boldness?

When a leader has a high "civ approach war" number, how does that interact with other information to determine DOW.
Currently, it does not seem like the various leaders want to declare war, not often enough considering how many Civs are in the game.
Is there some "judgment" that the Civ AI makes based upon strength/army?? Or what is the signal/threshold?
I don't mind if the AI makes foolish DOW's, that is on par for the time period. Although I hope the new AI patch has better AI tactics for combat...

I realize I just asked a bunch of things, but any information you might have would be great.

thanks again,

-Zen Blade
 
Ok,

So, I have been looking over the GlobalDiplomacyAIDefines...
very confusing...
I have no clue what "approach" signifies, as well as a number of other terms.

However, this:

</Row>
<Row Name="EVALUATE_WAR_SOFT_TARGET">
<Value>100</Value>
</Row>
<Row Name="EVALUATE_WAR_FAVORABLE_TARGET">
<Value>50</Value>
</Row>
<Row Name="EVALUATE_WAR_AVERAGE_TARGET">
<Value>-25</Value>
</Row>
<Row Name="EVALUATE_WAR_BAD_TARGET">
<Value>-100</Value>
</Row>
<Row Name="EVALUATE_WAR_IMPOSSIBLE_TARGET">
<Value>-200</Value>
</Row>


Makes me think that changing these values will alter the rate of DOW (declaration of war) in the game. Anyone know anything else about the various strings within this file?
I would love to get the computer AIs to actually spend money to win the favor of minor civs...

-Zen Blade
 
Yeah changing these values is one way to do it. But really anything will do it, like I said earlier, just make every positive value higher.

In this particular case, this would probably be bad, though. The player typically has less units than the A.I., so increasing these values would make them all declare war on YOU.
 
slowpoke...

this is of some help, but I still feel like I am missing the bigger picture with regards to how all of the pieces fit together.

Also, have you messed around at all with the unit AIs??
I removed "instaheal" promotion from being selectable... as a result, the enemy units will often commit suicide... they continually attack a fortified defensive unit... until they lose all of their hp...

I think instaheal partially hides the stupidity of the AI (by allowing the stupid units to live longer) when it comes to combat. Any ideas with regard to making the AI smarter in combat (as well as the diplomatic issues we have discussed)?

-Zen Blade
 
As far as smarter tactics... honestly I'm just waiting till the patch. Some things, like formations, I don't think anyone will have control over.

The main problem I think is they send units one at a time after the primary assault. I'm not on a computer with access to the xmls, but look at the AI military strategies. There's probably a way to make them realise they've lost earlier, and then to set their city reserve units higher in such a case.
 
Back
Top Bottom