Is there any logic to an AI DoW?

I haven't read all the posts here, so I don't know how much it's relevant with the discussion, or if it's already been said. Just for information.

I've read somewhere that the iDemandRebukedWarProb leader attribute isn't used at all by the game. I've discovered that it's actually called by the Python (CvDiplomacy), not by the SDK. I've tested it right yesterday and it worked. I'm using BTS 3.19.
 
I didn't want to start a new thread on a related question, but in a game I was playing, Ragnar goes into WHEOOHRN mode and marches his troops across Churchill's territory in my direction. The turn before I expect him to DOW me, I switch out of free religion into his religion and change to HR as well and sell him a tech to get him to pleased. I then then bribe him for 10 turns of peace. The next turn he DOWs Churchill whom he is pleased with. Can someone make sense of this for me? Did he just say, I've got all these troops here I might as well fight someone. I went back and replayed without begging him for 10 turns of peace and sure enough he DOWs me.

Below is an image just to explain where everyone is in relation to each other (Ragnar is on Churchill's eastern border):
Spoiler :

 
I'm also going to call this information into question as I'm uncertain if 3.19 left it unchanged. I've had some surprise DoWs involving some interesting situations:

1. Shaka marches through cautious civs to declare on me. No demands refused, his power is #1 so all are valid war targets. What happened to the DoW priority of nearby civs first?

2. Toku declares on me @ cautious when I'm a lonely heart. He had other valid war targets with which he was annoyed. No demands refused. Why was I targeted?

3. I get declared on by a cautious inca despite not sharing any borders at all with it. He was cautious with civs that bordered him.

These things suggest the information in this thread is inaccurate, at least for the *current* patch, as does the above post.
 
for me ,it is not the DOW of someone that bothers me,,but the civs that he bribe to against me...
in my recent immortal game(first actually) in 1700s,peter turned to cautious from pleased in WHEEHORN...
i never refused any demand from him,we didn't share borders,i had a decent power rating,he had other civ to worry about who had DOW on him in past......
but no,he DOW on me ,bribed 2 other civ in war..
totally ridiculous:mad::mad::mad::mad:
he did nothing himself ,but other 2 civ broke me..i was so close to space...:mad:
maybe 'running away with it' is also a factor in ai DOW..
 
Ok it appears I was wrong about Mahatma--he can never be a Dagger/doDaggerStrategy (btw what is really meant by that?), no matter where Delhi is located on the map.
He just lacks the necessary features (high MaxWarRand, high flavor values for military, Attack UU) and often does MissionaryStrategy which excludes Dagger.

I've taken a closer look at AI_doWar and most of the relevant functions that are called there and tried to put the main checks and criteria for the AI's war planning into comprehensible(?) words (MSExcel). Some of them differ quite a lot from the descriptions in Niklas' post. For simplicity I've neglected the concept of several players forming one team (so 1 player = 1 team, note: Vassals do not join the Master's team, they will still be two separate teams with 1 player each).
The AI's current strategy and financial situation is pretty important for the likelihood of DoWs. Especially the fact that the AI will not even start thinking about any wars when it is following the GetBetterUnitsStrategy might be responsible for the much earlier DoWs on Deity compared to the lower difficulties. The AI needs to be able to build at least 2 offensive units (UNITAIs ATTACK_CITY, COUNTER, RESERVE and PILLAGE) in its capital. Units of the types Axeman, Spearman, Chariot qualify here (basically everything better than Warriors and Archers), so once it manages to hook up the necessary strategic resources it will drop that strategy and start rolling the dice. With the 2 starting settlers and discounts for training more plus the fast teching I think Deities will reach that point 1000 yrs earlier.

The other interesting factors are how Vassals and the financial situation affect the probabilities for wars. I don't really know what to think of the HUSP-factor (HighUnitSpendingPercentage). For boxed in unit spammers this should be huge (compact empire = low total expenses). E.g. checking the 990AD save of Sisiutil's ALC24 shows Mehmed with USP = 12:gold:/57:gold: = 24% (HUSP = (USP-7)/3 = 5) and 2-city-Pacal with 2:gold:/4:gold: = 50% (HUSP = 14) (note: foreign trade is not taken into account!). So they should consider a total war 6 / 15 times as often, but Pacal's power is probably much to low to actually find a valid victim.
It's also interesting how the raiders don't care about the attitude that much (NWR+10), so Boudica will declare at pleased if she is in financial trouble! (Edit: no she won't due to the capping at 99 and her NoWarProb=100)





The take home message (see also Niklas): Power doesn't mean anything to prevent a DoW unless you are over the relevant threshold! Attitude is much more important. If you are a Lonely Heart your are completely safe from Dogpiles and only have to fear LimitedWars from other Lonely Hearts. Have rather short borders. Don't be too close to yourself.

There is a (minor) BUG in AI_doWar as it checks bFinancesProMaxWar for limited raids instead of bFinancesProLimitedWar. There is a MAJOR (well known) BUG in CvPlayerAI::AI_playerCloseness, where the code determines the closeness of the victim to itself instead of the war planning AI's closeness to the victim, so that compact empires with many large cities make the juciest targets (AI_startWarVal). But it also affects the AI's strategy in the beginning of the game (AI_getStrategyHash). After making the first contact with a neighbor the AI will experience a sudden increase of paranoia due to the super (self-)close neighbor and drop Strategy_Peace and might directly jump to Strategy_Dagger. Daggers don't care about their money when it comes to starting a war... They also skip the whole war preparing thing (which others might drop again, see Saladin in ALC24).
The BetterAI guys have created a fix but AFAIK there is no guarantee yet, that the correct version doesn't bring up other unwanted side effects. (There are so many hard coded "x += (condition)? y : z"s and "q *= iNonsense"s in CIV's code that you just never really know what's gonna come out after killing a silly bug!)

To conveniently check and sort the several Leaders according to their WarRands and NoWarProbs or PowerRatios I've put their XML-values into an additional xls spreadsheet coarsely sorted by category. Columns are grouped and expandable, there is a "Game" column where you can put numbers in to filter everything for a current game. Leaders have their BTS-Colors.



I hope I didn't make too many mistakes here, after all this whole war thing is a pretty complex mess.


Edit: some minor corrections:
A) 4. AI is in financial trouble when (Inflated Costs + foreign trade dificit) > 60% of (beakers per turn + taxes income + foreign trade surplus), threshold increases by additional +8% when aiming for cultural victory, +12% when at war or preparing one, +10% when researching Future Techs

D)11. the +10 for NWR also applies for Daggers when AggAI is off (beware of Daggers in financial trouble--not only will they not oppose wars when broke, they will also care less about friends)

E) 2. MaxPlotDist is 72 for Standard Maps (with cylindrical world wrap)​

