[B18] Realistic Starvation

Started by Duncan, April 05, 2017, 04:50:50 PM

Previous topic - Next topic

Duncan

Download Link
Steam link: http://steamcommunity.com/sharedfiles/filedetails/?id=899134090

More realistic starvation numbers. Basically pawns will eat the same amount as usual when food is there, but when they are starving they will starve much more slowly, and suffer severe performance penalties.

I felt that the colonists starve far too fast in the vanilla game. In real life a person can survive 3 weeks without food. This goes up significantly if the person has a lot of body fat. I think the record with vitamin supplements is over a year. Additionally starvation is a crippling illness and the effects should reflect this.   
The hunger/starvation times are as follows (based on default starting hunger, not full) in hours (vanilla/this mod):
hungry - 8/10
very hungry - 12/17
starving(trivial) - 19/32
Minor starvation - 28/70
Moderate - 37/104
Severe - 46/116
Extreme(Unconscious) - 31/176
Death - 64/199

This means a colonist will now die after a bit over 8 days without food, instead of the vanilla 3.

Additional changes
-pawns recover from starvation slower
-pawns recover faster from starvation the more food they get (based on hunger level)
-starvation now comes with severe reductions to disease resistance, move speed and work speed (manipulation)

Update 2017.04.09
-Fixed an issue where food need was not initialised or could become uninitialised, resulting in pawns that were unable to eat and would eventually starve. The issue was rare but seemed to occur more frequently when mod was used with the SK-Hardcore pack

Update 2017.05.22
-Rewrote the mod using the harmony framework eliminating all known compatibility issues with other mods

Update 2017.07.07
-Updated mod to handle faction leaders frozen needs

XeoNovaDan

Could you please do a manual installation version? Maybe something like Dropbox

Dr_Zhivago

Quote from: XeoNovaDan on April 05, 2017, 05:27:42 PM
Could you please do a manual installation version? Maybe something like Dropbox

Click the link called "Download Link"

XeoNovaDan

Oh, thanks xD
Having one of them moments :P

skyarkhangel

#4
In Rimworld, starvation system combines different needs. If human can survive 3-5 weeks or more without food, but without water for no more than three-five days. So to be more precise, the colonists in Rimwold die of dehydration.

Duncan

Good point skyarkhangel. I didn't think of that. And I was going to ask you to put this in your modpack, but I guess you aren't keen.

Well I still prefer it this way. Until thirst is implemented as a proper need it is possible to starve to death on a high rainfall map next to a lake. I really would like to see thirst and water in the game but that is much more effort to implement. This mod was just an evening's work.

Birdy


Razzoriel

Quote from: Duncan on April 06, 2017, 04:51:03 AM
Good point skyarkhangel. I didn't think of that. And I was going to ask you to put this in your modpack, but I guess you aren't keen.

Well I still prefer it this way. Until thirst is implemented as a proper need it is possible to starve to death on a high rainfall map next to a lake. I really would like to see thirst and water in the game but that is much more effort to implement. This mod was just an evening's work.

Makes complete sense, which is why im gonna ask if i can use the mod and incorporate it into Outer Galaxies, a mod compilation+game overhaul under development. Very interesting changes.

Duncan

Feel free Razzoriel. The source for the assembly is included in the mod if you need to modify anything.

Make sure you download the mod again if you already downloaded it, there was an intermittent issue with the first version which has now been fixed.

deshara218

I just spent all week doing permutations through my 60 mods to figure out the source of my "pawns eventually refuse to eat" bug only to find, upon figuring out which combo it is that does it, that when I googled ur mod to find this forum post (smf has garbage search algorithms sue me) and out of curiosity I checked ur steam workshop page you already found & fixed this problem and I missed the tiny announcement at the bottom of your post when I checked for it on Monday ;_;

Fightera100

#10
Is there a way to deactive the mod on an existing colony? Keeps throwing errors at me and could be the source of lag...
Is there like a line in the savefile where I can put the needs to standard again?

