1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

War Weariness

Discussion in 'Community Patch Project' started by Buildkirbyus, Jul 5, 2016.

  1. Buildkirbyus

    Buildkirbyus Trainee Modder

    Joined:
    Dec 24, 2014
    Messages:
    159
    Location:
    University Wi-Fi
    I have a few questions on a mechanic i've seen in this community patch. If this has been discussed before and there's a full post about it, please direct me to it.

    The question I have is War Weariness.
    My questions are:
    • What is the formula of War Weariness, and is it the same as Civ IV (adjusted to the new combat rules obviously)
    • When does this come into play? I mostly notice it when Ideologies come into play, but i wanted to ask if it came into play earlier.
    • How does War Weariness decay? Again, is it the same as Civ IV, and what effects it, if any?
     
  2. Funak

    Funak Deity

    Joined:
    Jul 15, 2013
    Messages:
    9,127
    It comes into play after you've got an ideology.
     
  3. Cyberian

    Cyberian Warlord

    Joined:
    Nov 1, 2005
    Messages:
    290
    I have big problems with WW in my current game:
    Spoiler :


    Five turns later I still can't make peace with him and get -117 due to War Weariness.

    Any suggestion what I can do?
     
  4. Funak

    Funak Deity

    Joined:
    Jul 15, 2013
    Messages:
    9,127
    Stop conquering his cities and start waiting for him to be willing to negotiate?
     
  5. Magil

    Magil Monarch

    Joined:
    Sep 26, 2010
    Messages:
    1,618
    Is there a particular breaking point where Civs become willing to negotiate? I executed an extended campaign against Napoleon in one game where he backstabbed me, and started contacting him every turn about 20 turns into the war, looking for peace, but he never became willing to negotiate, even when I reached a war score of 100 or when he was down to 1 city. The war must have taken 30-40 turns to complete and he was never willing to negotiate.

    (And then his vassal, who tipped me off to the attack, was furious with me after I liberated her by eliminating Napoleon and denounced me shortly afterwards, but that's a different issue. And yes, she despised Napoleon as her master.)
     
  6. Funak

    Funak Deity

    Joined:
    Jul 15, 2013
    Messages:
    9,127
    Gazebo posted the code for when an AI is willing to negotiate in another thread. But it being a code means I didn't read it, so I don't know.
     
  7. Moi Magnus

    Moi Magnus Emperor

    Joined:
    Mar 1, 2015
    Messages:
    1,866
    See thread : http://forums.civfanatics.com/showthread.php?t=569652
    If you are able to read code, here it is :
    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;
    }
     
  8. Magil

    Magil Monarch

    Joined:
    Sep 26, 2010
    Messages:
    1,618
    I can't really understand the code very well, but my reading of the thread suggests that an AI will be unwilling to make peace if you're actively taking their cities. Doesn't make a lot of sense to me, if you're losing cities left and right, war score is 100 in the enemy's favor and they have a much stronger military than you, you should be desperate for a peace offer, as soon as possible so you don't lose more cities.

    I suppose this is a design opinion difference. I understand leaders should have pride, but there should also be a breaking point, and I feel max war score is a good one.
     
  9. Gazebo

    Gazebo Lord of the Community Patch Supporter

    Joined:
    Sep 26, 2010
    Messages:
    17,825
    Gender:
    Male
    Location:
    Little Rock
    Close, but the code specifically looks at whether or not the AI has an active military operation. If it does, the assumption is that the AI is attempting to, or about to take the city back. If it does not, it gets one turn to change things before it starts to count towards a desire for peace.

    G
     
  10. Moi Magnus

    Moi Magnus Emperor

    Joined:
    Mar 1, 2015
    Messages:
    1,866
    Translation of the code :

    • If the war began less than 5 turns ago (this value may be changed by CBO), don't peace out.
    • If the AI is about to capture a city, don't peace out.
    • If the peace is forbidden by some treaty, don't peace out.
    • If the peace is forbidden because of the vassals system, don't peace out.
    • Then, if playing with CP only, agree to negociate. If playing with VP (or anything including CBO), you go to the second step.

    Second step :
    You need to have (strictly) more than 4 points to agree to negociate. (This value may be changed by other files).
    • Start with 0 points.
    • War projection : If the AI is winning the war, lose 1 point. If the AI is losing the war, gain 1 point.
    • War state : If nothing happen, lose 1 point. If a lot of fight happen, gain 1 point.
    • If the AI is making a underway operation, lose 1 point.
    • If the AI is not making a underway operation, gain T/2 + W/10 points. Were T is the number of turn since the last city capture (if > 1), and W is the war weariness (if > 0, and if the empire is unhappy)
    • (Edit) Gain a number of point depending of the goal ot the AI (See the function GetWantPeaceCounter for more details).

    Not sure if it is intended, but the AI will never peace out if it has an underway operation, since it cannot collect the 5 needed points.
     
  11. Gazebo

    Gazebo Lord of the Community Patch Supporter

    Joined:
    Sep 26, 2010
    Messages:
    17,825
    Gender:
    Male
    Location:
    Little Rock
    You skipped:

    Code:
    iWantPeace += GetWantPeaceCounter(ePlayer);
    This ticks up every turn that the AI's current war goal is peace. The AI having a wargoal of peace, and the AI being allowed to do so, are not the same.

    G
     
  12. Magil

    Magil Monarch

    Joined:
    Sep 26, 2010
    Messages:
    1,618
    The active military operation part confuses me. I had a different game where I was at war with the Songhai, and after a hard-fought battle, he landed a bunch of troops next to one of my CS allies and seemed to be on the verge of taking the city, then suddenly offered me a white peace. Seems to me he had an "operation" underway to take a CS ally of mine (and was well-positioned to do so), but offered peace anyway. :crazyeye:

    The AI remains as inscrutable as ever to me.
     
  13. Stalker0

    Stalker0 Baller Magnus

    Joined:
    Dec 31, 2005
    Messages:
    6,152
    Let me ask the question, is war weariness / ideology penalty still a good mechanic with the current happiness system?

    I know I'm not the best player, but I am never flowing with happiness towards the end game, and therefore the ideology penalty (even if its small) is always a burden.

    Am I alone in this?
     
  14. Magil

    Magil Monarch

    Joined:
    Sep 26, 2010
    Messages:
    1,618
    I find the opposite, I pretty much never have happiness issues. When I play tall I can practically trade off all my luxuries for gpt and still stay +30-50, and when wide I have so many lux for lux deals going there's no issues. There is sometimes a midgame crunch for happiness, but it's usually easy enough to resolve (the mod tells you exactly what is causing it so you know how to fix it).

    The worst case for happiness for me seems to be when you didn't found a religion, have crappy faith output, have a large empire, and multiple neighbors are spamming missionaries on you. In which case you solve the problem by going rationalism.
     
  15. Moi Magnus

    Moi Magnus Emperor

    Joined:
    Mar 1, 2015
    Messages:
    1,866
    Thanks, I've edited my post.
     
  16. Gazebo

    Gazebo Lord of the Community Patch Supporter

    Joined:
    Sep 26, 2010
    Messages:
    17,825
    Gender:
    Male
    Location:
    Little Rock
    He may not have actually wanted the CS city – in some cases the AI will view a 'neutralized' playing field as a good time for peace.

    G
     
  17. Stalker0

    Stalker0 Baller Magnus

    Joined:
    Dec 31, 2005
    Messages:
    6,152
    50 happiness! Wow, the one time I had +15 in industrial I thought I was doing great:(

    Where is all that happiness coming from? Luxuries to me are only providing 2-2.5 happiness by Industrial phase, do you just have that many?
     
  18. Magil

    Magil Monarch

    Joined:
    Sep 26, 2010
    Messages:
    1,618
     
  19. ilteroi

    ilteroi Prince

    Joined:
    Mar 11, 2006
    Messages:
    341
    interesting point. the operation ends when the troops are in place for the attack. not when the city is captured. maybe that should be reconsidered.

    Sent from my LG-D855 using Tapatalk
     
  20. Gazebo

    Gazebo Lord of the Community Patch Supporter

    Joined:
    Sep 26, 2010
    Messages:
    17,825
    Gender:
    Male
    Location:
    Little Rock
    I'm actually already looking at that, specifically considering changing it to use the 'atriskoffalling' function for cities instead.

    G
     

Share This Page