GAME OVER, we have new mechanics now, or this is wrong.......................................................

View attachment AutoSave_BC-0175.CivBeyondSwordSave

View attachment Paradiso Immortale - Pericles BC-0075.CivBeyondSwordSave

1. Izzy's cap is closer
2. He hates izzy more (annoyed)
3. AFAIK shaka has plenty of power to hit either of us
4. Neither of us border him. We couldn't even be called on pass 1 supposedly.

Anybody care to tell me how I was the priority target to an AI who had a different worst enemy with a closer capitol? I rely on this information, but I can't see any way that it can be right anymore, based on the results shown in the above game. He has a x2 multiplier on her and she's closer...

And if the code is changed, how so? I HATE losing games where my impression of the mechanics is one thing and reality is another, even more so when the game misleads me (not the case here, the game doesn't let us know how it works without extensive work looking at the code, and here apparently fireaxis might have swapped it on us for the worse again).

I can see why a lot of players feel like the AI targets them specifically over other AIs.
 
Is a forced 10 turns peace with other possible targets out of questions? You know, due to trading, tributes etc.
 
@TMIT,

Converted my SDK to 3.19. From what i see in code nothing big has been changed. So i took a look at your example. You're correct that both Izzy and you are being considered in the last circle (pass =2). So in your game.....

Data (rounded):

Shaka power: 147
Izzy power: 111
TMIT power 56

AI_maxWarNearbyPowerRatio(Shaka) = 90
AI_maxWarDistantPowerRatio(Shaka) = 50

For the power calculation we first multiply Shaka's power by 1.5 giving 220.

Now we need to modify with maxWarNearbyPowerRatio or maxWarDistantPowerRatio depending on pass. Since we're in the last circle (pass 2) we calculate with AI_maxWarDistantPowerRatio instead of AI_maxWarNearbyPowerRatio this means Shaka's power is multiplied by 50/100 giving 110, 2 points short of declaration. It's bigger than 56 though :lol:. So Izzy's safe and TMIT will be the target.

This explains other stories of players who report being hit by ais who come all across the world to get them. There's a risk of this happening if that ai only borders with ais it won't declare on for attitude reasons (Toku in your case). In that case we'll get to the last circle (pass 2) and attitude is not always the single important factor anymore especially if AI_maxWarDistantPowerRatio is very low. In that case power can become important.

I noticed in another game that distance (which is calculated by some complicated formulas) can override attitude too for these pass2 declarations. So scouting is important to make an educated guess.
 
Dan, you mentioned the AI purues one of 20 strategies and listed them. Is there an article about those strategies in detail?
 
Maybe this was just coincidence, but can Def pacts impact Wheoohrn status? I had an interesting situation come up: Qin, Ramesses, Darius, Justinian, and I (Liz) are in a Buddhist lovefest on our continent. Asoka is Hindu and on an island nearby and he's been in Wheoohrn mode for probably more than half the game. I just met Ragnar and he too just goes into Wheoohrn mode. A couple turns later an AP vote makes us all share a defensive pact and the next turn both Asoka and Ragnar drop out of Wheoohrn. Has it all been a huge coincidence because it just seems too unlikely that both would drop out of war mode at the exact same time?
 
I have some questions about the AI behaviour regarding signing peace (I know that this thread is mainly about the logic behind declaring war, but I think the logic behind ending wars is as important):

1. iRefuseToTalkWarThreshold defines the initial period of none-negotiating after declaring a war. However, my experience is that the AI sometimes seems to ignore that setting towards other AIs, signing peace with them earlier. Does anyone know if there are exceptions and what they are?

2. iMakePeaceRand is the random 1/X chance that an AI will search for peace - but how does it come that they never offer peace to the human player? I know that this was introduced with an earlier official patch to make inter-AI-wars more enduring, but why does it block signing peace with the human player and where is the place to change that?

3. The GlobalDefines.xml values determining "War success" of the AI:

<DefineName>WAR_SUCCESS_DEFENDING</DefineName>
<iDefineIntVal>3</iDefineIntVal>

<DefineName>WAR_SUCCESS_ATTACKING</DefineName>
<iDefineIntVal>4</iDefineIntVal>

<DefineName>WAR_SUCCESS_UNIT_CAPTURING</DefineName>
<iDefineIntVal>1</iDefineIntVal>

<DefineName>WAR_SUCCESS_CITY_CAPTURING</DefineName>
<iDefineIntVal>10</iDefineIntVal>

<DefineName>WAR_SUCCESS_NUKE</DefineName>
<iDefineIntVal>10</iDefineIntVal>

I assume that they somehow influence what price the AI charges/is willling to pay for peace...? Does someone know the exact formula? And is there any impact on 1) - e.g. will a badly lost war evetually lead to overriding the initial no-talk-period?

