Is there any logic to an AI DoW?

:lol:. I'm not even going to argue with the reference to me, it's so true.

I play pretty nice with "friendly" AIs that meet one of two conditions:

1. They are in my religion, which isn't the AP religion, I built the AP, and I'm going to use them to make me the winner.
2. They are currently stronger than me or another opponent that is also convenient to take down.

Otherwise, they're toast. No qualms about squishing the weaker "friendlies". They get back to friendly decently as vassals, or they can be smeared off the planet entirely to make room for more tiles to work and more long-term power. Who doesn't like long term power? The AI doesn't mind donating some cities after it's dead.

Of course, since the AI is coded to not backstab you at friendly unless it's the backstabby-cathy-who-looks-nothing-like-she-did-in-real-life, I will leave such AIs alone when there are other targets available for the time being. Such useful presences may even do something like give me a buffer for attacking more savory opponents while simultaneously setting themselves up for a pincer attack. I love when they do that.

Sometimes I accidentally win domination before I :backstab: anyone, or decide that using the AP I captured will take less effort. Does that count as loyalty?

Also, I strongly recommend reading the post suggested by Niklas - it highlights when the AI will DoW pretty well. Nothing ruins war plans like wars I didn't plan for, and it's been a while since I've had that happen thanks to perusing that a bit.

Say CivCorpse, would you care to open borders with me and trade some copper to me? I need it to build the colossus. Yes, that's it...the colossus. I want to "strengthen the economy" a bit. I have some gems! What say you?!
 
If I can keep a Shaka or a Monty happy until I've managed to hit improved technology while he's languishing in the earlier ages, that gives me a lot of free experience, and a significantly easier war than one where Monty initiated conflict.
 
:

Say CivCorpse, would you care to open borders with me and trade some copper to me? I need it to build the colossus. Yes, that's it...the colossus. I want to "strengthen the economy" a bit. I have some gems! What say you?!

MMMM@ Gems. sure it's a deal. I won't be using it anyway since my dogsoldiers don't require it. Plus I built the Oracle instead of the Colossus for the Fuedalism slingshot. Would you like one of my Drill2CoverShock longbows to drop it off? It's no problem at all. I just happen to have a stack of them right next to your borders. We won't even need Open Borders. I'll just DOW and then we can go back and forth. Well you can atleast go forth, won't be many of your troops in any shape to go back. We'll just bury them here beside the totem poles.
 
MMMM@ Gems. sure it's a deal. I won't be using it anyway since my dogsoldiers don't require it. Plus I built the Oracle instead of the Colossus for the Fuedalism slingshot. Would you like one of my Drill2CoverShock longbows to drop it off? It's no problem at all. I just happen to have a stack of them right next to your borders. We won't even need Open Borders. I'll just DOW and then we can go back and forth. Well you can atleast go forth, won't be many of your troops in any shape to go back. We'll just bury them here beside the totem poles.

You know what would be the best thing ever? A competitive multiplayer game playthrough between two of you guys with separate threads from your own point of view. :king:
 
With 30-90 second turns? What would we do, mass saves and screen shots and try to dig it up and put it together? I can't stand long games - "Blazing!!!" is slow for me, but I'm not sure that's true for him.

Either way, such a thing would be better suited to another part of this forum perhaps.
 
Well I have seen multiplayer games in here before, just boring ol' cooperative. :p

But yeah I understand that it wouldn't exactly be the easiest thing to do.
 
You know what would be the best thing ever? A competitive multiplayer game playthrough between two of you guys with separate threads from your own point of view. :king:

TMIT would constantly pause the game to go cry in a corner.
 
Hahaha...pretty big words. Are you trying to entice me? Of course I'm willing to play, since I play pretty much everything.

