making the ai more aggressive???

Here's something I wrote in the past that might help you. It has to do with some of the Leaderhead XML file tags and what they do in reltation to declaring war and peace.


---


Here's what I was able to dig up. Some of it is pretty general, because the code is sometimes tough to read. So, I've given what I think is the best idea of what they do.

iBaseAttitude:
Base diplomacy attitude (+/- value) toward another civ at any time.

iBasePeaceWeight:
Base weight that this civ values peace. Only affects the civ's attitude towards other AI's.

iPeaceWeightRand:
A random number from 0 to this number is added to their peace weight at the beginning of the game.

iWarmongerRespect:
The smaller of two AI civ's iWarmongerRespect value is added to each of the civ's attitude. So, a civ of -1 and a civ of 5 means that each civ will have a -1 towards each other.

iRefuseToTalkWarThreshold:
If the number of turns the AI is at war is less than this value, the AI will refuse to talk to another civ.
This value is doubled if the AI team was the one who declared war.

iMaxWarRand:
The chance that a civ might try to begin planning a war this turn. Every turn, the civ has a 1 in X chance of considering planning. The lower the number, the more likely they will consider to begin planning. If it does consider it, it will find the target it hates the most and start planning war on them. There is a chance that the AI will consider to begin planning but not find a valid target they actually want to attack. In this case, they will not start planning against anyone.

Once a civ does begins planning, I think it will declare war once it's planning is done. Five turns elapse after planning begins before the civ will declare a limited war (small skirmishes, etc.). Ten turns elapse after planning begins before the civ will declare a total war (much larger force used, puts more resources into the war).


iMaxWarNearbyPowerRatio:
The percentage of their total power a civ will use when determining if it's stronger than another country that is "nearby" (which I believe means they share the same continent). This only is used when determining if the AI will start a total war. Thus, a value of 200 means the AI will consider itself twice as strong than it really is when determine it's strength vs. another civ. An AI civ only declares war with another civ if it thinks it's stronger.

iMaxWarDistantPowerRatio:
Same as iMaxWarNearbyPowerRatio, but this applies to civ's that are not nearby (are not on the same continent).

iMaxWarMinAdjacentLandPercent:
Of the three "passes" used in checking if a total war will start to be planned, this is the first (after this comes checking if it's a nearby civ using the iMaxWarNearbyPowerRatio calculations, then if it's a far civ using the iMaxWarDistantPowerRatio calculations). This is a percent value. If the percent of an AI civ's total plots that are adjacent with another civ is greater than this value, then the AI civ will consider the other civ for a total war.

iLimitedWarRand:
This is like iMaxWarRand, but is for limited wars. Limited wars, being less risky, have a better shot of being started, so this number will for Civ4 be smaller than iMaxWarRand (since a smaller number means a better chance.

iLimitedWarPowerRatio:
Like iMaxWar____PowerRatio, this will give a percentage bonus to what the AI thinks of it's power when it's trying to determine if it's stronger than another. It doesn't seem as if an AI will declare a limited war against an enemy that isn't considered "nearby", so there only is one value for this.

iDogpileWarRand:
There's limited war, total war, and dogpile war. This works just like iLimitedWarRand and iTotalWarRand, except it will make the civ consider starting to plan a dogpile war. This means that the AI will attempt to start a war with a team whose power is low compared the AI civ's power AND to the power of teams that are currently at war with the possible target.

iMakePeaceRand:
The chances a civ will consider making peace with one of it's enemies. Every turn, the civ has a 1 in X random shot of deciding to try to make peace, where X is iMakePeaceRand. It will go through each team it's at war with and decide whether they want to try to declare peace. If they decide that they do, they go through the steps of declaring peace.

How they determine if they want peace.

1.) They have to be able to contact the enemy civ.
2.) AI_isChosenWar is true. This is true only if the AI's war plan against the team is not WARPLAN_ATTACKED or WARPLAN_RECENTLY_ATTACK. These are what a war plan against an enemy civ start as if the enemy civ was the one who declared war. After awhile, a war that a civ is in that is of the war plan WARPLAN_ATTACKED will eventually (after some turns) become one of the other war plans, which will allow this criterion to be met.
3.) The war counter is past 20. One point is added to the war counter every turn. I'm assuming that other factors add to the war counter as well.

