Villager Comfort

Villager Comfort

2.5k Downloads

Track villager social activity for comfort

cactusdualcore opened this issue · 0 comments

commented

Nobody wants to be alone and left out. Villager comfort should be affected by social interactions.

Too prevent stupid villagers from dying to loneliness, this has a prerequisite on a "want for social interaction" which makes villagers look for nearby villagers to talk to.
For the comfort, I think a X-times-per-last-Y-days should be fine, so the comfort can be calculated like this

$$Comfort = MaxComfort \times \max(1, \frac{Interactions}{MaxInteractions})$$

$Interactions$ is the number of social interactions in the last $DaysTracked$ days and $DaysPassed$ is the number of days the world exists. Note the $\min(DaysPassed, DaysTracked)$ which prevents Villagers from being miserable before the tracked number of days has passed. Or, in code

import java.lang.Math;

private final float MAX_COMFORT_FROM_SOCIAL = 10.0;

float comfort = MAX_COMFORT_FROM_SOCIAL * (interactions / max_interactions);

max_interactions is a constant (or read from the config) and I don't know how to track interactions. Note that villagers should start with a non-zero value for ìnteractions or they'll be miserable in the beginning.