Thanks in advance for any help :)
 
Oddly enough, I was already thinking of a question very similar to Pfeffersack's. I will say, though, that I've seen random events trigger peace for the human player. In once game, it kept me alive for the two more turns I needed to win a Cultural victory. But maybe you meant something else and about a random calculation and not just the random events?

Anyway, my main question is this:
How does the type of war the AI decided on affect duration and willingness for peace or to capitulate.

The question has come up a lot, but is especially pertinent from my current game, (Prince level), I'm playing Bismarck. I was playing for a war of opportunity/late warmonger strategy on a Huge map and Epic speed. I've gotten pretty good at mostly peaceful Diplomacy/Cultural/Space strategies at up to Prince level and at Domination wins at lower levels, but I'm fairly new at playing a warmonger at the higher levels. So far it's gone pretty well, as of the 1960s. My homeland has always taken up SE of big squarish continent. I kicked butt against Willem (NW of continent) and Hyuna (NE) in two Classical era wars to hold territory and get early veteran bonuses, then stayed at peace with at least Cautious, and mostly Pleased from everyone but Hyuna (Annoyed) through 1700s, when Hyuna started what was probably a limited war with me, when I started building an oil well and forts along his border. I'd been planning to attack him soon anyway and took two of his closest large cities in Cavalry vs. Rifleman fighting before the Apostolic Palace forced us to make peace. In the 1940s, I launched a Panzer invasion supported by Fighters and Bombers, plus a few paratroopers and a limited Marine assault on his best port. Bottom line: He capitulates after I take 5 major cities and raze one tiny one (not given a choice but he still holds a grudge). He had like half of his original land and population remaining. So at war's end I have all but the northernmost part of the eastern half of this big continent, and that's my Incan vassal. Should mention, opposite side of the world is a big S-shaped continent, starting from southwest going up with Pacal, then Washginton and then the only player ahead of me in score, tech, power, land and population, Pericles. The SW of my own continent includes tiny Victoria on my border and then Boudica occuping a big peninsula on the SW corner. They've been at war with Washington forever without much happening.

