I really like FO4 and I’ve spent hours with building up my settlements. It’s bugging me that no matter what I do I have a hard time raising my settlements happiness above the mark of 80. There are already some great posts diving into the details of happiness calculation (like this one) but I couldn’t find the real math behind the calculation of the mysterious happiness value. So I’ve picked up a decompiler and checked into the script files of Fallout 4 v1.3 and these are my findings.
The settlement happiness is calculated via the function DailyUpdateConsumeResources in scripts/workshopscript.pex. The script checks the following conditions for each single human settler and sums up the given happiness value:
- Is there 1 food for the settler? If yes add 20 happiness (happinessBonusFood).
- Is there 1 water for the settler? If yes add 20 happiness (happinessBonusWater).
- Is there a bed for the settler? If yes add 10 happiness (happinessBonusBed).
- Is the bed placed in a roofed are? If yes add 10 happiness (happinessBonusShelter).
- Is the safety rating equal or higher to the total population? If yes add 20 happiness (happinessBonusSafety).
This makes a total of 80 happiness per settler; sounds familiar. The script additionally caps the total happiness of a single human settler.
- If the settler has no water his total happiness is capped at 30.
- If the settler has no food his total happiness is capped at 30.
- If the settlement does not provide safety the total happiness per settler is capped at 60.
The script adds a fixed happiness of 50 for each nonhuman settler and a value called bonus happiness. The bonus happiness is simply the summary of all WorkshopRatingBonusHappiness values of the items the player has built. It looks like only the shops have this value attached to them:
Store type / Small / Medium / Large:
Bar / 15 / 20 / 40
Clinic / 10 / 20 / 30
General store / 10 / 10 / 15
Clothing store / 8 / 10 / 10
Additionally as lunamoonraker noted 10 bonus happiness points are given by the junkyard dog. I found an additional NPC called WorkshopGorilla granting 20 bonus happiness though I’ve not been able to acquire one of the gorillas that can be found in the Institute. I’ve checked some of the other craftable items and none of them provides a bonus happiness value. The chairs, decorations, and lights don’t have any influence on the happiness rating.
The resulting value is divided through the total number of settlers living in the settlement. If all of your settlers needs are fulfilled this means that we end up with a happiness value of 80 plus the bonus happiness of all stores divided by the number of settlers.
Finally the game adds a happiness modifier to the resulting happiness. This modifier is set by quests related to a settlement and has a negative impact in most cases. Additionally each time a settler dies the modifier is lowered by 20 happiness points. Luckily the modifier is capped between -50 and +20 and will be reduced by 20% each day.
And that’s it, no other calculations are done to the happiness rating. This seems to be all of the conditions taken into account when calculating the happiness value. The value is capped between 0 and 100 and the game will add 20% of the target happiness to the current happiness value each game day.
- The productivity of a settlement is set to 25% and raises with happiness up to 100%. The productivity is applied to food, scavenge and vendor production.
- Each brahmin adds 50% additional food production to up to 10 plants.
- Each production will halt if a maximum number of items in the workshop is reached:
Food: 10 + 1 for each settler
Water: 5 + 0.25 for each settler
Scavenge stations: 100 + 5 for each settler
- Brahmins will each produce 1 unit of fertilizer a day to a maximum of 3 fertilizers a day per settlement.
- Unassigned settlers produce 1 unit of scrap each day.
- Settlers assigned to a scavenge station produce 2 units of scrap each day.
- The productivity of a vendor is calculated based upon the total population of the current and all linked settlements.
- Vendors don’t produce an income if the calculated population is lower than 5 settlers.
- Each settler of the calculated population increases the vendor income by 3%.
- Each vendor has a base income per day:
Store type / Small / Medium / Large:
Bar / 1 / 2 / 3
Clinic / 1 / 1 / 1
General store / 2 / 3 / 4
Clothing store / 1 / 2 / 3
Armor store / 1 / 3 / 6
Weapon store / 2 / 3 / 6
- The daily vendor income is capped at 50 caps.
- No new settlers will appear if more than 4 settlers don’t have a job (1).
- The chance to attract a new settler is 10% + 50% * happiness. If a settlement has less than 5 settlers a bonus of 10% is given for each missing settler.
- If a new settler is generated and no brahmin is present there is a default chance of 20% of spawning a brahmin. This value might change per settlement.
- If the new settler is not a brahmin there is a default chance of 20% of spawning a guard. This value might change per settlement. A guard is a settler with increased health points (60 instead of 50) and will be automatically assigned to guard posts.
- If your settlement population is larger than 4 and if there is no synth in your settlement there is a chance of 10% the generated settler is a synth. This value might change per settlement.
- There is a minimum chance of 2% each day a settlement will be attacked. This value is capped, one cannot get a lower chance of attack.
- Each unit of water and food will increase the attack chance by 0.1%. Water and food stored in the workbench are taken into account.
- Each unit of safety will lower the attack chance by 1%.
- Each settler will lower the attack chance by 0.5%.
Notes: It looks like settlers assigned to a trade route are treated like unemployed settlers.
Original Link – Continuation of discussion