What causes AI refusal to make peace ?

Magean

Prince
Joined
Aug 7, 2009
Messages
474
Hi,

Here's the situation. Alex declared war a long time ago. I had a tech advantage, but he had vastly larger numbers. For a while I was fighting very defensively, while he was spewing out an endless stream of units to my border cities, apparently halting his own development altogether. Over time, my tech advantage allowed me to push the frontline further with my still outnumbered troops. Until the Greek armies crumbled ; you can't do much when fighting Industrial armies with early Renaissance units. Eventually I took 3 of his cities which I puppetized, as well as his capital that I annexed. That was about 80 or 90 turns after the beginning of the war. Now he's down to 5 cities : 3 on the snow/tundra and 2 on the desert. He's the gimp of the world, largely behind in tech.

And guess what ? He won't peace out. "Have you come to surrender ?" is what I get when talking to him. His three tundra cities are surrounded, whatever unit gets out is destroyed, his economy is in tatters, he stands 0 chance. But he's stubbornly resisting. I could destroy him but I don't want to keep his lousy cities which will only be a burden for my tech cost, I don't want to deal with the partisans and unhappiness from razing, and I don't want to suffer the diplomatic consequences from these conquests.

Thus, I need to constantly guard a border while I have much more pressing business to attend with my armies, such as taking down the runaway Dandolo on the other continent, who threatens to spread his culture on every other civ.

What should I do ?

Thanks !
 
Hi,

Here's the situation. Alex declared war a long time ago. I had a tech advantage, but he had vastly larger numbers. For a while I was fighting very defensively, while he was spewing out an endless stream of units to my border cities, apparently halting his own development altogether. Over time, my tech advantage allowed me to push the frontline further with my still outnumbered troops. Until the Greek armies crumbled ; you can't do much when fighting Industrial armies with early Renaissance units. Eventually I took 3 of his cities which I puppetized, as well as his capital that I annexed. That was about 80 or 90 turns after the beginning of the war. Now he's down to 5 cities : 3 on the snow/tundra and 2 on the desert. He's the gimp of the world, largely behind in tech.

And guess what ? He won't peace out. "Have you come to surrender ?" is what I get when talking to him. His three tundra cities are surrounded, whatever unit gets out is destroyed, his economy is in tatters, he stands 0 chance. But he's stubbornly resisting. I could destroy him but I don't want to keep his lousy cities which will only be a burden for my tech cost, I don't want to deal with the partisans and unhappiness from razing, and I don't want to suffer the diplomatic consequences from these conquests.

Thus, I need to constantly guard a border while I have much more pressing business to attend with my armies, such as taking down the runaway Dandolo on the other continent, who threatens to spread his culture on every other civ.

What should I do ?

Thanks !

This is probably one of my biggest pet peeves.

From my understanding, the AI gets into peace lock out for three reasons:

-You just captured one of their cities, this causes a 2 to 4 turn peace lockout. They will refuse peace regardless of anything else. (I personally hate this effect but hey.. I'm only one voice)

-You just started warring with each other. I think it lasts around 5 to10 turns?, they will refuse to peace out, again, regardless of anything, if the war was just recently started.

-The war was started because of a trade deal. The player is effected by this too. I think the effect lasts 15 turns? (I play on marathon speed, not sure the length on standard)

edit:
There is also a fourth reason, if the AI's "goal" is to take over your empire and it is winning they will sometimes just flat out refuse. The above reasons are assume your are winning the war.
 
This is probably one of my biggest pet peeves.

From my understanding, the AI gets into peace lock out for three reasons:

-You just captured one of their cities, this causes a 2 to 4 turn peace lockout. They will refuse peace regardless of anything else. (I personally hate this effect but hey.. I'm only one voice)

-You just started warring with each other. I think it lasts around 5 to10 turns?, they will refuse to peace out, again, regardless of anything, if the war was just recently started.

-The war was started because of a trade deal. The player is effected by this too. I think the effect lasts 15 turns? (I play on marathon speed, not sure the length on standard)

edit:
There is also a fourth reason, if the AI's "goal" is to take over your empire and it is winning they will sometimes just flat out refuse. The above reasons are assume your are winning the war.

The war has been going for a really time (nearly 100 turns now) so we can rule out the second and third reasons. Plus, Alex is losing very badly, so I hope he's not waiting until he takes over my empire...

The "no peace after conquest" makes sense to me, it always felt gamey to storm and take a city, and then peacing out although the AI had enough power nearby to reconquer it quickly. But in my case, the 2 to 4 turns are clearly elapsed. It's now 6 turns. I'll wait a little more.
 
Found this as well. My enemies seem particularly unwilling to make peace, and since the new trend of everyone gets a defensive pact except me, along w the aggressive use of war trading by AI civs, many wars seem to leave me with little choice but to conquer. Even if I don't want to (tend to play a more peaceful cult./tour. game with an occasional bit of vengeance!)

Now that I understand the city conquer wait periods, I can try waiting several turns. Regardless, not a fan of this mechanic. A civ which has just had half its cities conquered and is no longer able to wage war should want to peace out or become a vassal instead of continuing to taunt you about your sniveling ways :dunno:

- E
 
Now that I understand the city conquer wait periods, I can try waiting several turns. Regardless, not a fan of this mechanic. A civ which has just had half its cities conquered and is no longer able to wage war should want to peace out or become a vassal instead of continuing to taunt you about your sniveling ways :dunno:

- E

Exactly. It's very "gamey" that a AI that is clearly losing, will refuse to make peace because the "peace lock out" timer has not counted down.


A human player would make peace because they know the other civ will just keep taking all their cities if they don't, but the AI has an arbitrary no peace timer.

The just captured a city one is the most frustrating. You can have the AI against the wall, but nope, can't make peace, come back in about 3 or 4 turns, unless you take another city of course.
 
Exactly. It's very "gamey" that a AI that is clearly losing, will refuse to make peace because the "peace lock out" timer has not counted down.


A human player would make peace because they know the other civ will just keep taking all their cities if they don't, but the AI has an arbitrary no peace timer.

The just captured a city one is the most frustrating. You can have the AI against the wall, but nope, can't make peace, come back in about 3 or 4 turns, unless you take another city of course.

Yeah, what it should be instead is more like, If the AI is losing, only have them accept peace without giving anything. If just lost a city, and don't have a measureable army to take it back, they might as well accept equal peace.
 
I don't want to sound rude, but you are all making broad assumptions about what the AI does or does not consider before being willing to make peace. And most of what you are saying is flat wrong. :)

Isn't that the whole point? People being completely wrong about everything and you getting to laugh at their ignorance? :D
 
I don't want to sound rude, but you are all making broad assumptions about what the AI does or does not consider before being willing to make peace. And most of what you are saying is flat wrong. :)

G
Enlighten us, oh master.
 
Update on my case : I had to wait around 10 turns to peace out. The funny thing is that Alex went straight from gloating to offering me his capitulation, all his gpt, and some other stuff.

There's something weird in here. Again, I'm not opposed to preventing the AI from peacing out just after loosing a city because we all know how exploitable this was in Vanilla (the player would have made a mad dash at a city, seized it without being able to keep it, but the AI would peace out). But that effect shouldn't last more than a couple turn.

Is there a relation between the size of the city and the number of turns of peace refusal ?
 
I don't want to sound rude, but you are all making broad assumptions about what the AI does or does not consider before being willing to make peace. And most of what you are saying is flat wrong. :)

G

Thank you, Gazebo, for snapping me back into focus as to why I love this mod so much. You called us out, without revealing what is actually happening under the hood, and I am grateful. It is precisely because I can't easily predict some of the systems that presents so much of a challenge to me. Today, every game has it's every system analyzed to such a level, that there is an idea min/maxing in order to achieve the "best" results.

For me, the result has always been about how much fun I am having, and how much a great game can take my mind off some of the every day drags that are a part of real life! To me, the biggest compliment I can give any entertainment is "I did not see that coming!" Whether it's a book, movie, tv show or a game, these moments are the ones that make me smile. Rule changing mods are actually what keeps me playing this game, keeping it both familiar AND fresh. The only exception is for systems that are somehow broken. Clearly, this one is both annoying and challenging to some of us, but clearly it is not broken.

Don't ever change, sir!

- E
 
Here's the actual code, for those interested:

Spoiler :
Code:
/// Need some special rules for humans so that the AI isn't exploited
bool CvDiplomacyAI::IsWillingToMakePeaceWithHuman(PlayerTypes ePlayer)
{
	CvPlayer& kHumanPlayer = GET_PLAYER(ePlayer);
	if (kHumanPlayer.isHuman())
	{
#if defined(MOD_CONFIG_GAME_IN_XML)
		if(GetPlayerNumTurnsAtWar(ePlayer) < GD_INT_GET(WAR_MAJOR_MINIMUM_TURNS))
		{
			return false;
		}
#else
		bool bWillMakePeace = GetPlayerNumTurnsAtWar(ePlayer) >= 5;
#endif

		//don't give up if we're about to score!
		if (kHumanPlayer.HasCityAboutToBeConquered() && !m_pPlayer->HasCityAboutToBeConquered())
		{
			return false;
		}

		if(!GET_TEAM(m_pPlayer->getTeam()).canChangeWarPeace(kHumanPlayer.getTeam()))
		{
			return false;
		}
		// If either of us are locked in, then we're not willing to make peace (this prevents weird greetings and stuff) - we use > 1 because it'll get decremented after it appears the human make peace again
		if(GET_TEAM(GetPlayer()->getTeam()).GetNumTurnsLockedIntoWar(kHumanPlayer.getTeam()) > 1)
			return false;
		if(GET_TEAM(kHumanPlayer.getTeam()).GetNumTurnsLockedIntoWar(GetPlayer()->getTeam()) > 1)
			return false;

#if defined(MOD_DIPLOMACY_CIV4_FEATURES)
		if (MOD_DIPLOMACY_CIV4_FEATURES) 
		{
			// If either of us are locked in war because of a Vassal agreement, then we're not willing to make peace
			if(GET_TEAM(GetPlayer()->getTeam()).IsVassalLockedIntoWar(kHumanPlayer.getTeam()) == true)
				return false;
			if(GET_TEAM(kHumanPlayer.getTeam()).IsVassalLockedIntoWar(GetPlayer()->getTeam()) == true)
				return false;
			TeamTypes eMasterTeam = GET_TEAM(m_pPlayer->getTeam()).GetMaster();
			if(eMasterTeam != NO_TEAM)
			{
				if(GET_TEAM(eMasterTeam).isAtWar(GET_PLAYER(ePlayer).getTeam()))
				{
					return false;
				}
			}
			//We don't want peace with vassals.
			if(GET_TEAM(GET_PLAYER(ePlayer).getTeam()).IsVassalOfSomeone())
			{
				return false;
			}
		}
#endif
#if defined(MOD_BALANCE_CORE)
		int iRequestPeaceTurnThreshold = /*4*/ GC.getREQUEST_PEACE_TURN_THRESHOLD();
		int iWantPeace = 0;
		int iOperationID;
		bool bHasOperationUnderway = m_pPlayer->haveAIOperationOfType(AI_OPERATION_CITY_BASIC_ATTACK, &iOperationID, ePlayer);
		if(!bHasOperationUnderway)
		{
			bHasOperationUnderway = m_pPlayer->haveAIOperationOfType(AI_OPERATION_NAVAL_INVASION, &iOperationID, ePlayer);
		}
		if(!bHasOperationUnderway)
		{
			bHasOperationUnderway = m_pPlayer->haveAIOperationOfType(AI_OPERATION_NAVAL_ONLY_CITY_ATTACK, &iOperationID, ePlayer);
		}
		if(bHasOperationUnderway)
		{
			iWantPeace--;
		}

		if(GetPlayerNumTurnsSinceCityCapture(ePlayer) > 1 && !bHasOperationUnderway)
		{
			iWantPeace += (GetPlayerNumTurnsSinceCityCapture(ePlayer) / 2);
		}
		if(!bHasOperationUnderway && m_pPlayer->GetCulture()->GetWarWeariness() > 0 && m_pPlayer->IsEmpireUnhappy())
		{
			iWantPeace+= (m_pPlayer->GetCulture()->GetWarWeariness() / 10);
		}
		if(GetWarProjection(ePlayer) >= WAR_PROJECTION_GOOD)
		{
			iWantPeace--;
		}
		else if(GetWarProjection(ePlayer) <= WAR_PROJECTION_UNKNOWN)
		{
			iWantPeace++;
		}
		if(GetWarState(ePlayer) <= WAR_STATE_STALEMATE)
		{
			iWantPeace++;
		}
		else if(GetWarState(ePlayer) >= WAR_STATE_CALM)
		{
			iWantPeace--;
		}
		iWantPeace += GetWantPeaceCounter(ePlayer);
		if(iWantPeace > iRequestPeaceTurnThreshold)
		{
			return true;
		}
		else
		{
			return false;
		}
#else
		return bWillMakePeace;
#endif
	}
	return true;
}
 
I suppose it's here :

if(GetPlayerNumTurnsSinceCityCapture(ePlayer) > 1 && !bHasOperationUnderway)
{
iWantPeace += (GetPlayerNumTurnsSinceCityCapture(ePlayer) / 2);
}

So... if there's been more than 1 turn since city capture and the AI has no operation underway, then it's peace desire increases by half the number of turns since city capture ? Is the half rounded in case of an odd number ?
 
I suppose it's here :



So... if there's been more than 1 turn since city capture and the AI has no operation underway, then it's peace desire increases by half the number of turns since city capture ? Is the half rounded in case of an odd number ?

That is a correct analysis, and no, it is not rounded up. So every two turns increases it by a factor of one. That's only one part of the equation, though. And AI operations can be relatively fickle, so there's a need for that longer duration to keep the AI from screwing itself up.

G
 
That is a correct analysis, and no, it is not rounded up. So every two turns increases it by a factor of one. That's only one part of the equation, though. And AI operations can be relatively fickle, so there's a need for that longer duration to keep the AI from screwing itself up.

G

Thanks for the clarification. And what about the immediate decrease in peace desire upon city conquest ? Before it goes up each turn, it has to dramatically go down. Since an AI can be willing to make peace at a given point, but if you take a city from them, they'll become very stubborn. Is the city's population part of the equation ?
 
Thanks for the clarification. And what about the immediate decrease in peace desire upon city conquest ? Before it goes up each turn, it has to dramatically go down. Since an AI can be willing to make peace at a given point, but if you take a city from them, they'll become very stubborn. Is the city's population part of the equation ?

Conquest on either side, regardless of city size, is a soft reset of peace negotiations. Even the smallest city is still a large gain/loss in the grand scheme of civ, so this feels natural.

G
 
Top Bottom