Fastforward 25 years and I'm ready for an ultramodern war to take out Victoria and hurt Boudica. My goal is to bring them both to capitlation and since I out-tech them militarily I should be able to. (Everything useful except Stealth. They lack Robotics and Composites, and only just got Lasers.) If I can emerge ready to go after Willem quickly, I should be able to score a Domination victory before the opposite continent guys can react to prevent it. (If it's close, Pacal has some big islands that should be easy taking to put me over edge.) I'm armed to do this one of two ways: Nuclear or not nuclear. I paused with a definitive pre-war save here. So far I've tried it with moderate use of nukes. I take all 4 of Victoria's coastal cities and 3 major cities she has near my borders on the first round. I also take the closest 5 of Boudica's coastal cities (drawback -- they are all territory she conquered from Victoria within last century, so not crucial economically). I also nuke Victoria's best stack, which had been massing on her border with Willem. I also nuke one of her nearby cities with a big stack that isn't easy to hit with guided missiles and such. And I nuke Boudica's capital, even though I have no way to take it any time soon. PROBLEM: Willem, who had been Cautious, immediately launches what I suspect is Total War. Despite my SDI, he successfully nukes a major city near his border and captures it. Boudica recovers 3 of the captured coastal cities, using nukes on one of them. They apparently exhausted their nukes on that first turn, because I haven't seen any since and it's been 10 turns. I retook what Willem captured, using more of my ample nuclear stockpile to kill his stacks. I also took one of his other small but heavily defended border cities, to make him a minor offensive threat for now. I'm trying to knock Victoria free from Boudica, bring Victoria to capitulation, then really hammer Boudica, while keeping the much more tech-advanced Willem stalemated -- we have a shorter border and my vassal Hyuna is holding is own against Willem on their longer border so far.

And so here's the crux of my question: Obviously prolonged war is bad news in a nuclear era, so is there any way to know how soon I'll get past "Refuses to talk" with these three opponents, especially once Victoria reaches the magic 50% of Boudica to break free (I had her at 53% and she recovered back to 60%, thanks to some accidental help from Willem on that turn). And once we get past that, how hard will it be to persuade at least the two that I attacked to Capitulate. Hyuna went straight from "Refuses" to "Capitulates" without any trouble in our last war. I've hurt Victoria much worse than I did him. Boudica less so, unless the calculation includes the loss of her Vassal. AND, does my use of nukes influence this calculation.

