Hapiness

Magic_gorter

Deity
Civ2 GOTM Staff
Retired Moderator
Joined
Apr 6, 2006
Messages
2,699
Location
Amersfoort (Netherlands)
Does somebody has a list of all playing levels (per government) regarding to hapiness?

To explain more what I am looking for I give just an example (it's probably wrong):
Deity with depotism government: 4 size one cities without unhappy people (red hats)
Deity with monarchy government: 7 size one cities without unhappy people (red hats)

Hope somebody can help me with this issue...
 
Try doing a search of the "riot factor." It also varies with map size (a larger map lets you have more cities).
 
I've done some testing and have come up with a formula to describe the riot factor.

GOV x (RF - (2 x DIF) + LG) = Maximum Number of Cities

where:

RF is the riot factor from the rules.txt (default 14)

DIF is the difficulty level, where:
Chieftain=0
Warlord=1
Prince=2
King=3
Emperor=4
Deity=5
Deity+1= 6
Deity+2=7
Deity+3=8

LG is map size, where
Large=2
Normal and Small=0

GOV is the government type, where

Despotism=1
Monarchy= 3/2 (round down)
Republic=2
Democracy=5/2 (round down)

If the result is 0, then the max number of cities for any government is 1.

According to Slow Thinker, the actual cities that suffer from the riot factor are determined according to their universal city number. Counting with the first city equal to 1, the first cities to suffer from the riot factor will be those whose remainder when divided by the maximum city number (determined from the calculations above) is 0.

For example, the maximum number of cities for a despotism on a large map on deity is (1)x(14-(2x5)+2)=6. If the player in question builds his seventh city, he will begin to suffer from the riot factor. Supposing this is the 22nd city in the game, the riot factor will be triggered for cities 6, 12 and 18, and if he owns any of those cities, they will have 1 extra unhappy citizen.

The next city built will trigger the riot factor in the cities directly ahead of those triggered by the previous city. In our example, if the player builds his 8th city, 23rd in the game, the cities with the numbers 5, 11, 17 and 23 will suffer extra unhappiness (if that player owns any of them) in addition to the cities 6, 12 and 18.

This process continues with cities 4, 10, 16, 22 …, then 3, 9, 15, 21 …., et cetera, until all cities are suffering 1 extra unhappy citizen from the riot factor.

The 13th city will trigger the riot factor again for cities 6, 12, 18, 24 …, and those owned by the player will suffer 2 extra unhappiness. At this point (unless the rules.txt have been changed to give extra content citizens at deity) the cities in question will suffer their first black hat, because there are no default content citizens to make unhappy. The process will again continue until all cities have a black hat (very unhappy citizen).

At the 19th city, the riot factor will start to cause 2 black hats in cities. If the cities are size 1, they will only show 1 black hat, but the use of contentment structures will still require 2 “contentment” to turn the citizen red.


To determine how many extra unhappy citizens will be in each of your cities, use the equation

(NC/MC) – 1 = Extra unhappy citizens per city.

Where
NC is the number of cities you have, and
MC is the maximum number of cities you can have according to the above equation

A resulting fraction will tell you the approximate number of cities that will suffer 1 extra unhappy citizen (depending on how “spread out” your cities are with their numbering).

I’m reasonably confident about this equation in the “relevant range,” which is to say where a subtraction won’t be less than 0. I noticed a pattern with city unhappiness while adjusting the riot factor in the rules.txt, where the maximum number of cities in despotism would vary by 1 for each change of 1 in the riot factor, and there was a pattern in the change of the maxes for other governments with relation to the despotism factor.

The sad fact of the matter is that this information is not very useful. The Find City menu looks like it lists cities in their number order, but it only lists cities that you have discovered (or traded maps for) and would only be accurate if no cities were destroyed. By the time a player might be in a position to use this information, he’ll have other methods in place to deal with the riot factor which will not likely be running on shoestrings. All that can really be done is to found cities on the same turn, and record them, so that there can be some warning about when the riot factor is “creeping up the list” of cities. The only other option I can think of might be to switch between governments on a revolution turn to try to glean information on city numbers based on the riot factor effects on cities in different governments (rather a lot of work for relatively little gain).
 
I don't think the formula is correct.
I did testing at King level on a small map and there the 25th city caused unhappiness and if I fill in your formula

GOV x (RF - (2 x DIF) + LG) = Maximum Number of Cities
1 x (14-(2x3) + 0) = 8 If I'm not mistaken this would mean that city nr. 9 should cause unhappiness...but the test showed me the first unhappy citizen is caused by city 25 (the cities 8,16 en 24 have red hats).

I hope I have soon time to write my testing on this forum of King level and can write it in a nice table....but I still have to figure out how to make a nice table....
 
Do you mean that you have been testing size 1 cities?

If that is the case, for the first citizen to be unhappy in some cities, 25 cities is correct.

King has default content citizens of 3 per city. If you do the tests on larger cities, you should notice that some cities will diminish in happiness much sooner than city 25.

When you test on size 1 cities, you will not notice diminished unhappiness until the first citizen is turned unhappy, yet the riot factor has taken effect long before that.
 
Yes I did size 1 testing. I thought the formula was for size 1 cities.
Please correct me if I'm wrong....if you want to know when your first size 1 city causes unhappiness (so that a size 1 city has a red hat) you must multiply the result of the formula with the default content citizens. So for king (at small map) it will be 8*3=24 so city 25 causes problems.
And for emperor (at small map) it should be 1*(14-(2*4)+0)=6 => with default content citizens =2
6*2 = 12

Perhaps we can combine these results (your formula and the size 1 testing (and mayby more) of different levels) and make a document which we can place in the war acadamy. I understand that it might be difficult to know how much cities there are but after Marco Polo you know all build cities and can find out the right city numbers.

Did you do some testing what happened if a city was destroyed. Do the city numbers shift....so if there are 20 cities and city 10 is destroyed will city 11 become city 10 and 12 will become 11 etc. or will it keep it's original number.
 
Please correct me if I'm wrong....if you want to know when your first size 1 city causes unhappiness (so that a size 1 city has a red hat) you must multiply the result of the formula with the default content citizens. So for king (at small map) it will be 8*3=24 so city 25 causes problems.
And for emperor (at small map) it should be 1*(14-(2*4)+0)=6 => with default content citizens =2
6*2 = 12

Yes, that is correct. "Problems" will start sooner from the riot factor, however, if cities are larger than size 1 and are relying on default content citizens to keep them in order.

Did you do some testing what happened if a city was destroyed. Do the city numbers shift....so if there are 20 cities and city 10 is destroyed will city 11 become city 10 and 12 will become 11 etc. or will it keep it's original number.

I haven't done any testing on this matter yet.

I understand that it might be difficult to know how much cities there are but after Marco Polo you know all build cities and can find out the right city numbers.

I suppose there might be a window of usefullness between Marco Polo's and Mike's.
 
A quick test on the matter of lost/caputred cities indicates that Slow Thinker's ideas on the allocation of the Riot Factor unhappiness is incorrect or at least incomplete. I have found that when a city is captured that should be affected by the riot factor, the next city up the list is affected instead.

More thorough testing is required.
 
I did some more testing of this today, and have discovered an interesting fact: captured cities do not increase unhappiness from having too many cities! They may still suffer from the effects of the riot factor, but they do not add to it. Losing captured cities, even to a different civilization than the one you captured it from, will not reduce your riot factor penalty, but losing cities you founded will. I can only conclude that the game does not "count" your cities, but instead keeps a "riot factor number" and uses that in its riot factor calculations.

I tried switching governments to see if the effect would reset, but it does not appear to do so.
 
If I do understand you correct this happens:
We have city 2,3,4 and 6 (number 1 is first city build and 6 is last). The riotfactor counts for all 6 cities (we don't have 1 and 5) and calculate then the red and black people in the cities you own. IIRC this is mentioned in the thread I mentioned Slowthinker wrote at Apolyton.....

If I'm wrong please mention what I did not understand correctly.
 
I believe that the following formula determines the “base happiness” of a city, which is to say the state of happiness of a city before luxuries, buildings, military units, wonders, and specialists are applied to it.

CiNbr is the universal number of the city in question, counting from 0.

CiOw is the number of cities owned by the player, subject to certain conditions below.

MaxC is the maximum number of cities (based on difficulty level and government), described in a post above.

DfCt is the default content citizens (1 at Deity)

Z = (CiOw – MaxC), if CiOw – MaxC >= 0
Z = 0, if CiOw &#8211; MaxC < 0

Quotient[x, y] is the division x/y, rounded down

Remainder[x, y] is the remainder of the division x/y

Extr = 1, if Remainder[(CiNbr + Z), MaxC] < Remainder[Z, MaxC]
Extr = 0, if Remainder[(CiNbr +Z), MaxC] >= Remainder[Z, MaxC]

DfCt &#8211; Quotient[Z, MaxC] &#8211; Extr = Base Happiness

If Base Happiness is positive, then there will be default content citizens in the city. If Base Happiness is 0, then all citizens will unhappy. If Base Happiness is negative, there will be double unhappy citizens (Black Hats) in the city by default.

The Calculation for Extr (the extra unhappy citizen) has been of the most interest, and is new. If you have the (universal) number of the city, and the number of cities owned by the player, you can find out if the city will suffer the extra unhappy citizen (cities where Extr = 1 will have the extra unhappy citizen).

If CiOw is less than MaxC (not enough cities to trigger the riot factor), then Z will be 0, Remainder[Z, MaxC] will be 0, and it will be impossible any number to be less than that, so Extr will be 0 for all cities, and no cities will suffer from the riot factor.

CiOw is not actually the number of cities owned. Rather, it is increased by 1 every time a city is built by the player, and is decreased by 1 every time a city owned by the player is destroyed. It is also reduced by 1 when a city is disbanded (for any cities processed after the city that was disbanded). CiOw does not change when cities are captured or lost. Finally, CiOw is set to the number of cities currently owned by the player each turn, after all the cities are processed. Essentially, if you capture cites, you will get a turn of production without them adding to your unhappiness; but if you lose cities they will still contribute to your unhappiness during your next turn&#8217;s production.

There are still two problems to be looked at:
How are cities given a city number, and do the numbers change during the game?
How would you go about finding out the numbers of your cities while playing a game?


Example: Deity as the Romans, regular map, despotism. 20 cities (0-19), 5 owned by the Romans (0, 7, 10, 13, 17).

Find Extr (important part)

CiOw = 5 (no cities captured or lost since cities last processed)

MaxC = 4

Z = (CiOw - MaxC) = 5 - 4 = 1

Remainder[Z, MaxC] = Remainder[1, 4] = 1

City 0 (first city built):

Remainder[CiNbr + Z, MaxC] = Remainder[0+1, 4] = Remainder[1, 4] = 1
1 < 1 is FALSE, so Extr = 0

City 0 DOES NOT suffer from the Riot Factor.

City 7 (8th city built):

Remainder[7+1, 4] = Remainder[8, 4] = 0
0 < 1 is TRUE, so Extr = 1

City 7 SUFFERS from the Riot Factor.

City 10 (11th built):
Remainder[10+1, 4] = Remainder[11, 4] = 3
3 < 1 is FALSE, so Extr = 0

City 10 DOES NOT suffer from the Riot Factor.

City 13 (14th built):
Remainder[13+1, 4] = Remainder[14, 4] = 2
2 < 1 is FALSE, so Extr = 0

City 13 DOES NOT suffer from the Riot Factor.

City 17 (18th built):
Remainder[17+1, 4] = Remainder[18, 4] = 2
2 < 1 is FALSE, so Extr = 0

City 17 DOES NOT suffer from the Riot Factor.

Part 2: Romans build 6th City, city 20 (21st city built).

CiOw = 6

MaxC = 4

Z = CiOw - MaxC = 6 - 4 = 2

Remainder[Z, MaxC] = Remainder[2, 4] = 2

City 0:
Remainder[0 + 2, 4] = Remainder[2, 4] = 2
2 < 2 is FALSE, so Extr = 0

City 0 DOES NOT suffer from the Riot Factor.

City 7:
Remainder[7+2, 4] = Remainder[9, 4] = 1
1 < 2 is TRUE, Extr = 1

City 7 SUFFERS from the Riot Factor.

City 10:
Remainder[10+2, 4] = Remainder[12, 4] = 0
0 < 2 is TRUE, Extr = 1

City 10 SUFFERS from the Riot Factor.

City 13:
Remainder[13+2, 4] = Remainder[15, 4] = 3
3 < 2 is FALSE, Extr = 0

City 13 DOES NOT suffer from the Riot Factor.

City 17:
Remainder[17+2, 4] = Remainder[19, 4] = 3
3 < 2 is FALSE, so Extr = 0

City 17 DOES NOT suffer from the Riot Factor.

City 20:
Remainder[20+2, 4] = Remainder[22, 4] = 2
2 < 2 is FALSE, so Extr = 0

City 20 DOES NOT suffer from the Riot Factor.
 
Correction:

DfCt &#8211; Quotient[CiOw, MaxC] &#8211; Extr = Base Happiness is incorrect.

It should be:

DfCt - Quotient[Z, MaxC] - Extr = Base Happiness

I have corrected the original post.
 
This thread looks like good stuff, though I admit I haven't worked very hard at understanding the formulas yet. Is it possible to derive some fairly simple advice from this, for the practical player ?

Also, does anyone have advice about which Wonders work best for celebration, and when they should be built ? I guess the answer may depend on playing level, number of cities, map size, govt, etc so I don't expect a perfect answer. Maybe a few comments comparing HG, Mikes, JSB, CfC, WS would be a good start ?

[Since I play mainly EC, I normally only build HG and/or Mike's]
 
This thread looks like good stuff, though I admit I haven't worked very hard at understanding the formulas yet. Is it possible to derive some fairly simple advice from this, for the practical player ?

Also, does anyone have advice about which Wonders work best for celebration, and when they should be built ? I guess the answer may depend on playing level, number of cities, map size, govt, etc so I don't expect a perfect answer. Maybe a few comments comparing HG, Mikes, JSB, CfC, WS would be a good start ?

[Since I play mainly EC, I normally only build HG and/or Mike's]

Since you cannot turn in a replayed game, I have been practicing for 110 with 109 GOTM. However, unless you ICS it is impossible to get the tenth city without going off the island. This makes it hard to do any practicle comparison testing. Since you are at 20 cities and since it takes into account the AI cities, maybe the AI cities are the recipients of the riot factor.

In Republic IMO you need harbors and maybe temples to allow celebrations and growth. To offset this cost and even the cost of libraries, one would want to build AdamsTP. In monarchy under king three citizens supporting three units will keep happiness equal until 6. In Republic under king, if your luxery is at 50% you have half content citizens, but unless you have food and temples at 6, you have three content citizens but there is also a red one and you cannot celibrate, or there is no food and you cannot celebrate. Since you turned Luxury to 80% it may have allowed celebration, but your science and income were down. It seems that Republic with luxury at 50% has the same effect of producing arrows as a celebrating Monarchy. If you have a celebrating Republic, you also benefit from growing every turn.
 
This thread looks like good stuff, though I admit I haven't worked very hard at understanding the formulas yet. Is it possible to derive some fairly simple advice from this, for the practical player ?

Advice is the tricky part of this. The best piece of advice at the moment is that you have a 1 turn "grace period" if you capture a lot of cities in one turn to set up some extra "happiness help" before the extra unhappiness sets in. The second piece of advice is to check your cities the turn after you make captures to make sure that you are still in balance.

Properly useful advice requires precise knowledge of the city number of each of your cities; then you know where you have to focus the extra contentment efforts for when you build cities. Knowing the exact city number is problematic, because I don't know how city numbers are affected when cities are destroyed, let alone how to determine the numbers for cities in the early game (when the advice is most useful).

Since you are at 20 cities and since it takes into account the AI cities, maybe the AI cities are the recipients of the riot factor.

No. The AI cities will be assessed [I assume] using their own numbers when their cities are processed at the beginning of their respective turns. The universal numbers appear to have been used for one of two reasons (or both): either to make the process seem random or because the program doesn't keep any other number for the city (e.g. a number reflecting its position within the civilization currently holding it).

All the equation really does is provide a way to determine if the city suffers the extra unhappy citizen without making a chart for the purpose.
 
Properly useful advice requires precise knowledge of the city number of each of your cities; then you know where you have to focus the extra contentment efforts for when you build cities. Knowing the exact city number is problematic, because I don't know how city numbers are affected when cities are destroyed, let alone how to determine the numbers for cities in the early game (when the advice is most useful).

Thanks. I don't know anything about city numbers. Maybe someone with hex-editing talents could figure this out ?

I have posted a first draft of some happinness advice in the GOTM 110 spoiler. Since I play mostly quick EC games, there are many Civ2 features I don't know very well [such as Modern WoWs, Demo, etc] and criticism is welcomed. If this stuff proves useful, I'll probably post it more visibly.
 
Also, does anyone have advice about which Wonders work best for celebration, and when they should be built ? I guess the answer may depend on playing level, number of cities, map size, govt, etc so I don't expect a perfect answer. Maybe a few comments comparing HG, Mikes, JSB, CfC, WS would be a good start ?
The wonders are a big part of the joy I receive playing Civ2 and I have thought about them long and hard. One of my back burner projects is to write a comprehensive guide on all Civ2 wonders. I have done it for Copernicus and Newton in a separate thread years ago but not others.

Your list of happiness wonders leaves out Shakespeare and Oracle. I am not sure if that was deliberate or not. Anyway here are some quick thoughts on the happiness wonders:

1. CFC is the modern version of HG. They work identically.

2. When calculating happiness Civ2 treats Michelangelo as a cathedral in the city as opposed to a wonder (which would apply last and thus be more powerful). Oracle is similar to Michelangelo. All other happiness wonders act as wonders and are applied last.

3. Bach is most useful in democracy where every military unit away from home causes two unhappy citizens.

4. CFC and HG work differently from the rest of the bunch. They turn citizens happy. All others make citizens content. CFC and HG help you get into celebrations more quickly. Others let you stay in celebration longer.

5. Suffrage is useless in governments other than Democracy and Republic. Shakespeare is useless in fundamentalism. All others are useful regardless of the government.

6. Shakespeare is the only one of the bunch whose effect is limited to one city. It is an essential wonder in OCC (second most important after Copernicus). It is a useful wonder, but by no means essential, in your SSC if your strategy calls for one. It is also a useful wonder in a super shield city in democracy/republic at war if it is situated such that many units could be homed there.

7. My own feeling is that HG is the best of the bunch. Next are Michelangelo and Bach. In Democracy I prefer Bach to Michelangelo. In all other governments, the other way around. My next pick would be CFC simply because it becomes available later in the game than others. My next choice is Shakespeare (unless I am playing OCC in which case it is most important of the bunch). I rarely build Oracle not because I do not find it useful but because it becomes available at a time that I have more pressing needs and when I could use it in mid game when my cities have temples I rather get Bach. In my opinion the biggest handicap of Oracle is the fact that Theology which makes Bach available makes it obsolete. Suffrage is my least favorite happiness wonder and the only wonder in the game I avoid. (If an enemy city has it, I try to take it as late as possible.)
 
I think I know how city numbers are affected in Classic when a city is destroyed.

When a city is destroyed, all cities have their city number decreased by 1 if their number is higher than the number of the city that was destroyed. The effect happens immediately.

I don't have a civ2 cd with me at the moment, so I can't test MGE. However, based on a thread posted a while back, I think that MGE works like this:

When a city is destroyed, all other cities keep their current number. When a new city is built, it takes the number of a city that was destroyed. (This should be relatively easy to test. Set up a game in MGE with a decent number of cities and destroy one of the cities part way through the list. If the new city appears at the same spot in the list (the city advisor list will do), then this is confirmed).

This result makes a lot of sense to me, given my limited knowledge of computer programming. Algorithms that require checking on all the cities are probably easier to implement if all the cities are numbered consecutively without gaps. It may require a relatively large effort to renumber all the cities when one is destroyed, but cities aren't destroyed all that often.

Once you get to MGE, however, you have to support multi-player on the very slow internet connections of the time. Transmitting the renumbering of cities can then conceivably have a "significant" computing cost, and it would make sense to implement algorithms that can deal with empty spaces in the city list.
 
While playing GOTM 126, I noticed that in some of my cities Michelangelo makes only two black hats red instead of the expected three. I did some search on the forum and found this post by Prof. Garfield that comes closet to an explanation.

I'll explain the way things work (to my understanding) with what I will call the "black hat factor." Each city has a black hat factor given by the equation:

D + RF = BH
Where
D is a constant based on the difficulty level,
RF is the riot factor penalty, and
BH is the black hat factor

On the standard difficulty levels, D is a negative number (-1 for deity, -2 for Emperor, etc.) At deity plus 1 it's 0, D+2 is 1, D+3 is 2 and D+4 is 3.

RF is either 0 or positive, and depends on the number of cities you have.

If BH is negative (only possible in the standard levels), you get default content citizens in your cities. If it is 0, then all citizens are default unhappy.

If BH is positive, there are a couple of possibilities:

If the city population is greater than or equal to BH, then a number of citizens are turned black by default equal to BH, and they are "only" double unhappy.

If there are fewer citizens than BH, all the citizens are turned black, but they will be more than double unhappy. This becomes important if you want to apply "contentment" structures. Before contentment structures can "cure" red hats, the entire "black hat factor" must be overcome. Every specialist and every 2 luxuries reduce the black hat factor by 1, and martial law and contentment structures reduce BF by the number of citizens they make content. In this case, democracy courthouses and Hanging Gardens/Cure for Cancer function as 2 luxuries.
Obviously I am seeing black hats that are more than one degree of happiness removed from red hats. My question is why am I not seeing this consistently?

Here are the details:

I currently have 104 cities in Democracy on Deity level. My max number of cities before riot factor sets in should be 2.5*6=15, but it is instead 2.5*4=10 and has been consistently throughout the game. In other words, I am not getting the benefit of a large map, despite this being on a map with 10K tiles. But that is another question...

Given 10 for max number of cities, and based on the excellent research done by Prof. Garfield and explained in this thread I should experience a riot factor of between 10 and 11 in all my cities which means that every city will get between 8 and 9 black hats. I have verified that this is indeed the case in every city of size 8 and above. Based on the above quote I expect cities under size 8 to have black hats that are more than one degree of unhappiness removed from red hats. While I do have such cities, I also have cities where the black hats are only one degree of unhappiness from reds. Why the inconsistent behavior?

More specifically, I have several cities of size 1 where Michelangelo turns the black to blue (content) and one city of size 1 where Michelangelo turns the black into a red.
 
Top Bottom