Workers & Resources: Soviet Republic

Workers & Resources: Soviet Republic

View Stats:
dustyd Feb 23, 2024 @ 11:21am
I solved the formula for worker average productivity
The formula for productivity is as follows:

productivity = happiness + (health%*((loyalty-18)/2))

Extra brackets to avoid order of operations confusion. Health should be input as a decimal, meaning 95% health is 0.95

This formula is very consistent with mid to to high loyalty, but drifts by one or two percent of productivity at loyalties below thirty. Subtract 20 instead of 18 if the loyalty is low.

Follow a citizen a bit before doing the math, as they might have a recent event that has changed their happiness, loyalty, or health, but it has not yet been reflected in their "average productivity" stat if they haven't worked yet.

This was done in a town without alcohol or religion buildings, I doubt they would change the formula directly. Also, this gave very consistent meeting of needs, since the demand for both was down to 0%. Your town might be different in this regard and I need more observations.

Questions I don't have the answers to:

Knowing this formula what are the break points for increasing productivity via happiness vs the health hit from using alcohol?
How does the game round off these numbers?
Does the formula hold for very low levels of health? What about if the citizen doesn't have enough food?
Low loyalty citizens are more likely to be low education, is this why a different value has to be used (20 instead of 18) at low loyalty levels?
Maybe other things effect that 18 constant too?
Does this formula change directly for different game difficulties or is the happiness swing the only difference?

If a dev sees this please release the latest table "Price factor thresholds" in the next community update. There are several new commodities missing form the version from community updates 56 and 57.
< >
Showing 1-6 of 6 comments
Silent_Shadow Feb 23, 2024 @ 4:14pm 
Neat.

Originally posted by dustyd:
How does the game round off these numbers?
In my experience the game likes to round for displaying, but the actual decimal is not discarded. I imagine that at least the first two decimals are kept and applied, but honestly the decimals of productivity hardly matter for factory production or service capacity.

Originally posted by dustyd:
Does the formula hold for very low levels of health? What about if the citizen doesn't have enough food?
At low levels of health (< 35%?) citizens will not work at all and below 20% (?) they will require an ambulance to save them. Lacking food lowers health (and happiness and loyalty), so it doesn't really matter.

Originally posted by dustyd:
Low loyalty citizens are more likely to be low education, is this why a different value has to be used (20 instead of 18) at low loyalty levels?
Maybe other things effect that 18 constant too?
Citizens that went to school/university tend to get a loyalty boost from their teachers. So long as your citizens have their needs met, this boost can last a long time (calendar years even).

I think the intent is to bring up freshly turned adults/workers to the average loyalty of a republic with radio/TV, which children cannot enjoy until they become adults and get their own flat. Prisons do something similar.

Originally posted by dustyd:
Does this formula change directly for different game difficulties or is the happiness swing the only difference?
I think only happiness and loyalty losses scale with the citizens reaction setting while the formula remains the same, but I could be wrong.
Last edited by Silent_Shadow; Feb 23, 2024 @ 4:15pm
ling.speed Feb 23, 2024 @ 4:26pm 
At some point i want to figure it out as well, but for now just skimming some of the towns at various difficulties and some excel data i had collected earlier, is close but not quite there, the error on average is about 5% up to like 7-8%, changing 18 to 20 at barely makes a dent. But most of the error seems to be toward calculating higher productivity than whats on the CHE enabled personal window.

If i have time i'll try to see why, One set of data was from very stable (over course of 2 years) but a bit artificial town that i was using to check other things... and looking at the people over few days was barely moving the neddle (biggest changes were after visitig a doc after being sick, but the itself error barely moved).
Last edited by ling.speed; Feb 23, 2024 @ 4:29pm
dustyd Feb 23, 2024 @ 5:30pm 
The 18 to 20 was just at low levels, I think it is more related to something that happened to the individual citizen recently and that 18 is the actual number to use. I wrote down the stats of 50 citizens and using 18 was good for 44 of them. I recorded only the values from citizens who had 70 loyalty and 100 health in the first batch of data so that let me figure out that for them productivity = (happiness + 26) very consistent with only 1 deviation out of the first 30 or so.
ling.speed Feb 23, 2024 @ 6:04pm 
Ok, cheat engine it is... got the adresses of most of the the stuff, but it crashed, and have not time to finish. One thing noticed was that food does go into productivity calculations. I assume we all have it at 100% but worth a note.

Alcochol, crime, culture, clothes, church, sports, electronics, loyality multiplier does not have an impact on the productivity value shown in window (thou it technically could be a factor for actual productivity as these window values are often duplicate equations that can diverge from actual ones over time).

Idk if i'll be able to finish before weekend so leaving this here for now.

ps: oh and as far as i can see there should be no need to wait for citizen to finish work, as its a momentary value anyways (it is refreshed in real time even when game is paused), and likely a non visible decimal points are just shifting around.
Last edited by ling.speed; Feb 23, 2024 @ 6:11pm
ling.speed Feb 23, 2024 @ 10:41pm 
Update, did some calcs to get the feel of how much each need is affecting productivity. Below is list of multiplier for each need:

Happiness 0.8
Food 0.225
Health 0.27
Loyality 0.52

Then the formula for productivity goes like this (divided into 4 lines for clarity):
(1 - 0.8 * (1 - happiness percentage)) *
(1 - 0.225 * (1 - food percentage)) *
(1 - 0.27 * (1 - health percentage)) *
(1 - 0.52 * (1 - loyality percentage)) * 1.5

So in practice the easiest way to think about the multipliers is that they control the penalty to productivity based on how unhappy/unhealthy/hungry/disloyal citizen is.

For example: with 85% food being 15% hunger, it drops the absolute productivity by 15% times 0.225 = 3.3%. The trick is that all the effects are multiplicative and it works off "full" productivity, which is 150%, so the real effect on the number in game will be close to 2%.

Also the game seems to trucate the values in the window rather than rounding it, so each need can be as much as 1% higher, cascading the error calculation error toward lower productivity.

Minimum productivity is 30% (hard cap). There is no upper cap, but all the needs at 100% will give us productivity of 150%. The values are all for Realistic difficulty.

edit: cleaned the equations up
Last edited by ling.speed; Apr 9, 2024 @ 5:57pm
melkij Feb 24, 2024 @ 12:44am 
Originally posted by Silent_Shadow:
In my experience the game likes to round for displaying, but the actual decimal is not discarded. I imagine that at least the first two decimals are kept and applied
I am pretty sure that both the data in memory and the calculations use the usual IEEE 754 floating-point arithmetic. It's a compact representation of fractional numbers, standard CPU instructions, more than enough precision for simulation - there's no reason to use complex (slower) precision calculation formats.
Therefore, the precision is approximately 6 digits (plus the exponent). Rounding is only done during output.
< >
Showing 1-6 of 6 comments
Per page: 1530 50

Date Posted: Feb 23, 2024 @ 11:21am
Posts: 6