I'm planning to go back to the beginning of the war and try the same scenario without nukes. My hope is that Willem can be kept neutral as long as I stay conventional. I may try a side deal to keep us treatied. I'll have a tougher fight to get as much territory from Victoria, but I may have an easier time by not having to fight Willem at the same time. We'll see.

But I'd like to understand these AI War/Peace calculations better regardless. Thanks in advance.
 

Thanks, Yamps. There's some surprising stuff there. The AI evaluation for my success includes how many units I've lost? Any idea of whether successful use of a missile counts as loosing a unit? I tend to use tons of missiles in late-game amphibious assaults, but maybe I should rethink that.

Also, based on this chart, it looks like attitude and worst-enemy status don't matter. So whether I use nukes or raze cities may affect post-war relations, but it's not going to affect whether they agree to talk? And it looks like who started the war and if them what kind of war (total, limited, dogpile, raid, etc.) doesn't matter.

Also, is there a similar chart anywhere explaining Capitulation proclivity?

On both return-to-talk and capitulation, does anyone know how this war success calculation handles allies and vassals? For instance, in the lengthy description above, I've decimated Victoria but have only damaged her master Boudica. Will Boudica's RTT and Capitulation be affected by what I've done to Victoria? And if I was successful in prying Victoria free, how would that damage to Boudica affect her evaluation?
 
Only land and sea units count for the said losses in terms of war sucess calculation. Missiles AFAIK don't count, as well as air units losses.

All the AI will capitulate in the same way: if they have less than the average of the alive civs power, less than 3/4 of your power ( or was it 2/3 ? ), more power than anyone you are warring besides them ( otherwise they will fear your enemies ) and you have a War Sucess count of 40 or more against them, they will be willing to vassal to you, no matter if they are Gandhi or Monty ,as long as they are free civs with no vassals...

In terms of war sucess counts, all the civs are treated equally, including vassals. The damage you make to a vassal will not carry in any way to the master and vice versa and damage made by your vassals will also not help you in anything, directly at least. There is a big effect of having a vasssal in this discussions though: having vassals boost enourmously the sense of power the master has, a thing that makes extremely dificult to vassal a master without making their vassals dead or free first ....
 
Only land and sea units count for the said losses in terms of war sucess calculation. Missiles AFAIK don't count, as well as air units losses.

All the AI will capitulate in the same way: if they have less than the average of the alive civs power, less than 3/4 of your power ( or was it 2/3 ? ), more power than anyone you are warring besides them ( otherwise they will fear your enemies ) and you have a War Sucess count of 40 or more against them, they will be willing to vassal to you, no matter if they are Gandhi or Monty ,as long as they are free civs with no vassals...

In terms of war sucess counts, all the civs are treated equally, including vassals. The damage you make to a vassal will not carry in any way to the master and vice versa and damage made by your vassals will also not help you in anything, directly at least. There is a big effect of having a vasssal in this discussions though: having vassals boost enourmously the sense of power the master has, a thing that makes extremely dificult to vassal a master without making their vassals dead or free first ....

Wow, that really explains some problems I've had in recent games where I split my assault on master and vassal but had trouble cracking them. Sounds like my strategy should be to diminish the vassal's territory and get them to break. At that point, I should then switch directions and go after the master, who will probably be more willing to capitulate. (Their old Vassal won't become mine while I'm still at war with the original Master.) Once that's happened, then it shouldn't be difficult to get the old Vassal to surrender as well.
 
Wrong ;) Vassals also count for the power average, so beating out a vassal will only make vassaling the master harder ( because the power average will drop ... and simple averages are pretty sensitive to extreme values, so a weak vassal will have a disporpotionate influence in that average ). The best way most of the times is to focus on beating the master enough for the vassals to break free and then vassal them one by one starting by the master ( the ex-vassals most of the time will refuse to vassal directly becasue they fear their ex-master ) and then proceeding to vassal the ex-vassals starting by the strongest of them.
 
