Happiness: unable to stabilize 'number of houses' factor
winex opened this issue · 20 comments
Minecolonies version
minecolonies-1.12.2-0.9.18-ALPHA-universal.jar
Expected behavior
- "Number of houses" is stable (yellow dot) when there are no homeless citizens
Actual behaviour
- "Number of houses" can't be stable (yellow dot) because of #2508, no GUI for managing livings in TownHall.
Steps to reproduce the problem
- build townHall and at least 3 citizen huts
- do nothing, build nothing, only watch happiness stats
- ...
- number of houses will never be stable
- no profit, no fun :(
this blocks Happiness to be stable, as there are always N [=TH-level] homeless citizens, even in automatic assignment mode (should i fix this one first?).
as TownHall is now also a Citizen's Hut after #2130, it's GUI should have and allow to assign citizens.
probably even inventory button should be added because of dumping logic and w/e else.
i'm not the GUI guy, so i need some discussion where it should be placed. thanks.
oh, auto-assigning works. after checking in colony1.nbt i see resident in TH, but i re-launched the game so i don't know if happiness will update w/o restarts. let's test again
btw, is happiness updated at each tick here?
shouldn't it be like
&& shallUpdate(world, CLEANUP_TICK_INCREMENT)
as in above code?Definitely, it should not update each tick, if I get it correctly it gets updated when daytime turns into nighttime. Maybe we can add another check to the else brackets so it gets updated two times per day cycle
should be some helpers funcs like atDayStart(world) and atDayEnd(world) to cleanup this?
btw, waited 2 days, looks like it needs restart/reload to update in auto-housing mode, something is wrong somewhere else. i'm searching...
also, i see lag here:
this stuff shouldn't be run each tick
in auto-housing mode, more homeless citizens = more lag
should i add this, so it will run only once per second for ex.?
world = event.getWorld()
+ check for null, etc
if ( (world.getTicks() % TICKS_SECOND == 0) && ...
@Raycoms sorry, can you point me to an example of mentioned randomizer, so i could track such possible lag issues and try to fix them? thanks.
for now, i found that only Home and Baker (he checks furnaces every tick)
i propose new constant to manage such cases and usage of Colony.shallUpdate()
in such cases
ONWORLD_TICK_INCREMENT = TICKS_SECOND * 1;
is it ok?
/me is working on PR...
I wouldn't worry to much about happiness, because in the new happiness system. It has been completely rewritten.
happiness is updated based on once a day and event driven. The colony and citizens are updated once a day to figure out things that effect citizen and colony long term. Once a day events are like effect of citizen death on the colony long term, citizen without a house long term effect, no job long term and etc.... Event driven are things like the citizen gets hurt and such..
damn, Baker isn't inherited from AbstractBuildingFurnaceUser... someone forgot to use that :(
btw, i thought ONWORLD_TICK_AVERAGE
name is better
so, let's try how PR works :)
i've found that GUI is not updated probably because of:
- BuildingView doesn't serialize HappinessData at all
- server sends HappinessData only if isCitizensDirty
or even if it hasNewSubscribers, but not for old ?
and the last one i've checked by spawnCitizen() - no visual update even after that should be marked dirty
so, it seems to be a client-side GUI/connection bug...
FYI, The new happiness citizen will be ready for check in with in the week. Each citizen has their own happiness data and their gui reflects that. Many of these areas have been deleted or rewritten to handle the new system. I would hold off until the new system is checked in.
I'm in the middle of testing to make sure all the modifiers seem fair and doesn't make the game to easy or to hard.
@bob0bob oh ok, i just didn't know that the code is almost done. thanks man!
@Raycoms, maybe we just should add citizenManager.markCitizensDirty()
after these lines?
minecolonies/src/main/java/com/minecolonies/coremod/colony/Colony.java
Lines 668 to 671 in 17ed344
so at the end of each day at least citizen's data would be sync'ed to clients? if i'm right about this flag.
i'm currently testing singleplayer and noticed some of the stuff is correctly working (server-side i mean), but it's not updated in GUI