• We are currently performing site maintenance, parts of civfanatics are currently offline, but will come back online in the coming days. For more updates please see here.

How i provoked AIs to declare wars (via some very weird but working method)

Fins

Warlord
Joined
Jun 25, 2014
Messages
191
TL;DR. To provoke any AI to declare war on you: have closed borders to all AIs, have no resource trades with anyone, no defense pacts, and very little army in an area you want some AI to attack. Have some AI being much pushed by your own territory (culturally), and verify that this AI has no access to any non-claimed territory to expand into (including other continents if they're able to travel there). Then, put some workers right next to a border with that AI, have them do whatever, then go talk with that AI and make a deal to trade some resources. Hit "end turn" - and they'll declare war on you very next turn! _Probably_, that is. :D

Details.

There may be two rational reasons to provoke AIs to declare war. 1st, to avoid permanent (never decaying) negative diplo modifier (was it -3?) for declaring war on them ourselves; 2nd, the Great Wall provides huge boost to Great General points, but only if fighting inside our own cultural borders - which is exactly what happens when AI declares war: it sends units into your territory.

There's this old thread back from 2012, asking how to provoke AIs to declare war: https://forums.civfanatics.com/threads/provoking-war.469242/ . People in that topic said some doubtfull stuff,
Spoiler including :

- much higher Power stat (above 130% or so of an AI who's being provoked) will make any AI never declare war. Not true: in my current Evergreen game, i had 3 AIs declaring wars on me, and in all 3 cases i had times higher Power stat than theirs.

- getting very negative Diplo stance helps increase the odds for an AI to declare war; they recommended making diplomatic demands to decrease it. Three problems with it: 1st, every demand made - creates as permanent diplo modifier as declaring war. It never fades away and goes bigger and bigger with every demand made. 2nd problem is, in certain circumstances, AIs will declare war no matter what is their attitude to us, anyway - and in certain others, they never will declare war even if extremely Furious (-20 and below); and 3rd, if they're angry, then they will not trade resources to us, which trading, curiously, in certain circumstances seems to provoke their declaration of war!

- deleting units to lower Power stat: bad idea, because apparently, it's not total Power stat (anymore?) which is a factor, but proximity of many strong enough troops to the area which an AI might want to invade.

- peaceful leaders like Gandhi won't attack if your Power is higher than 90% of theirs. Not true: in one of my games, i had exactly Gandhi declaring a war on me, totally unprovoked in any way - even while i had massively higher Power stat than his.

- using spies and get them caught by the AI to create ever-growing "your spy was caught" negative diplo modifier. Same three problems as with doing demands - all true for this one as well.
Now, to what i found in my current Evergreen game.

AIs seem to attack when they "think" that:

- there's a part of your empire which is "easy to grab" to get some profit and/or hurt you. This includes undefended workers near their border, a nearby city with not-so-strong (relative to thier army) defender(s), no other military units for several tiles around the area, and/or productive lands which their empire could much benefit from, if such lands would become theirs;

- it's good and desirable to break some kinds of trade agreements between them and you. Ones which, when cancelled by declaration of war, would result in reduction of your empire's growth / development potential. I suspect that they weigh this "indirect harm" (breaking such trade agreements) dealt to you - vs harm (if any much) they themselves would suffer, and if they see that breaking such a trade agreement is no significant problem for them, but clearly does some (if minor, but still substantial) harm to you - then they'll be more likely to declare war. Hillariously, such a consideration does NOT seem to have any effect when they consider any _offer_ to create such a trade agreement. Which is why creating such an agreement - may well become "the last straw" which makes AIs to stop being peaceful to you, and declare a war. %)

Now, three practical examples to the above, from my current Evergreen game.

1st, Mao declared war in 1310 AD when i culturally blockaded his entire 2-city empire. Right before, he was "Pleased" with me (-1 for border tensions, but +1 for years of peace and +3 for having same faith), yet this did not stop him. Note how there are multiple very productive (resources, improvements) tiles he'd immediatelly have available for his own cities if he'd capture Oporto and/or Evora - two high-culture cities which i intentionally designed to "squeeze" him culturally. Also, note how he's completely unable to sail anywhere (this is pre-Astronomy times, so only coastal sailing, but closed borders from me made his ships unable to go anywhere):
Spoiler :
Evergreen - Mao declared war 1310 AD.jpg
2nd, in 1911 AD, Churchill (and his former-colony, now vassal, Rangar) declared war on me very next turn after i made a resource trade deal with Churchill. I had no intention to provoke him, but merely wished to get couple resources useful for my corporations, which he had for trade; usually i don't trade resources at this stage due to diplomatic repercussions (other AIs' demands to stop trading with their "worst enemy") - but in this case, worst enemy of Churchill was above-mentioned Mao (who was by now reduced to a single-tile city-state and remained peaceful after that). So i didn't care if Mao would make any demands, and thus made this trade deal with Churchill. And it just happened that i had some workers near his border building farms on some flood plains, at the time.

End result? Very next turn after making that trade deal, Churchill declared war, which cancelled that trade deal, and he destroyed those workers - both things, you can see in the turn log on the screenshot. Also, note on the minimap that i encircled Churchill (white lands) from all sides; and, my Privateers remained successful in destroying his galleons and caravels, and did some lengthy blockades as well, which greatly slowed his development - but perhaps more importantly, prevented him expanding to anywhere else after he granted independence to his former colony in Australia. Which colony became his vassal Ragnar - sorta tan color on the minimap. And at the time, just 1 turn prior (1910 AD), Churchill was "Cautious" towards me. Meaning, once again, just like with Mao, this wasn't any "caused by bad attitude" declaration of war, too.
Spoiler :
Evergreen - Churchill declared war 1911 AD.jpg
And 3rd, in 1938, after i've beaten both Churchil and Ragnar to single-city empires (i have reasons to keep them alive, if you wonder), and then had my main offensive force returned to mainland from Australia - Alexander declared war on me, too. But this time, so soon after that declaration of war from Churchill, i intentionally placed some workers near his border and intentionally made a resource trade deal - this time, it was fish and gold from Alexander, which once again were two resources useful for my corporations. And once again, very next turn this deal was made - Alexander declaring war on me, exactly like i hoped, this time, that he would. Because i had one more reason to wish to do war with Alexander (and not with quite stronger AI, at the time - Hammurabi (purple) with his vassal Germany (light-gray): Alexander has two Uranium resources within his territory, while Hammurabi got zero. And i'm going to prevent them AIs from getting any. That's why i wished to fight Alexander. And since i'm keeping every beaten AI alive, it matters to me whether they'd get any permanent negative-diplo modifiers, too.

Anyway, in 1937 AD (previous turn) - Alexander was "Cautious" to me just like Churchill was - even with exact same score of -2 total: +1 for years of peace, +1 for past events, -2 for different religion and -2 for border tensions. And by this point of the game, i've seen Alexander's caravels sailing all around the map, poking their noses this and that way, looking for a place to expand - but as you can see on the minimap, by 1938 AD there are no more non-claimed lands for Alexander to settle. Meaning, the only possible method to expand and grow, for Alexander, at this point - was to attack either me, or Hammurabi (his other neighbour - purple). But Hammurabi kept a LOT of units near Alexander's border (couple dozens or more every time i looked). So, that wasn't any easy target for Alexander. While this lone city of mine, with a single Mech Infantry defending, no other army anywhere close, and then some juicy workers instantly killable - was apparently very tempting.
Spoiler :
Evergreen - Alexander declared war 1938 AD.jpg

Perhaps after we made that resource trade deal, Alexander's AI even concluded something like "hey look, this human guy wishes to trade, so he's probably not any warlord type and his huge army is just for show"? Maybe that's how it works? :D Anyhow, however it is, this provocation method - proved to be quite hillariously working, yep. Hopefully, this method of provoking AIs to war - will help you enjoy all the peculiar little benefits i described above, in some of your games. Good luck! :)
 
This surprises me.

Do you have saves from the previous turns? preferably imediately before ending your turn before the war and before moving workers/ making trades?

I would very much like to take a look and play around with them.
 
This surprises me.

Do you have saves from the previous turns? preferably imediately before ending your turn before the war and before moving workers/ making trades?

I would very much like to take a look and play around with them.
I have indeed.

edit: note that i play my Evergreen game with inflation disabled (set to 0 in XML), which is due to my intention to run this game for many thousands turns, and inflation was never intended to remain reasonable after that long a time. Without that XML tweak, you'll need to set higher percentage of commerce to gold production, to avoid running outta gold and having units disbanded due to it (which would decrease Power stat), if playing around with those saves for any many turns.
 

Attachments

Last edited:
I do not think that the workers and trades have had an immediate impact. Those saves are for the 1911/1938 wars, thus I can only comment on them.

In both cases I noticed that the AIs in question are already plotting ('We have enough on our hands right now' (or short WHEOOHRN) message when talking to them about declaring war). Alex is already plotting in the 1910 save.

In both cases deleting the workers at the border and not doing any trades do not change the outcome: The wars start at the same time.

Already in the Fins_6 save (1936) you can see alex moving his stack towards you.

Opening borders at this point does not have an impact.

AFAIK the AI only weigths the relative power difference when picking a target. This happens when they start plotting. (for more information, check this post, or directly in CvTeamAI::AI_doWar() )

The AI sometimes decides to stop plotting. I do not know how it reaches that decision and I do not know how it decides when to declare.

What I think happened in your game is that they had been plotting for a long time, did not stop and ended up declaring, at which point you had workers at their border and made the mentioned trades by random accident.

What I can not exclude is that the workers being present enticing them to start the war at that point.

I can not judge how the positioning of your troops enter in this decision, but I think that it is likely to have an impact.

Concluding, I think that your method might entice an AI that is already plotting on you to declare soon, but I can not judge without understanding more game code, specifically when an AI decides to declare a war after having started plotting. I do not think it will have an impact on an AI that is not plotting against you.
 
Thanks for looking into those details - your knowledge clearly exceeds mine by a mile, it seems. :thumbsup:

Perhaps i may be of further assistance to you, though. I made some observations in this and previous games, related to some of things you've just mentioned.
Spoiler Namely :

- workers near their borders: far not the 1st and 2nd time i had AIs start wars exactly by grabbing some non-protected workers which are within instant reach of their army's. It may be a minor factor in their "should we strike now or not yet?" decision, but my guts definitely say that it is a factor.

- those two trades made exactly 1 turn before AIs declaring a war must indeed be one funny coincedence, then. However, in my past games, i had multiple declarations of war from AIs which "suffered" similarly much-one-sided trades with me, you see. Things like snatching few dozens GPT plus a resource from some AI, giving them just 1 pretty useless for them resource for it. I.e., i suspect that it's not just "any" trade made, but certain kinds of; note how in both cases here, i was getting two resources which provide pretty major improvement towards total amount of culture, food and production, considering how many of my cities were having those corps at this point. While the only thing both AIs got for it - is couple extra happiness, which did pretty much nothing for Alexander, as his cities were limited by health, not happiness. Still further, extra few GPT Churchill agreed to pay in his deal - made that deal even worse, for him. Which was one of reasons i thought this may well matter. But maybe it doesn't, like you implied? But anyhow, i think when trying to provoke 'em, doing such a "one-sided" trade deal with them at very least would not reduce the chances they'd attack; at very least, the examples we have here seem to confirm that.

- AIs can be plotting for a long, long time and still do not declare any war. In this very game, some time around turn 180sh iirc, Hammurabi kept his main stack in Opis - his city near my Braganza - for dozens turns. I've noticed and sent / upgraded some army to reinforce the area, within my own territory: fighting him at the time would be not desirable at all, as i was busy stomping other AIs at the time. That war which Mao started - lasted for over 500 years, as Mao quickly vassaled to turks after losing his army, and of course, turks auto-declared, so i then beaten turks - who vassaled themselves to France (and soon Mao regained independence), which then also auto-declared, so i've beaten Napoleon next, who vassaled to Shaka, who, again, auto-declared. So, i myself was WHEOOHRN, hence not willing to fight Hammurabi yet. And then, in 1775 AD, Hammurabi with his vassal Frederick declared war to Alexander, you see. Churchill declared on Alexander same turn, too - but Alexander managed to survive in pretty good shape. I've seen such things before, too: looks like most, if not all, AIs at some point arrive to the "we need a good war now" state, start looking for a potential victim, start preparing to hit it, but if circumstances chance - they may decide to declare war to someone else, instead.

- deleting workers near their border just 1 turn before they declare: this is most likely not indicative. I believe, AIs often "send an invading army" good few turns before they declare a war; indeed, it often takes a few turns of ots movement through their own territory before they cross the border (and thus, declare a war). Like you discovered yourself, too: Alexander did it before 1936, but declared in 1938 upon crossing the border. It doesn't often happen like that - sometimes, they have a big army standing just a single turn away from crossing their enemy's border, of course. But when it does happen, in my experience, that "marching invading army" will proceed with the path which was chosen for that stack to invade, unless something really problematic happens before they cross the border, that is: someone else declares on them, or soon-to-be-invaded player blockades the chosen path (like, putting some Machineguns in forts right next to the point where attacking army would cross the border), etc. I just don't remember when exactly i've put those workers to build some things near Churchill's and Alexander's borders, but it was definitely a few more than 1...2 turns before they both declared. A few more than that. Which is when they probably decided to send their invading armies, i guess.

- one more thing about workers: many times, i've seen how AIs prefer to capture my workers during war times at every opportunity - even when doing so means sending some unit(s) into position where they are doomed to be killed by my overwhelming forces very next turn. And even when the cost of those "kamikaze worker killer" AI units - is far higher than cost of worker(s) they destroy. This is one more reason why i think that putting some workers near their borders to provoke their attack - is one significant factor.

- regarding AIs weighting power stat ratios when they start plotting: i've checked the post you've linked, and in table D, line 16, while i don't know how it all is calculated, it seems to be something of the "if AIs have comparable Power, then they can declare a war". Those "3/2*OP*MaxPR" entries, you see? Well, i doubt this is how it works now. Take for example Churchill, in the example we're having here: he declared a war to Alexander in 1775 AD, so, according to that post you've linked, his plot to go to war against me in 1911 AD - could not start earlier than _after_ 1775 AD, right? Because the post says they don't plot when they're already in some war. But, if you'd check Power graph in any of those saves i posted - you'll see that for every turn since 1775 AD, Churchil's Power was no higher than 30% of my Power. I.e. 3+ times lower. And after he granted his colony independence - Churchil's and Ragnar's Power stats combined were still below 50% of my power stat for any given turn. But Churchil + Ragnar still attacked, and without having anyone else to join them. So, it seems to be that Churchil's plot to make a war against me managed to resolve in actual DoW despite "seemingly far insufficient" Power of Churchil (+ Ragnar). Still further, you can also check Power graph and see how much higher my Power was than Hammurabi's, after Alexander was done fighting that started-in-1775 AD war vs Hammurabi - and then ask yourself: how exactly after Alexander made peace with Hammurabi, he didn't plot to attack Hammurabi once again, but instead chose to attack human player with massively higher Power stat than Hammurabi's? So you see, i think that maybe the post you linked, being from 2008, does not anymore accurately reflect those matters anymore... :(

- and about "no effect vs AIs who are not plotting": while i bet that technically you are completely right here, this consideration is pretty much irrelevant to this topic, in the same time. How so? Well, one thing my experiences and that post you've linked perfectly match about - is major influence upon AIs' decision to plot produced by one particular circumstance: how long a border there is between that AI and potential victim. I.e., them AIs will usually against neighbours who got significantly long border to the AI. I see it all the time; my based on experience estimate - is that over 80% of all wars AIs independently declare (i.e., declaring "on their own" and not as someone's vassal or such) - are against such neighbours. But, this topic - is exactly about such situations, too! I.e., about provoking AIs who already have a long border to the human player. Because usually, if the player wants to provoke a DoW, then it's provoking some AI who already have significantly long border with the human player. We usually want that simply to expand our territories in a most convinient way. I.e., players, just like AIs, usually prefer to win some war against an AI who are already a neighbour, you know. But being such a neighbour - usually means that AI will already be trying to plot against human player. Sorta "happens anyway" thing, to a large extent - you see? :D
 
Bold to trust your gut over code diver knowledge, from DanF nonetheless. That power formula is the aggregate of everyone you'd be at war with if they declared, so Church is adding Shaka and Shaka's vassals to his power. You were within striking range pretty much the whole time you were fighting Shaka.
The culprit for long plots is usually obsolete naval units, and indeed we see Church spamming caravels.
 
Bold to trust your gut over code diver knowledge, from DanF nonetheless. That power formula is the aggregate of everyone you'd be at war with if they declared, so Church is adding Shaka and Shaka's vassals to his power. You were within striking range pretty much the whole time you were fighting Shaka.
The culprit for long plots is usually obsolete naval units, and indeed we see Church spamming caravels.
Bold or not, i usually value good in-game experience and evidence higher than any code analysis, even when the latter is extremely well-done. Because bugs, undocumented features, some other seemingly not related parts of code altering results at runtime, etc. Heck, C itself sometimes produces results wildly different from what "should" be made by certain kinds of code. Has quite a reputation for that - at least, had it couple decades ago, back when i was still remembering more than couple things about programming... %)

As if Shaka's power was any game-changer, though. It wasn't. Here's exact numbers to support my point above. Churchill made peace with Mao in 1866 AD (as you can see on the screenshot), meaning, i understand, that he couldn't start plotting his 1911 AD DoW against me earlier than 1867 AD, since he was busy with (formal, but still active) war with Mao (who was sitting in complete safety in his single-tile 1-city empire, walled from Churchil and everyone else by my closed borders). But, in 1866 AD, total combined power of Shaka + Napoleon + Mehmed (with whom i was at war at the time) plus power of Churchil and his vassal Ragnar - i.e. combined Power of those 5 AIs - was merely 54% of my power, at the time. Give or take couple percent - not more. This is from quantifying this graph from 1872 AD (the nearest after-1866 AD save i have):
Spoiler :
Evergreen - 1872 AD, Power stat, Churchill made peace with Mao in 1866.jpg
So yes, i do trust my gut, in this case - so far. Would love to have it explained and change my mind, if i'm wrong and there's a way to show it. And if that "minimum power required for DoW" formula actually allows "twice lower combined attackers' + current enemies power" - then, would such a generous power tolerance have any much practical meaning at all? I doubt. If that's how little power they need, then this power requirement would stop really very few DoWs, me thinks.
 
Correct, the power requirement is essentially meaningless. That's the main takeaway from DanF's post. Wars are deterred with diplo attitude, truces, and other wars, not with armies. The only practical meaning the power requirement has in a normal game is with DPacts. When people suggest something along the lines of building a defence to deter attacks they tend to face immediate pushback on here. Maybe that's how the game intuitively should work, but collective experience and the cited code says otherwise.
But, in 1866 AD, total combined power of Shaka + Napoleon + Mehmed (with whom i was at war at the time) plus power of Churchil and his vassal Ragnar - i.e. combined Power of those 5 AIs - was merely 54% of my power, at the time. Give or take couple percent - not more. This is from quantifying this graph from 1872 AD (the nearest after-1866 AD save i have):

That is not a scientific graph, and I'm skeptical of a 2% margin of error in estimating. Can you share the 1872 save? Nearby saves after that may also be beneficial.
 
Last edited:
How is it "not scientific"? To quantify, i simply copied each of the 5 AIs power values several pixels to the left from the right edge of that graph (in Paint, as fragments of the screenshot) and placed them on top of each other, then divided resulting value (height of the column of those 5 AIs' graph fragments placed on top of each other, in pixels; it was 307) by value of my power at the same year (again in pixels; it was 565): 307 / 565 * 100% = 54.3%. Possible inaccuracies may be some 3...5 pixels this or that way when i was copying AIs' "at 1966 AD value" graph fragments on top of each other, and 5 pixels is ~1% of 565; thus "give or take 2%" - is even twice bigger than it most likely is.

Next, if power requirement is essentially meaningless, then i was correct in the 1st post of this topic about that old thread from 2012 providing misleading opinions about it. All that "90% power" and "130% power" stuff - which i've seen not only in that particular 2012 topic, but also in some other discussions as well. Looks important enough to figure that part out, right?

And sure, here are saves i have; i'm keeping saves for some particular events and those are ones i have for that period of the game.
 

Attachments

That was an impressive amount of work then, but BUG will just give power ratios out to four digits. It was just under 52%. Churchill was plotting in 1876 and not in 1872.
Anyways, I was barking up the wrong tree though with that. I noticed all victory conditions are turned off except conquest, and I think that's where we got into trouble. There's an "AI_STRATEGY_FINAL_WAR" script that ignores power ratios. I'm having trouble with my Google/forum search game on that, but IIRC that script is either unlikely or inert when there are multiple victory conditions enabled. Since you have only conquest enabled and are basically stalling near victory, you encountered this several times. Diplo relations should still thwart it.
 
Under 52% even? Surprised, i am. Guess i was way "too" careful to not copy bits of those AIs' power graphs in a way which would give my argument any unfair quantative advantage - more than i thought i did. I tend to do that as a pre-caution for being wrong. Guess i overdid it a bit with that 54%. Sigh. %)

Most interesting about "final war" script. Yes, conquest-only in this game - but i read, quite many other players do the same, too. Especially when the plan is to, well, conquest it. Further still, if that script completely ignores power ratios, then it's something quite hella important, assuming this script is activated in more circumstances than this one (i.e., not only when victory type = only conquest). I didn't google about this right now, but in the past i've read quite a few stories from other players about AIs getting hella agressive when players were leading the space race and got quite some parts of the ship being built. Probably it's the same "_final_" war being attempted by AIs, then?

Quite much more interestingly, this "final war" script - is still not unconditional "always try war" thing itself, too. See, that Mao guy in my game, who declared on Churchil despite being 1-tile empire? Never declared on me ever since i made peace with him. Same for Mehmed. Same for Napoleon. They all sit in their 1-tile empires blockaded by my closed borders and never tried to DoW me after being beaten. So, if power is completely ignored by that "final war" script - then something else still prevents their DoWs. I wonder, what it is? Edit: and it's certainly not diplo relations: while Mao is at +5, Mehmed is fluctuating near -9 and Napoleon near -16. Razed quite some of their cities, so both are furious, ever since i made peace with 'em. But they still didn't try to attack me even now, up to 1950 AD.
 
Last edited:
If it makes you feel any better, I used a ruler and got ~60%, which is why I wanted to check lol.

My hunch would be final war only works for just military victories, but I don't know. Either way I doubt that's what's behind those anecdotes. People on social media just tend to latch onto narratives that "sound right". Case in point: nuclear Gandhi.

The AI needs to be able to build at least 2 different "attacking units" (not warriors/archers) in its capital. The practical result of that is that the AI cannot attack you early game without metal. Even horses (chariots) are not enough until they also have HBR for horse archers. This is why people check to see if the AI brags about "archers". Not even Shaka can attack you if he just has archers. It's not a condition you'd expect to see in the modern era, but I would wager that's what's going on with those 1-tile cities.
 
Well, catapults and trebuschets are not warriors/archers, and both Napoleon and Mehmed became able to build 'em long ago. And both have one of those present in their cities, too. Both also made a grenadier not so long ago, and there's a musketeer in Napoleon's city and Janissary in Mehmed's. So, it's not it, unless "attacking" means strictly Mounted and Armored units only. Which would be hella weird.

As for anecdotes, i think it's one case of "no smoke without fire". Even the old post linked above by a pen-dragon - mentions, among other things, the following (my italic): "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". Which tells me that there is indeed at least some code which alters DoW chances and plotting when potential victim is late-game and/or seem to achieve some other than conquest victory types relatively soon. Whether or not every last bit of such code is known and completely understood, is not for me to judge, but i do have some doubts about it.
 
I don't know how "attacking units" is defined, but I wouldn't expect units that can't take cities to count.

I interpreted that to mean when the AI itself is going for culture victory, not the victim. It's correcting the formula for financial hardship for the notable edge cases that will skew it. An AI pursuing culture is going to appear poorer running the culture slider, an AI with an army is already going to have high unit costs, and an AI researching future techs clearly doesn't need any more beakers.

Next, if power requirement is essentially meaningless, then i was correct in the 1st post of this topic about that old thread from 2012 providing misleading opinions about it. All that "90% power" and "130% power" stuff - which i've seen not only in that particular 2012 topic, but also in some other discussions as well. Looks important enough to figure that part out, right?

To clarify, the reason I said power ratio is essentially meaningless isn't because those numbers are fake. It's that they're not in a useful range. If I can defend comfortably with only 30% of their power, then it's irrelevant whether I need to get to 110% of their power or 130% of their power to deter their attack. The cure would be worse than the poison.
 
Back
Top Bottom