Edit: I just managed to delete the mod from the savefile and it seems that my performance got better.
In case anyone wants to do it too first you will need to deactive the mod in Rimworld and then follow these steps:
1. Go to your savefile folder and open the savefile with preferably Notepad++(needs a replace all function or you need to replace a ton of entries by yourself which can take a half hour)
1.1. JUST IN CASE BACK UP YOUR SAVEFILE
2. In Notepad++ press CTRL + H
3. Search for:
<li Class="RealisticStarvation.Realistic_Need_Food">
and replace all with the vanilla one:
<li Class="Need_Food">

It could be true that the mod works fine but it seems that it clashes with one of my other mods

Modo44

This mod generates a constant "animal starvation" alert. I thought it was some conflict, but after removing all other mods, and starting a fresh colony, it still does that. This makes it very tedious to keep track of larger animal farms.

Duncan

Updated mod:

-fixed starving animals alert
-removed debug message for pawns with no hunger need (mechanoids)
-Haplo's Misc. Robots compatibility: robots no longer get hungry

Sorry you went to so much trouble deshara218, I sympathise and regret being the cause. In my defence food is really hard coded in rimworld and most of these bugs are caused by the vanilla code referencing things which bypass the mod, usually bad coding practices. I believe I have fixed all the major examples of that now, the last one being that the the animals starving alert references the variable Pawn.needs.food.TicksStarving which is completely locked down and not accessible to any mod, and is initalised to a massive minus value. The colonist starving alert on the other hand checks Pawn.needs.food.Starving which actually tests if the creature is currently starving. The specific problem you had with the colonists not eating was caused by the weird method that the game uses to assign the food need. It actually checks all of the pawns needs to see if any of the are of the type Need_Food and the assigns the variable when it finds one. Assigning variables based on type checks is bad practice. This means you can override the class and then add it to all the pawns in xml and but it will never get added to their actual food need which is what all other classes access. This means that although they have a food need, they cant eat or starve or be hungry.

All my mod actually does is change some variables, it should have taken 5 minutes to make and been completely bug free on the first try. I guess I shouldn't complain too hard though, this is still an alpha.

marvin__

Quote from: Duncan on May 05, 2017, 06:40:53 PM
Updated mod:

-fixed starving animals alert
-removed debug message for pawns with no hunger need (mechanoids)
-Haplo's Misc. Robots compatibility: robots no longer get hungry

Sorry you went to so much trouble deshara218, I sympathise and regret being the cause. In my defence food is really hard coded in rimworld and most of these bugs are caused by the vanilla code referencing things which bypass the mod, usually bad coding practices. I believe I have fixed all the major examples of that now, the last one being that the the animals starving alert references the variable Pawn.needs.food.TicksStarving which is completely locked down and not accessible to any mod, and is initalised to a massive minus value. The colonist starving alert on the other hand checks Pawn.needs.food.Starving which actually tests if the creature is currently starving. The specific problem you had with the colonists not eating was caused by the weird method that the game uses to assign the food need. It actually checks all of the pawns needs to see if any of the are of the type Need_Food and the assigns the variable when it finds one. Assigning variables based on type checks is bad practice. This means you can override the class and then add it to all the pawns in xml and but it will never get added to their actual food need which is what all other classes access. This means that although they have a food need, they cant eat or starve or be hungry.

All my mod actually does is change some variables, it should have taken 5 minutes to make and been completely bug free on the first try. I guess I shouldn't complain too hard though, this is still an alpha.
Can this be loaded anywhere on the mod list or is it dependent on a specific order?

Modo44

Quote from: Duncan on May 05, 2017, 06:40:53 PM
I guess I shouldn't complain too hard though, this is still an alpha.
You should complain, since you found potential serious bug sources, which your mod illustrated. Stuff like that never gets fixed otherwise.