AI Question - Civics

Vrenir

King
Joined
Oct 11, 2006
Messages
894
Location
Maryland
How does the AI know when choosing a certain civic is a bad move on their part. For example, say an AI has Theocracy as their favorite civic, but they have multiple religions within their borders and they wouldn't really benefit much from blocking all but one. Or if an AI has Mercantilism as a favorite civic but has a nation dependant upon foreign trade. Is it smart enough to pass by and go for another choice, or will it just take the hit?

The reason I ask is that I am setting up a civic revamp and some of the things I've set up could be really neat, but if the AI isn't smart enough to choose good civics for their game, it could accidentally kill that nation's viability. Is there a way to tell the AI besides using something as structured as Flavored Civics? (I want some surprises from my opponents after all.)
 
The value of the civic is decided in CvPlayerAI::AI_civicValue.

For some reason it appears that favorite civic will only change the AIs value of the civic if it allows state religion or they don't have any religion in their cities. If it does/they don't it'll multiply the current value with 5/4 and then add 20. From a very quick look at the code I'd say favorite civic matters the most early in the game, assuming they can adopt it.
 
I think that I understand what you are saying, but let me verify. You are referring specifically to Religious civics, correct? And you are saying that whether or not their religious alleigance will fit into said civic option trumps Favorite Civic?

I guess that is the most important thing. I basically saw two areas of my mod that might cause trouble:

1) Theocracy and Fundamentalism, two civics (one governmental and one religious), give bonuses for cities with the state religion, but dock production and happiness in cities with other religions present. If the AI chose this while running a civilization with numerous religions present, it could kill their economy.

2) Like in the vanilla game, there are different cost levels for civics in my mod. If the AI chooses a civic with a high cost that ups something like distance from palace maintenance, I want to know that it is capable of recognizing that this is the cause of its economic woes and reverting to a lower-cost civic option.

The alternative is to tone down the penalties for choosing civics poorly so that it can't cripple anyone.
 
Well you could control the civic choose from the CvGameUtils.py file in the function cannotDoCivic. From here you would return true if they should not adopt the civic.
 
I was a little tired when I wrote that and I missunderstood the code (fortunently, because it made no sense).
The AI will only modify how much they value their favorite civic if it does not allow for state religion or they have religion present. So if the civic does allow for state religion and they have none present favorite civic won't change anything.

Distance maintence: This calculation is flawed (actually just looking at the AIs civic choices much appears flawed :() From the civic value modifier*(numcities-3)/8 is subtracted. Why flawed? Because it does not take into account the size of the world, the difficulty level etc... in other words, it doesn't check how much that extra maintenance IS! There is no relation to if the AI is in any kind of financial trouble. Not there nor anywhere else where a civic will change the cash flow.


The AI will understand negative nonstatereligionhappiness modifier. But ofcourse, it doesn't take into account if it actually need that happiness or not, it's just a flat multiplier. This modifier is slightly more important (multiplied by 5 vs 4) than if it gives happiness for state religion. I don't understand what you mean with dock production. I see no such modifier.
 
Having looked at the options again, I think that I am going to use Grave's Flavored Civics in order to steer the AI away from really dumb, and possibly lethal combinations. If a human player decides to try and cause a national depression, I don't really feel much pity for them. For instance, nobody in their right mind should think that becoming a Totalitarian Dictatorship using a Citizen Army and embracing Pacifism is a good idea. When they end up doubling their war weariness, I'm probably going to laugh if anything. If the AI thinks its a brilliant idea though, then I have a problem.
 
Top Bottom