We're threadjacking pretty hard at this point though, so whether this happens and it winds up being us or other players (I actually think it's a good idea and possibly even a good series if both people do summaries from their perspectives, provided everyone can put egos aside - games can turn out spectacularly differently depending on starts, especially if you involve the AI). Hmm, an extreme case was my roommate nearly beating me when he got copper in his capitol BFC about 8 tiles from my capitol...and I had no copper or horses even within a 2nd city site. 6 axes before 2000 BC is a big problem, especially if they pillage. I really thought I'd lost that one, and if he didn't leave a mine that just HAPPENED to have iron (my archer spam/whip put some pressure on his axes), I would have. He choked it away though, suiciding the axes into just a few too many archers, and thanks to that iron I turned the tables, pillaging HIS copper and camping until catapults. AIs were monarch and we both had attacks from them coming in too - I wiped him out but not sure if I could have won that sucker. Anyone on this forum practically would have beaten me there, and I'd probably be able to beat anybody who plays this game with a favorable start like his. Very extreme example, but it happens.

Anyway, this super thread jack probably best taken to PM or its own separate thread, so we can discuss what the AI does here ;).
 
Back to the main topic:
I'm copying some findings I posted in Sisiutil's ALC#24 game thread in here and add some more, because this is really interesting/crazy :crazyeye: :

ALC stuff:

Sissy Sal:
Saladin has discarded his war plans (out of WHEOOH again) because he has assessed his offensive power not high enough after the (fixed!) turns of preparation.
If I understand it correctly the game mechanics for this assessment are rather funny as they only let Sal consider his offensive task force (= number of units with AI ATTACK, ATTACK_CITY and PILLAGE) in relation to the number and size of his cities. In contrast to his decision to start preparing for a war, this judgement is completely independent of your power and the strength of the units he has, so upgrading his Camels and Jumbos didn't help either. As part of his personality he also favors to build units with (the wrong) UNITAI_COUNTER (XML-value UnitAIWeightModifier) during times of peace. Together with his protective trait this turns him more into a strong defender than a real threatening offensive aggressor (compare to Monty!).

I went back to the 990AD save and deleted all your units, canceled open borders and bonus trade deals with Sal, traded with his worst enemy Mehmed, switched to Pacifism and Christianity so I got him to -9 FURIOUS and became his new worst enemy--he still switched out of WHEOOH in 1130AD !!!

SissySal.png

(the message comes from my modified test-dll)

So overall he just considered himself too fat to get his attack started. Interesting...


New stuff:

It works the other way around too. This time I buttered up to Sal and switched to Theo|Islam, gifted him Gunpowder which got him to PLEASED so that I could sign a DP after he researched MT. Then I WB-ed him 20 Warriors (UNITAI_ATTACK) and this happened:

SissySal2.png


All that really counts is that he gets his AreaAIType from AREAAI_MASSING to AREAAI_OFFENSIVE before the preparation time is up (I think something like 27 turns on epic). If he succeeds he goes from WARPLAN_PREPARING_TOTAL to WARPLAN_TOTAL and declares, otherwise he switches back to NO_WARPLAN (out of WHEOOH) and AREAAI_NEUTRAL again = peace!
 
^^Thanks. rolo pm/asked me to have a look at the mechanics and they are realy interesting, but rather complex. WB, SDK and chipotle are the ways to go here, AFAIK python is kind of limited when it comes to AI decisions. Didn't want to disturb Sisiutil's thread, so let's have a nice discussion here.
 
^ok,

I got interested after i and a lot of other got rushed on deity, i started the discussion here,

http://forums.civfanatics.com/showpost.php?p=7172515&postcount=29

- A few conlusions from this, if Niklas is right our power isn't important until our power reaches a certain (very high) threshold value that we won't reach easily on deity but also not on immortal or even emperor early in the game.

- This immediately raises another question, why is it we're getting declared on on deity early much more than on lower levels where we won't reach the threshold either?

Scrutinizing the complicated ai_dowar function i realized that Niklas described the proccess from the point that the dice to go to war are thrown. There's some code before this that might make it possible the dice are not thrown at all, it deals with unit support cost for instance which'll be lower on deity. There's also some code which i haven't looked into after the section Niklas describes.