If any one of the following is true, than they will try to make peace:
4a.) The war counter is over 50.
4b.) The war counter is over 30 (40 for a total war) and
The end war value for this team is between half of the end war value for the other team and double the end war value for the other team.
4c.) The war is a dogpile war and this civ is the only civ left at war with the enemy (the enemy is no longer being "dogpiled."

The end war value is a value that takes multiple factors in to come up with a number that represents how good of an idea it is to end a war against a specific team. The higher the number, the better the proposal of peace is. So, for 4b, if a team's end war value is too low, it doesn't gain as much as the other team from peace. However, I'm not sure why they would want to declare peace if their value is more than twice the others. My only thought is that if the other civ's end war value is really low, then in the process of making peace they can ask for some good stuff.


iDeclareWarTradeRand:
This seems to only have an affect on how an AI negotiates with other AI civs. It is the chance that an AI will try to make a trade with another AI to declare war on one of it's enemies. Every turn, for each AI player that the AI civ can talk with, it has a one in X chance of trying to make a trade for war with that player against one of the teams the ai civ is at war with.

iDemandRebukedSneakProb:
Every time an AI civ has one of it's demands rejected, there is a percentage chance that the AI will start planning a limited war against the rejecter. This is a percentage chance, so 100 means that the civ will always start planning after not reciving a demand.

iDemandRebukedWarProb:
This is the probability that a Civ will immediately declare war immediately after one of their demands are rejected. That would be unlike the last tag, but instead of being sneaky and start planning, then launch a war later, the civ instead declares war immediately.

iRazeCityProb:
The probability (percent) that the AI civ will raze a city upon conquering it, if they don't deam it keepable by many other factors.

iBuildUnitProb:
The probability (percent) that the AI will build a unit at a city.

The actual total probability is this number plus twice the amount of production experience a unit recieves at that city.

This total is then halfed if the Civ is considered to be having financial troubles.

This whole process is one in a few for determining if a city will make a unit. Here is the full list of criteria (if one of these is true, then the city will be set to build a unit):

1.) The civ is in a land war.
2.) The civ has less than 4 cities and the game has not progressed 60 turns yet.
3.) The unit probability test above passes.
3.) The civ is human and it is the first turn (I'm not sure why that code is there).


iBaseAttackOddsChange:
iAttackOddsChangeRand:

Every turn, the AI will set a variable that is their "attack odds change". This varaible is used to add or subtract from attack odds of a battle. I don't think this changes the actual odds of the battle per se, but instead will change what the AI THINK that the battle odds are, so that they are more or less willing to do attacks every turn.

The attack odds changed is calculated by adding the iBaesAttackOddsChange to the sum of TWO random numbers from 0 to the iAttackOddsChangeRand. I doubt you can make iAttackOddsChangeRand negative.
 
wow this is intense...


i thank you for taking the timme for helping me :)

so, you say that if i set some parameters right, i cancreate a deadly leaderhead?...?

if i play at a higher level, prince-deity, does it affect the ai play?

and another thing i noticed - the ai on cotum game is set on noble,
if i change it (through global defines) to deity - does this mean that the ai will be harder - or it will mean the opposite - the ai will be easy causeit will be more handicaped?
so if i put my self on deity,
and the a.i on chieftan, does it mean the a.i will have suppirior power on me?

i hope you can help answer my quastions. thanks :)
 
keldath said:
wow this is intense...


i thank you for taking the timme for helping me :)

so, you say that if i set some parameters right, i cancreate a deadly leaderhead?...?

if i play at a higher level, prince-deity, does it affect the ai play?

and another thing i noticed - the ai on cotum game is set on noble,
if i change it (through global defines) to deity - does this mean that the ai will be harder - or it will mean the opposite - the ai will be easy causeit will be more handicaped?
so if i put my self on deity,
and the a.i on chieftan, does it mean the a.i will have suppirior power on me?

i hope you can help answer my quastions. thanks :)

Well, if you set the parameters right, you can make the more aggressive. That doesn't mean, though, that they'll actually be smarter and, as a result, more hard. In terms of moving and picking units to create, deciding on which plots to attack, what to build and when, etc., to make the AI "better" you'd have to learn your way around the SDK.

I'm not too sure about your second question, but I would guess if you put yourself on Diety, you make it harder for yourself, so if you put an AI on diety, you're also making it harder for the AI. I don't think it's so much a "difficulty level" for single player as much as a "Handicap" for the player it's set for.
 
mmm i see....

lets say, that i take the barbarian leaderhead defines - on te file leaderheadinfo,

and use the same parameters (only those you mentioned above)
and use them on another "regular leader",
do you think the leader will be aggressive? will he try to attack alot?

i made some comparisons, and from my understanding, the lower the parameter is - the higher the chanse the leader will be more aggressive,
except the unitbuildprecent

also i looked at the globaldefines - there i can change the handicap for the starting a.i,
and there is a set for barberians,
and its set on cheiften.....so maybe my theory is right?

what do you think?
 
keldath said:
mmm i see....

lets say, that i take the barbarian leaderhead defines - on te file leaderheadinfo,

and use the same parameters (only those you mentioned above)
and use them on another "regular leader",
do you think the leader will be aggressive? will he try to attack alot?

i made some comparisons, and from my understanding, the lower the parameter is - the higher the chanse the leader will be more aggressive,
except the unitbuildprecent

also i looked at the globaldefines - there i can change the handicap for the starting a.i,
and there is a set for barberians,
and its set on cheiften.....so maybe my theory is right?

what do you think?

In most cases, you're right, the lower the number the more "aggressive" (once again remembering aggressive doesn't mean they play "better"). I think putting the AI on Chieftain will make them harder, but I've never tried, so I can't say for sure.
 
Back
Top Bottom