Wrong ;) Vassals also count for the power average, so beating out a vassal will only make vassaling the master harder ( because the power average will drop ... and simple averages are pretty sensitive to extreme values, so a weak vassal will have a disporpotionate influence in that average ). The best way most of the times is to focus on beating the master enough for the vassals to break free and then vassal them one by one starting by the master ( the ex-vassals most of the time will refuse to vassal directly becasue they fear their ex-master ) and then proceeding to vassal the ex-vassals starting by the strongest of them.

Not sure I understand. I'm specifically talking about getting the Vassal's territory under 50 percent so that they break with the master and I'm no longer dealing with a Master/Vassal situation at all. (Also, in the case I have in mind, geography will also make it inconvenient to go after the Master first.) Are you saying this will backfire because the Master will actually believe they are stronger without the weak Vassal to screw up their averages?
 
No, I'm saying that, by beating the vassal out, you are lowering the power average, and that alone in most games is enough to make the ex-master think they are doing fine on their own ( that is what they say when their power is above the alive civs power average ). So , you , by forcing the vassal out by beating it, are making the AI master to think they are less powerful indeed, but you are also making more probable that they think they are doing fine on their own and unwilling to vassal anyway unless your power is so big that pushes the power average up enough ( that is not the case normally )

That is why the best solutions regarding vassaling masters are the one I said above ( take out the master first until the vassals start to break out ) or simply kill the vassal(s) for good. The simple existance of a very weak AI may make everyone else unwilling to vassal at all ;)
 
No, I'm saying that, by beating the vassal out, you are lowering the power average, and that alone in most games is enough to make the ex-master think they are doing fine on their own ( that is what they say when their power is above the alive civs power average ). So , you , by forcing the vassal out by beating it, are making the AI master to think they are less powerful indeed, but you are also making more probable that they think they are doing fine on their own and unwilling to vassal anyway unless your power is so big that pushes the power average up enough ( that is not the case normally )

That is why the best solutions regarding vassaling masters are the one I said above ( take out the master first until the vassals start to break out ) or simply kill the vassal(s) for good. The simple existance of a very weak AI may make everyone else unwilling to vassal at all ;)

OK, now I think I understand.

The implication of this for scenarios like what I described is that if the geography makes it necessary for me to go after Victoria, the vassal, first, then once she breaks away I should pursue her extermination/capitulation before expecting to make any headway with her former master, Boudica. And as a sidenote, since Boudica has a relatively high RTT, that may be a better approach anyway, especially if I can hit Victoria really hard quickly and ignore Boudica during the first few years of war without much risk of counterattack from Boudica.

Going back to the earlier question, am I right in thinking that neither nuke use nor city razing will adversely affect RTT or Capitulation?

Also, in this scenario the master/vassal are already at war with a distant AI, Washington, which is why they are weak militarily on the geographical side near me. If I pursue a strategy as outlined above and I am injuring them, but Washington is not (looks like they mainly have a war of naval engagement and coastal bombardment), is there a risk that one of them will Vassal to him before me?
 
No, neither nukes or razings have a direct influence in either RTT or capitulation besides the changes in war success ( 10 war success points per detonated nuke , BTW ).

In your situation ... well, I'll assume that Victoria is weaker than Wash and Wash weaker than Boudica . In that situation it is impossible that either Boudica or Victoria vassal peacefully to Wash, that is a good thing ;) , so the only risk is from them to capitulate to him. As long as Boudica is stronger than him , that should not happen, but Victoria, being weaker, might have a risk of capitulating to Wash if Wash has 40+ war sucess points on her and she becomes free ( might be dificult to have that war sucess if the war was really mainly naval ). Same to Boudica if she becomes sustantially weaker than Wash and if Victoria breaks free...
 
Top Bottom