Attacking: win: 2, lose:3
Defending: win: 1, lose:2
Capture unit: 2
Let a unit be captured: 1
Capture city: 6
Hit by nuke: 3
Use a nuke: 12
call this battle WW.
We keep a running total, called team WW.
After each battle, the following is added to team WW:
battleWW * (100+TheirCulture)/(OurCulture+TheirCulture)
where TheirCulture and OurCulture are Plot Culture values. These will be high everywhere except the outer cultural ring of a city, or if the city hasn't popped its borders yet (in which case they will be so low that there seems to be a WW spike for attacking brand new cities.)
If neither side has any culture on the tile, then we can ignore the second factor.
Finally, to determine the war
we see in cities, we add up the Team WWs vs. all the teams we are at war with (call it Active WW), and use the following formula:
ActiveWW*Population/500
For happiness, truncation doesn't happen until all of the anger causes have been summed, so it could happen that two unhappiness causes have non-integral anger values, and then WW could appear to be the ceiling of this formula, rather than the floor.
It can look like there is an era-dependant factor, because there are many more units later in the game, and the cities are bigger, but there isn't anything directly in the code (except for the nuke proviso). I wonder if we'll start with a little war weariness from nukes. (We'll be able to tell from the scoreboard right away when we load the save). That would let us know if we have some war success too.
Defending: win: 1, lose:2
Capture unit: 2
Let a unit be captured: 1
Capture city: 6
Hit by nuke: 3
Use a nuke: 12
call this battle WW.
We keep a running total, called team WW.
After each battle, the following is added to team WW:
battleWW * (100+TheirCulture)/(OurCulture+TheirCulture)
where TheirCulture and OurCulture are Plot Culture values. These will be high everywhere except the outer cultural ring of a city, or if the city hasn't popped its borders yet (in which case they will be so low that there seems to be a WW spike for attacking brand new cities.)
If neither side has any culture on the tile, then we can ignore the second factor.
Finally, to determine the war

ActiveWW*Population/500
For happiness, truncation doesn't happen until all of the anger causes have been summed, so it could happen that two unhappiness causes have non-integral anger values, and then WW could appear to be the ceiling of this formula, rather than the floor.
It can look like there is an era-dependant factor, because there are many more units later in the game, and the cities are bigger, but there isn't anything directly in the code (except for the nuke proviso). I wonder if we'll start with a little war weariness from nukes. (We'll be able to tell from the scoreboard right away when we load the save). That would let us know if we have some war success too.