What are the mechanics behind war weariness?

Freaky Freddy

Chieftain
Joined
Jul 18, 2016
Messages
43
Hello,

Does anyone know how war weariness works? Do you get it only from attacking or also from defending? Does it ever go down if you're still at war?

I'm currently suffering -48 happiness from WW alone because i'm stuck in two wars i can't negotiate myself out off, and even though i haven't attacked or have been a attacked for a while it doesn't go down at all.

I went authority and imperialism like a moron and now most of my policies are worthless because they involve me actively attacking things which i can't do if i don't want sink even further into unhappiness.

Is this game over for me? Portugal is sitting at 10k points while i'm around 3k.
 
For every turn in a war you have a chance to get 1 point of WW. The related tenet halves said chance.
You probably can salvage the situation by just building units continuously and send them to the frontline, assuming you you have the 3rd level tent.
 
For every turn in a war you have a chance to get 1 point of WW. The related tenet halves said chance.
.

Isn't it also affected by war score or losing units / cities? If I am not mistaken it only appears after ideologies appear, correct? Thanks
 
If I remember right, it goes up the more you're fighting outside of your own territory/in enemy territory, don't remember which precisely. Win or lose, the longer you're fighting an offensive war, the more weary your people become. In defensive war, they obviously have a bit more vigor and fight in them, which you'll need if you've been forced to fight a defensive war...
 
ok since this question comes up time and again, this is the actual math when you're at war:


//war weariness is asymptotic. for Delay turns nothing happens, then after TimeConstant more turns it affects max/2 % of the population, then asymptotically approaches max %
int iDelay = 8;
int iTimeConstant = 32;
int iMaxPercent = 20;

//simple asymptotic function x/(1+x) mapped to interval [0;100]
int iX = max(0, iMostWarTurns - iDelay);
int iScale = (100 * iX) / (iTimeConstant + iX);

iRisingWarWeariness = (m_pPlayer->getTotalPopulation() * iScale * iMaxPercent) / (100 * 100);


when you make peace, the current value is halved immediately and then starts decaying by a random amount [1:3] per turn.

since you can have multiple wars going the higher number counts (worst peace or worst war).

it'd be great of somebody could put this into the wiki ...
 
ok since this question comes up time and again, this is the actual math when you're at war:


//war weariness is asymptotic. for Delay turns nothing happens, then after TimeConstant more turns it affects max/2 % of the population, then asymptotically approaches max %
int iDelay = 8;
int iTimeConstant = 32;
int iMaxPercent = 20;

//simple asymptotic function x/(1+x) mapped to interval [0;100]
int iX = max(0, iMostWarTurns - iDelay);
int iScale = (100 * iX) / (iTimeConstant + iX);

iRisingWarWeariness = (m_pPlayer->getTotalPopulation() * iScale * iMaxPercent) / (100 * 100);


when you make peace, the current value is halved immediately and then starts decaying by a random amount [1:3] per turn.

since you can have multiple wars going the higher number counts (worst peace or worst war).

it'd be great of somebody could put this into the wiki ...

Wished it happened before ideology at half-effect, and then at ideology for the full effect. Would make making peace with the AIs much faster. ;)
 
Hello, I would like to reopen this topic. I have spent more than 1000 hours in CIV 5, but I just cant find where to mod/change the WarWeariness feature? I just dont like how much it can decrease the happiness and increase the unit production cost. Thx for help
 
Hello, I would like to reopen this topic. I have spent more than 1000 hours in CIV 5, but I just cant find where to mod/change the WarWeariness feature? I just dont like how much it can decrease the happiness and increase the unit production cost. Thx for help
You can turn it off in one of the Core files by setting the WarWearinessModifier to 100. I will tell you which file when I get back to my computer (or you can run a search in (2) CBO)
 
Moderator Action: Quote removed as it was inappropriate. leif

Almost no changes are made only for multiplayer. VP's focus is singleplayer, and G's main objective is to have the best single player experience.
Also, war weariness was initially added as an effect of Ideological influence (concept taken from Civ IV) and was giving huge happiness malus when fighting against someone of your ideology that have some influence over you.
This mechanics was buggy, and when changing the vanilla's supply cap system to current suplly system, the war weariness system was also reformulated to work with it.
Goal was to represent war exhaustion (and discouraging player from exploiting a continuous war against an AI)
It contribute to "nerf wars", and I'm not sure warmonger playstyle particularly need buffs (But maybe I'm missing a completely overpowered pacifist gameplay?)
 
Last edited by a moderator:
ok since this question comes up time and again, this is the actual math when you're at war:


