Community Balance Patch - New Happiness System Explained

The formula has a few parts. It is in C++, so it isn't exactly 'plain english,' so I'll do my best to explain it.

  1. The global output of every city is considered for each yield (Gold, Defense, Science, Culture) and added together into a big pool. Then, the global population of all cities divides the value, giving us the global average per citizen (keep in mind this is only for major civ cities - minors are never considered in this formula).
  2. The value is passed into a median function to find the middle value, and that value is then made gradual (so the global average can only change per turn by a certain % up or down.
  3. Each city grabs this median value every turn, and compares it to their individual output. This value is modified upwards for each player based on the number of techs they know. Right now, the formula for this is: ((# of techs known * 2.6) - 15) / # of possible techs. So, as the game goes along, the % of techs you know increases the global average by a gradually-increasing %.
  4. The global average calculated in step 3 is decreased by buildings, wonders, policies, and traits. Buildings and wonders decrease the global average based on the population of the city. So a larger city with a poverty-reducing building will get more benefit from it than a smaller one.
  5. Once this is calculated, the two values - global median and city average, are compared. If the city average is below the global average at all, 1 unhappiness is made the minimum. For every .4 points of difference between the averages (after the first .4, which is already covered by the minimum of 1 unhappiness), the unhappiness factor increases by 1.

G

Hey, I'd like to chime in a bit here as well. I'm new to the mod, and I admit I haven't read all 5 pages so if I accidentally rehash something that's be said already, I'm sorry!

Alright, so I've been thinking - is it all possible to change the happiness formula in such a way that mostly the national yield rates are taken into account? And that only with advancing eras (and/or tourism?) part of the global average is added to the national rate? Because as it stands, I haven't found a way to found more than 2 expansions (so 3 city total) without descending into madness (-20 happiness or worse) VERY quickly.

Besides, why would my citizens pine away for a mythical far away land that they don't even know exists!

Jokes aside, right now I think you're so at the mercy of your land with close to no way to combat unhappiness if you happen to start with land, which makes you fall behind the global average and little to no chance to come back. This way I could at least try to ICS to my nearest neighbor and rush him with Might units in a desperate bid for more/better land, and at the same time lower the global average!
 
The formula has a few parts. It is in C++, so it isn't exactly 'plain english,' so I'll do my best to explain it.

  1. The global output of every city is considered for each yield (Gold, Defense, Science, Culture) and added together into a big pool. Then, the global population of all cities divides the value, giving us the global average per citizen (keep in mind this is only for major civ cities - minors are never considered in this formula).
  2. The value is passed into a median function to find the middle value, and that value is then made gradual (so the global average can only change per turn by a certain % up or down.
  3. Each city grabs this median value every turn, and compares it to their individual output. This value is modified upwards for each player based on the number of techs they know. Right now, the formula for this is: ((# of techs known * 2.6) - 15) / # of possible techs. So, as the game goes along, the % of techs you know increases the global average by a gradually-increasing %.
  4. The global average calculated in step 3 is decreased by buildings, wonders, policies, and traits. Buildings and wonders decrease the global average based on the population of the city. So a larger city with a poverty-reducing building will get more benefit from it than a smaller one.
  5. Once this is calculated, the two values - global median and city average, are compared. If the city average is below the global average at all, 1 unhappiness is made the minimum. For every .4 points of difference between the averages (after the first .4, which is already covered by the minimum of 1 unhappiness), the unhappiness factor increases by 1.

G


Few thoughts:

For Point #1) Would you consider modifying the code to reflect on a per national average instead? It would put much less pressure on the smaller pop civs.

[if not]

For Point #5) Can you please, please, please, put a max cap on this .4 modification. Say to a max of 5, or better yet a max of X% of the pop. of the city. For example, a city of pop 10 can never have more than 3 unhappiness (i.e. 30%) from one of the unhappiness traits. As it stands now it's can become out of control quite quickly on the higher difficulty settings for this mod.
 
Few thoughts:

For Point #1) Would you consider modifying the code to reflect on a per national average instead? It would put much less pressure on the smaller pop civs.

[if not]

For Point #5) Can you please, please, please, put a max cap on this .4 modification. Say to a max of 5, or better yet a max of X% of the pop. of the city. For example, a city of pop 10 can never have more than 3 unhappiness (i.e. 30%) from one of the unhappiness traits. As it stands now it's can become out of control quite quickly on the higher difficulty settings for this mod.

National averages were too volatile, we found, which is why we have the global average.

The value is capped at the pop of your city, but keep in mind that each citizen in a city can only be unhappy for one thing. So, for example, if you have 5 citizens, and 4 of them are unhappy because of poverty, only one of them can be unhappy about anything else.

The .4 value is moddable - all values for the happiness system are in the cityhappiness.sql file. I might set it back to .5 in the next version - still doing some bugfixing and testing.

G
 
National averages were too volatile, we found, which is why we have the global average.

The value is capped at the pop of your city, but keep in mind that each citizen in a city can only be unhappy for one thing. So, for example, if you have 5 citizens, and 4 of them are unhappy because of poverty, only one of them can be unhappy about anything else.

The .4 value is moddable - all values for the happiness system are in the cityhappiness.sql file. I might set it back to .5 in the next version - still doing some bugfixing and testing.

G


You are right about the cap being the pop of the city, and although that might sound like a solution it isn't.

I just tested this, so here is an actual scenario. It displays the frustration and current issue of trying to recover one's unhappiness when you are in trouble with unhappiness already, because the solution is far down the road and it might not even exist.

City A has a pop of 9. All it produces is food, and has no trade routes, defenses or a garrison. It's unhappiness is: 5 illiteracy, 3 poverty, and 1 unsafe = 9.

You put a garrison into the city and the unhappiness is now: 5 illiteracy and 4 poverty = 9.

Make this scenario complex (i.e. many nested hidden unhappiness traits just ready to surface back to 9 after you "fix" one thing) and you can see that a person can try to throw solutions at the unhappiness problem which might never actually go away.

I hope that helps explain the current problem some of us are having at the higher difficulties with the happiness system.

Furthermore, thanks for the info of where the code is. I might try a few things with it. And as always, awesome mod. And thanks for all the hard work and updates.
 
As usual, you're right about the AI. For the sake of simplicity, I agree. :)

For WileyNg: Don't worry, I understit'sd.
The problem is that the matter is tointellectualicated for a single post and, separated from gameplay mechanics, if we continue, we go far off-topic...
knowledge.an tell you only this:
School histroy books are often based on writings of Historians of the past.
They were often far from rural zones (where the highest price of the war was often paid), linked to powerful men, they could be servile, propagandistic, not objective or just not well informed.
This is the reason for which high school books should not be blindly trusted. There's a huge part of history (the more realistic one) that is studied usually only at university or that can be read on high level texts.
You should take this into account, that's all.

Anyway, I surely don't blame you for getting excited about Homer
(have you noticed my nickname? ;) ).
Your passion can lead you to great results!

Cheers,
Ulixes


Cheers,
I don't know what got you into thinking I took any high school history class. Maybe the way I put my points together appears too juvenile. But all in all this kind of conversation wouldn't happen without Gazebo's great mod. And it's always nice to play a game with CPP once in awhile to renew my history knowledge. That's why I wish CPP can be more historically accurate.
 
Idea for Events & Decisions CPP version:

Add a decision enabling you to spend a sum of Gold to temporarily reduce Poverty in a particular city. Would really help to alleviate the disconnect between having 700+ GPT in the Renaissance while Poverty is by far your number one source of unhappiness.
 
Currently, I think the unhappiness system is broken (this is just strictly testing on marathon - immortal settings).

By the Modern Age with a town pop. of 12 poverty alone can be about 9 unhappiness. I spend about 60% of the game in an unhappy civilization. This seriously affects the enjoyment of the game, since I can no longer expand nor can I wage any wars, since I fear that any of my trade routes from my cities will get pillaged and utterly destroy my fragile unhappiness into utter chaos.

Since unhappiness can be so high for so many factors (namely poverty), on many turns I see happiness jump from +18, +5, -3, +3. It's just stupid and unmanageable.

When choosing ideologies, the penalties are so bad that now in my games all the civilizations will eventually just choose one ideology. As I see it, ideology differences were a part of the game which encouraged conflict between the nations. That is interesting. Now it's to the point where if you don't choose the majority ideology, you will get such a large unhappiness penalty that it makes you have to choose the majority ideology (the last game, I tried to be a rogue and choose one outside of the majority and got hit with a 50 unhappiness penalty, putting me down to -67!).

It shouldn't restrict game play to the point where you can't play the game. It stifles any sort of expansion (a little is good), it stops wars (cause you just can't afford the unhappiness hit of pillaged trade routes), and stops any dynamic game play with monotone ideology choices (my last two games, 19/20 civs eventually choose the majority ideology by the Atomic Age; and in my latest game 8/9 civs just straight out choose the majority ideology when first given the choice, even though they would have gotten 2 free ideologies by choosing the other ones. They obviously knew that unhappiness hit would make gameplay unplayable).

The happiness system is no longer a nice refreshing, and dynamic change to the game, like a hint of cinnamon to a cappuccino, but it has become like putting two tablespoons of cinnamon into a cappuccino and ruining it).

My $0.02.

Last night was the first time since about 4 months of playing this mod probably averagely of a few hours a day, where I even thought of returning to vanilla.

I agree 100%. This new Unhappiness system is absolutely unmanageable. How am I supposed to combat -10unhappiness due to poverty when literally every tile is filled with the appropriate resources, trade routes, ect. It really takes out the fun from playing with this mod, which is otherwise good. Right now I have -27 freken unhappiness which increased from -10 to -27 all in one turn. Please, if there is a workaround to decrease these penalties, that would be great, otherwise I just can't fathom playing like this regardless of how good this project may be.

EDIT: 46 unhappiness from poverty. What in the hell.
 
I've been trying to understand these happiness issues because I haven't been getting any of them. I think it has to do with one of the mods I'm using, tacturns. It has adjusted default values for the various game speeds, and I think these modifiers have a very positive impact on the happiness system somehow. As a shortcut, if you're into playing that sort of a game at least, maybe you guys should check it out? It seems pretty balanced to me really. I tend to play tacturns epic speed with slomo science 20% mod to slow research down a bit more. It gives a nice balance of building times with research costs, and all the modifiers for things like trade routes and religious pressure are balanced. Of all the mods I've tried that attempt to adjust and balance game speed it's the only one that seems pretty accurate and exhaustive with all the adjusted values. You can always use it as a baseline as well and further tweak the values to your preference.
 
I've been trying to understand these happiness issues because I haven't been getting any of them. I think it has to do with one of the mods I'm using, tacturns. It has adjusted default values for the various game speeds, and I think these modifiers have a very positive impact on the happiness system somehow. As a shortcut, if you're into playing that sort of a game at least, maybe you guys should check it out? It seems pretty balanced to me really. I tend to play tacturns epic speed with slomo science 20% mod to slow research down a bit more. It gives a nice balance of building times with research costs, and all the modifiers for things like trade routes and religious pressure are balanced. Of all the mods I've tried that attempt to adjust and balance game speed it's the only one that seems pretty accurate and exhaustive with all the adjusted values. You can always use it as a baseline as well and further tweak the values to your preference.

That outlines a good point, how do you balance a mod that has 10, just a random number, optional recommended mods in it?
 
Idea for Events & Decisions CPP version:

Add a decision enabling you to spend a sum of Gold to temporarily reduce Poverty in a particular city. Would really help to alleviate the disconnect between having 700+ GPT in the Renaissance while Poverty is by far your number one source of unhappiness.


That isn't the solution and would be a temporary patch to a much larger issue that can be solved with a little bit of thought and time. The issue is with the unhappiness algorithm.

Gazbo said he found a bug, so perhaps he is addressing and testing it. Once a good algorithmic solution is in place, you don't need such things.
 
Gazebo I have no idea what you did, but I actually did manage a Liberty 8-city Mayan empire today. The nits and bolts of it was my Religion, offering insane amounts of gold and with finished Piety tree lots of production, happiness and even more gold.

I'll have to test it again with another civ (Maya seems pretty OP to me honestly. Pyramids are insane on their own, and the free Scientist around turn 30 is huge as well, I could neglect Libraries in all cities in favour of production buildings because of Pyramids + Messenger of the Gods and get no Literacy unhappiness).
 
Gazebo I have no idea what you did, but I actually did manage a Liberty 8-city Mayan empire today. The nits and bolts of it was my Religion, offering insane amounts of gold and with finished Piety tree lots of production, happiness and even more gold.

I'll have to test it again with another civ (Maya seems pretty OP to me honestly. Pyramids are insane on their own, and the free Scientist around turn 30 is huge as well, I could neglect Libraries in all cities in favour of production buildings because of Pyramids + Messenger of the Gods and get no Literacy unhappiness).

Glad to hear it. I fixed some bugs and made some tweaks. What was your average happiness?

G
 
Around -7 to -10. It went downwards linearly, until I finished Piety -> +20. Then the wars began, and my happiness slowly went down to ~0 again. Then came Autocracy, and then I started to win the war and the save bugged out (I wrote about that in the Bug Report thread too - have enough culture for policy, but the Policy window doesn't open).

Wide without a Religion and filled out Piety does not work, however. You lack the happiness, GPT, Production, everything. I have now multiple failed attempts as Russia/Polynesia, but hard-building shrines + Messenger of the Gods is not enough to get a religion quickly, neither is Earth Mother. I'll try later as India/Ethiopia, and maybe Rome.

I suspect going wide on Immortal+ is restricted to those Religion civs. Korea might work too due to the Specialist science and Chine due to the Paper Maker. Both of those would need to adopt the Religion of the nearest Neighbor, however.

Quick question, too: How is City Connection gold calculated? It's the one thing that made wide possible to do in BNW.
 
I love this mod so far but I have one issue with it. The target population count for luxury happiness to increase always seems way too high to me. It seems like it's always around three times my current national population, even when I try to grow my cities quickly and I always end up with unhappiness problems. I've adjusted some of the other numbers that you mentioned earlier in this thread to compensate, but I can't figure out how to adjust the numbers for the target population. How would I adjust this?

Also, is there a reason that you set this target population so high? I like the idea of having luxuries "level up" but it seems like it's always way too far out of reach for that to happen.

Thanks!
 
Around -7 to -10. It went downwards linearly, until I finished Piety -> +20. Then the wars began, and my happiness slowly went down to ~0 again. Then came Autocracy, and then I started to win the war and the save bugged out (I wrote about that in the Bug Report thread too - have enough culture for policy, but the Policy window doesn't open).

Wide without a Religion and filled out Piety does not work, however. You lack the happiness, GPT, Production, everything. I have now multiple failed attempts as Russia/Polynesia, but hard-building shrines + Messenger of the Gods is not enough to get a religion quickly, neither is Earth Mother. I'll try later as India/Ethiopia, and maybe Rome.

I suspect going wide on Immortal+ is restricted to those Religion civs. Korea might work too due to the Specialist science and Chine due to the Paper Maker. Both of those would need to adopt the Religion of the nearest Neighbor, however.

Quick question, too: How is City Connection gold calculated? It's the one thing that made wide possible to do in BNW.


I haven't tried the piety tree, but I have had a similar experience with the 03/01 build. Things go great till about Industrial, then same old poverty issues. However, I think I have a solution to the poverty system!


Unhappiness/poverty fix:

Gazebo, make the quota derived from the world average for gold per city/person/whatever calculate BEFORE trade routes are calculated. There done.
 
I have to revise my statement a bit - Wide is possible even without a strong religious civ. You do however need high-production land (i.e. Resources) to make it possible, and a Religion - whether you take your Neighbors or you go Messenger of the Gods yourself, both works (on Immortal). Messenger only gives you last Religion, however.

I just had a very successful 8 city empire as the Huns, all made possible through their unique Improvement which grants lots of Culture, Production and Gold. While consistently behind ~10 techs I did catch up during Industrial, and surpassed every AI by Modern. The production gap dwarfes smaller empires after Freedom and Factories at the latest. Past Economics I made enough gold so that all Poverty problems in all cities were gone, with only sparse usage of Trading Posts.

All in all, wide is possible, and somewhat consistently too - however, it's very heavily dependent on Civilization choice. Due to Specialists a wide empire that doesn't fall behind too far early really takes off in the midgame.
 
I dont know how you guys get so much poverty unhappiness. A simple caravan route removes poverty unhappiness almost entirely from a city. I was also struggling with poverty but i was used to having one city with all the trade routes from there. Big mistake.

For comparison purposes, what difficulty is this on?
 
For comparison purposes, what difficulty is this on?

I play on Emperor(very hard). Happiness is not easy to manage(I barely stay above 0) but its never a huge deal if Im not at war(getting unhappiness from occupied cities or Im getting war weary penalty).
For example, a trade route from the 15pop city, 2-3 villages used by the city and 1 specialist slot filled are enough to keep the pop with no poverty unhappiness.Its reasonable, realistic and most of the time a challenge, but fun!
Yes, across the empire, the number one reason of unhappiness is the poverty one, but those were the times(until modern age) that people were generally poor.
 
Back
Top Bottom