I gather there's only one way fo find out for sure, compile the SDK, make the debugger work or write all vars in the function to disk, then run simulations. I just got the sdk working this morning and then i read your post, imagine my surprise....
 
So can saladin not technically decleare war? What is required for him to do it?
 
Build more attack units if i understood correctly, the game makes a difference between defensive and attack units. You can see tihs without the SDK in games, ai cavs attack, riflemen seldom do and certainly not while they're fortified in a city.
 
Thanks for giving a look to this, Dan . I also started looking, but I missed that quirk......

But that does not beat with my game experience... I do remember a game where Babylon was in hands full status for more than 200 turns ( in normal speed )... I'm pretty sure that I was the target and i had made a DP with Mansa and Liz... Too bad I don't have the save.....
 
^Rusten posted today that ai can go wheeoh, not slipping out of it when going for a cultural vic, could that have been the case?
 
There's some code before this that might make it possible the dice are not thrown at all, it deals with unit support cost for instance which'll be lower on deity.

Well, the following code parts of AI_doWar seem to be quite important:
Code:
iHighUnitSpendingPercent += (std::max(0, iUnitSpendingPercent - 7) / 2);
...
int iWarRandThreshold = iHighUnitSpendingPercent * (GC.getGameINLINE().isOption(GAMEOPTION_AGGRESSIVE_AI) ? 4 : 2);
iWarRandThreshold /= 3;
iWarRandThreshold += GC.getGameINLINE().isOption(GAMEOPTION_AGGRESSIVE_AI) ? 1 : 0;
...
if ((bFinancesProMaxWar || !bFinancesOpposeWar) &&
	(GC.getGameINLINE().[B]getSorenRandNum(iMaxWarRand, "AI Maximum War") <= iWarRandThreshold[/B]))
	...
	AI_setWarPlan(eBestTeam, (iDaggerCount > 0) ? WARPLAN_TOTAL : WARPLAN_PREPARING_TOTAL);
I think what this means is that when a high fraction of the AI's total expenses is due to its military units, but the AI is not in financial trouble at the same time, then the likelihood for preparing or starting a TOTAL_WAR will increase significantly (even more with Aggressive AI on).

Example:
iUnitSpendingPercent = 19%
iHighUnitSpendingPercent = 6%:
iWarRandThreshold = 4 (with AggAI 9)

RNG can roll [0,1,2,3,4] for a total war! That's 5 times the probability of the usually required RNG = 0 (which is still valid for limited and dogpile wars)!

Considering the large amounts of units the AI starts with at deity and the high discounts it gets for training more, this might explain parts of the often occurring DoWs. There should also be a peak after Courthouses (or earlier Ziggurats!) since this will quickly lower the maintenance costs for cities. Maybe selling resources to the neighbors or getting them to adopt expensive civics might help a little....if I understand all of this correctly:crazyeye:

Edit: But then again both discounts iAITrainPercent and iAIUnitCostPercent are 60% for deity AIs :confused:.
 
^Thx for the explanation,this is indeed (part of) the code i meant, and indeed it might explain (part of) the higher occurence of deity declarations.

There's also some code which gives back a sort of STRATEGY_XXX var, this might also be important and maybe level dependent.

All in all it's seems likely though counter intuitive that power doesn't help as long as your power is below the threshold. There just aren't that many references to the vars iourpower, itheirpower and defensivepower in the whole function.
 
There's also some code which gives back a sort of STRATEGY_XXX var, this might also be important and maybe level dependent.

This is all iNonsense :lol:
Code:
int iNonsense = 0;
iNonsense += getCapitalCity()->getX();
iNonsense += getCapitalCity()->getY();

especially things like
Code:
int iDagger = 0;
iDagger += 12000 / std::max(100, (50 + GC.getLeaderHeadInfo(getPersonalityType()).getMaxWarRand()));
iDagger [B][SIZE="5"][COLOR="Red"]*=[/COLOR][/SIZE][/B] (iNonsense % 11);
iDagger /= 10;
make me go WHAT??? :eek:
 
Back
Top Bottom