//war weariness is asymptotic. for Delay turns nothing happens, then after TimeConstant more turns it affects max/2 % of the population, then asymptotically approaches max %
int iDelay = 8;
int iTimeConstant = 32;
int iMaxPercent = 20;

//simple asymptotic function x/(1+x) mapped to interval [0;100]
int iX = max(0, iMostWarTurns - iDelay);
int iScale = (100 * iX) / (iTimeConstant + iX);

iRisingWarWeariness = (m_pPlayer->getTotalPopulation() * iScale * iMaxPercent) / (100 * 100);


when you make peace, the current value is halved immediately and then starts decaying by a random amount [1:3] per turn.

since you can have multiple wars going the higher number counts (worst peace or worst war).

it'd be great of somebody could put this into the wiki ...

Thanks for the info @ilteroi! Added to the wiki page.

One question: shouldn't war weariness be worse (i.e. rise more quickly or to a higher max) the lower your WarScore (i.e., when you're losing the war more badly)? Or is that done but elsewhere in the code?
 
OK, I grabbed the code from Github to take a look.

Spoiler :
Code:
int iWarValue = 0;

//War damage should influence this.
iWarValue = (iHighestWarDamage * iInfluenceModifier) / 100;

int iTechProgress = (GET_TEAM(m_pPlayer->getTeam()).GetTeamTechs()->GetNumTechsKnown() * 100) / GC.getNumTechInfos();
iTechProgress *= 2;

iWarValue *= (100 + iTechProgress);
iWarValue /= 100;

int iX = (iMostWarTurns * iWarValue);

iRisingWarWeariness = iX / 100;

if (iRisingWarWeariness > 100)
{
    iRisingWarWeariness = 100;
}

iRisingWarWeariness *= (100 - m_pPlayer->GetWarWearinessModifier());
iRisingWarWeariness /= 100;

...

if (m_iRawWarWeariness < iNewWarWeariness)
{
    float fAlpha = 0.30f;
    m_iRawWarWeariness = int(0.5f + (iNewWarWeariness * fAlpha) + (m_iRawWarWeariness * (1 - fAlpha)));
}

So in the end, the new War Weariness value is a weighted average:
the new War Weariness = (30% x "target" War Weariness) + (70% x its old value).

I'd like to submit that that weight of 30% should depend on how badly you're losing the war.

For example, changing
Code:
float fAlpha = 0.30f;
to
Code:
float fAlpha = 0.20f + 0.20*sqrt(iHighestWarDamage/100.0); //ranges from 0.20 to 0.40, assuming GetWarValueLost scales up to 100
would mean that War Weariness slides down slowly if you're winning (or barely losing), but chugs down at a faster clip if you're losing badly.
 
OK, I grabbed the code from Github to take a look.

Spoiler :
Code:
int iWarValue = 0;

//War damage should influence this.
iWarValue = (iHighestWarDamage * iInfluenceModifier) / 100;

int iTechProgress = (GET_TEAM(m_pPlayer->getTeam()).GetTeamTechs()->GetNumTechsKnown() * 100) / GC.getNumTechInfos();
iTechProgress *= 2;

iWarValue *= (100 + iTechProgress);
iWarValue /= 100;

int iX = (iMostWarTurns * iWarValue);

iRisingWarWeariness = iX / 100;

if (iRisingWarWeariness > 100)
{
    iRisingWarWeariness = 100;
}

iRisingWarWeariness *= (100 - m_pPlayer->GetWarWearinessModifier());
iRisingWarWeariness /= 100;

...

if (m_iRawWarWeariness < iNewWarWeariness)
{
    float fAlpha = 0.30f;
    m_iRawWarWeariness = int(0.5f + (iNewWarWeariness * fAlpha) + (m_iRawWarWeariness * (1 - fAlpha)));
}

So in the end, the new War Weariness value is a weighted average:
the new War Weariness = (30% x "target" War Weariness) + (70% x its old value).

I'd like to submit that that weight of 30% should depend on how badly you're losing the war.

For example, changing
Code:
float fAlpha = 0.30f;
to
Code:
float fAlpha = 0.20f + 0.20*sqrt(iHighestWarDamage/100.0); //ranges from 0.20 to 0.40, assuming GetWarValueLost scales up to 100
would mean that War Weariness slides down slowly if you're winning (or barely losing), but chugs down at a faster clip if you're losing badly.
Assuming that's all of it, maybe update the wiki with the proper information :D? Before my post was removed due to a misunderstanding, I was trying to say that Ilterio's post was way too old to put in the wiki. This thread was made way before WW was reworked to start before ideologies and affect unit supply. I suggest starting a new thread for suggestions.
 
Last edited:
Top Bottom