Mods / HungerTweaks

Tags: #Food #Tweak
Author: GraveCatalyst
Side: Server
Created: Jan 10th at 12:04 AM
Last modified: Jan 13th at 2:00 AM
Downloads: 200
Follow Unfollow 21

Recommended download (for Vintage Story 1.21.0-pre.1 - 1.21.6):
HungerTweaks-1.0.6.zip  1-click install



HungerTweaks

Server-side mod that lets you customize hunger/satiety drain for specific actions and (optionally) scale hunger to match your server’s real-time calendar settings.

SHORT VERSION FOR GENERAL PLAYERS

Installing:

  1. Download the .zip file
  2. Put it in your mods folder
  3. Start your world. This generates your .json file
  4. Exit your game
  5. Open: VintagestoryData/ModConfig/hungertweaks.json
  6. Adjust settings as desired.

  7. Restart the game/server.

Updating:

  1. Move your HungerTweaks.json file out of the Modconfig directory (so you don't lose your custom settings)
    • This mod will not automatically overwrite an existing .json file, so there may be errors or ignored behavior if you don't generate a new .json with the necessary fields

2. Start the game, then exit the game to generate a new HungerTweaks.json file
3. Go into the Modconfig\HungerTweaks.json directory and update to your desired settings

What This Mod Does (by default)

 

  • Less hunger drain while: sitting, sleeping, walking on paths/roads, panning

  • More hunger drain while: sprinting, mining, chopping, digging, fighting/hunting, sneaking, swimming, temporal storms

 

Settings:

The game runs on a simple set of multiplication scalars, so changes to both GlobalMultipler and MonthLengthScaling will likely mess you up; keep it simple and focus on 1.

Find your Hours per game month (if you don't know it already) using this formula:

  • Check Hours Per Day: Type /time hoursperday (or /time hoursperday [amount]) to see how many in-game hours are in a day (default is 24). (X value)
  • Check Days Per Month: Use /wc daysPerMonth (requires admin) to see the in-game month length (default is 9). (Y value)

 

  • Check Time Speed: Type /time speed (or /time speed [amount]) to see how fast time passes; default is 60 (meaning 1 game hour = 1 real-life minute). (Z value)
  • Check Calender speed multiplier: type /time calendarspeedmul (requires admin) to see the ingame calenderspeedmultplier (default is .5). (W value)

 

Formula is:

  •  (X * Y) / (Z * W) = Real life hours per month
    • Set your "MonthLengthScaling" to this value

 

default formula looks like: (24 * 9) / (60 * .5) = 216 / 30 = 7.2

 

Tweak your overall hunger scaling using GlobalMultiplier.

These are common starting points (using 7.2 hours/month as a “vanilla-ish” baseline)

recommended (real life hours per in game month → globalmultiplier value):

  • 3 hours → 2.40

  • 6 h → 1.20

  • 9 h → 0.80

  • 12 h → 0.60

  • 15 h → 0.48

  • 18 h → 0.40

  • 20 h → 0.36

  • 30 h → 0.24

  • 48 h → ~0.15–0.16'

see below for custom values

 

Adjust the .json file as desired for individual action multipliers. You can reference my .json file at the bottom of this description

Compatibility:

There are some mods that adjust hunger as well, IF the other mod makes changes to the BaseRate (in-game character sheet percentage), that % will be calculated into this mod, and will likely make things askew (for example: Walking Stick mod).
This mod should not have any CTD issues as it simply applies a scalar to your hunger ticks


LONG VERSION FOR SERVER OWNERS

Installation

  1. Place the mod .zip into your server’s Mods folder.

  2. Start the game/server once to generate the config file.

  3. Exit the game/server.

  4. Open: VintagestoryData/ModConfig/hungertweaks.json

  5. Adjust settings as desired.

  6. Restart the game/server.

 

Updating

  1. Move your HungerTweaks.json file out of the Modconfig directory (so you don't lose your custom settings)
    • This mod will not automatically overwrite an existing .json file, so there may be errors or ignored behavior if you don't generate a new .json with the necessary fields

2. Start the game, then exit the game to generate a new HungerTweaks.json file
3. Go into the Modconfig\HungerTweaks.json directory and update to your desired settings


What this mod does (by default)

Action-based hunger multipliers

Adjust hunger drain per action so you can:

  • DECREASE drain while:

    • sitting

    • sleeping

    • walking on path/road blocks

    • panning

 

  • INCREASE drain while:

    • sprinting

    • mining

    • chopping

    • digging
    • fighting/hunting

    • sneaking
    • being in a temporal storm
    • swimming

Month-length scaling (optional)

If your server uses non-default “real-life hours per in-game month”, hunger can feel too punishing (or too easy). This mod can automatically scale hunger to better match your time settings—so you don’t end up eating multiple meals per in-game day unless you’re constantly sprinting.


Important notes / limitations

  • Server-only mod. The in-game character sheet “Hunger rate %” may not change and can still display the vanilla values.

  • How to verify it’s working: set debugmode: true in .json. Read debug messages in Logs/server-main.log

  • Detection limitations: the mod uses best-effort checks based on player state and held tool type. Edge cases may not be detected correctly, including:

    • Custom beds not recognized as “beds”

    • Modded tools/weapons that don’t report standard tool types

    • Mods that change sleep/time-skip rules (e.g., one-person sleep): If you use a one-person sleep mod, a player that stays up all night will take a huge hunger hit while the sleeper will be generally fine, so coordinate your sleeping with server mates, or at least give them a warning.

    • modded animal mounts, furniature, and boats may not register properly
  • These values are only recommendations, you can adjust them to your liking to fit your play style or needs.
    • the change in food necessity will alter your gameplay a bit, making it so food security isn't so stressful.
    • If you reduce food consuption requirements, it could make mods that increase food production over powered
    • server owners:
      • you could create events where something makes food consumption go crazy and you increase food needs for a period of time.

How the final drain is calculated

 

BaseDrain is the % in your character sheet's "Hunger Rate %", convert it to decimal, so 100% = 1, 120% = 1.2, and so on.

 
FinalDrain = BaseDrain * GlobalMultiplier * MonthScale * ActionMultiplier * environment
For example: BaseDrain *       .7         *     1      * 0.65(sleeping)   *      1      = BaseDrain * 0.455; this means when sleeping your hunger reduces about 54.5% slower than expected.
             BaseDrain *       .7         *    .48     * 2.75(sprinting)  *      1      = BaseDrain * 0.924; This means when sprinting your hunger reduces about 7.6% slower than expected
                                     (but in this case your MonthScale means your hunger rate is about 52% slower than expected, so while sprinting you are nearly doubling your hunger rate). 

GlobalMultiplier recommendations (real-life hours per in-game month)

These are common starting points (using 7.2 hours/month as a “vanilla-ish” baseline)

If your real life hours per in game month equal:

  • 3 hours → 2.40

  • 6 h → 1.20

  • 9 h → 0.80

  • 12 h → 0.60

  • 15 h → 0.48

  • 18 h → 0.40

  • 20 h → 0.36

  • 30 h → 0.24

  • 48 h → ~0.15–0.16'

 

set your global multiplier to one of these values. If you use custom X hours per ingame month, use the formula below

Custom formula

Choose:

  • BML = Baseline Month Length is what you want hunger balanced around (example: vanilla-ish is 7.2)

  • CML = Custom Month Length is your server’s real-life hours per in-game month

 
 
GlobalMultiplier = BML / CML

Examples (BML = 7.2):

  • CML = 11.5 → GM = 7.2 / 11.5 = 0.626

  • CML = 23.75 → GM = 7.2 / 23.75 = 0.303

  • CML = 48.5 → GM = 7.2 / 48.5 = 0.154


How to find your time scales:

  • Check Hours Per Day: Type /time hoursperday (or /time hoursperday [amount]) to see how many in-game hours are in a day (default is 24). (X value)
  • Check Days Per Month: Use /wc daysPerMonth (requires admin) to see the in-game month length (default is 9). (Y value)

 

  • Check Time Speed: Type /time speed (or /time speed [amount]) to see how fast time passes; default is 60 (meaning 1 game hour = 1 real-life minute). (Z value)
  • Check Calender speed multiplier: type /time calendarspeedmul (requires admin) to see the ingame calenderspeedmultplier (default is .5). (W value)

 

Formula is:

  •  (X * Y) / (Z * W) = Real life hours per month 

 

    • So default looks like: (24 * 9) / (60 * .5) = 216 / 30 = 7.2

MonthLengthScaling settings explained

  • ReferenceRealHoursPerMonth

    • The month length (in real-life hours) you consider “baseline”.

    • If your server is set to 20 hours/month and you set this to 20, the MonthScale becomes neutral (≈1.0).

      • If your server is set to 20 hours/month and you set this to 10, the MonthScale becomes 10/20 = .5 , hunger decreased by 50% (basically half)
      • If your server is set to 20 hours/month and you set this to 30, the MonthScale becomes 30/20 = 1.5 , hunger increases by 50%

 

author's note: I recommend keeping this value equating to 1 and dialing in your scaling through the GlobalMultiplier value above, this can have some significant run on effects if there is even a small miscalculation on your RL Hours per month. 

Because the calculation is a simple series of multiplication, an equation like basedrain x .5 x 4 x 1 x 1 = basedrain x 1 x 2 x 1 x 1 ; so this is to say, adjust either globalmultiplier or monthlengthscale, not both, for simplicity

If you are comfortable managing the month scaling modifer and global modifier, then you can finetune your hunger rates to a higher degree.

 

  • UseWorldCalendar

    • If true, the mod computes actual hours/month from the server’s world calendar settings automatically.

    • Recommended if you may adjust time settings later.

  • OverrideActualRealHoursPerMonth

    • Only used when UseWorldCalendar is false.

    • Lets you hard-code the “actual” month length the mod should use (ignoring world settings).

  • MinMultiplier / MaxMultiplier

    • Clamps MonthScale to prevent extreme values.


Example based on my config settings **I'm still tweaking my settings**

 {
"GlobalMultiplier": 0.35,
  "MonthLengthScaling": {
    "Enabled": true,
    "ReferenceRealHoursPerMonth": 48.5,
           //This equates to roughly 97 minute days, so I have about 46.5 minutes for daylight and 46.5 for nighttime
   
    "UseWorldCalendar": true,
   
    "OverrideActualRealHoursPerMonth": 7.2,
   
    "MinMultiplier": 0.1,
    "MaxMultiplier": 10.0
  },
 
  "ActionMultipliers": {
    "Standing": 1.10,
    "Sprinting": 4.75,
    "Sneaking": 1.75,
    "Sitting": 0.65,
    "SittingMount": 0.8,
    "SittingFurniture": 0.6,
    "Sleeping": 0.50,
    "Swimming": 2.5,
    "Digging": 1.3
    "Mining": 1.25,
    "Chopping": 1.35,
    "HammerUse": 1.4,
    "BowUse": 1.25,
    "WeaponSwing": 1.2,
    "WeaponSwingClickWindowMs": 250,
    "Panning": 0.85,
    "PanningPendingMaxMs": 30000

  "EnvironmentMultipliers": {
    "PathBonusEnabled": true,
    "PathBlockHungerMultiplier": 0.87,
    "PathBonusRequiresMoving": true,
    "PathCodeKeywords": [
      "path",
      "road"
       ],
 
    "TemporalStormMultiplierEnabled": true,
    "TemporalStormMultiplier": 6.0,                        
    "TemporalStormStrengthThreshold": 0.0001
  },
  "DebugLogging": false
}
 

Future update ideas

  • skinning an animal
  • digging with hands
  • currently, only 1 action counts during hunger tick, (most recent action taken); make actions stack (sitting + panning, sprinting + weapon swing)
  • wetness factor
  • see if its possble to make a patch for the carryon mod
  • while spinnig the quern
  • starting a fire

 

(feel free to add suggestions in the comments)

Free Use notification

Anyone is free to use this in mod packs, just give credit please

Mod Version Mod IdentifierFor Game version Downloads Released Changelog Download 1-click mod install*
1.0.6 hungertweaks
1.21.0-pre.1 - 1.21.6
85 Jan 13th at 2:00 AM HungerTweaks-1.0.6.zip 1-click install

ChangeLog:

--Added Digging

  -Digging use to fall under the default weapon swing, but I figured since the ax and picks got their own modifier, why not the shovel.

 

Fixed:

-- Panning logic has been refactored and now works per panning attempt rather than for a duration

     -The original thought process was to change the scaling inside a window (the animation) but there were too many issues with this, so its been changed so that the next hunger check will after activating panning will be a panning actionmultiplier.

-- Weapon swing logic is now more consistant

1.0.5 hungertweaks
1.21.0-pre.1 - 1.21.6
27 Jan 12th at 4:33 AM HungerTweaks-1.0.5.zip 1-click install

Change Log:

-- Updated Panning logic

  • Old: very inconsistant panning logic
  • New: (not perfect) Will now consistantly give panning when standing (not moving) in water with a pan in hand. Even if you aren't actively panning it will still assume panning. I'll try to fix this in a future update

 

-- Added swimming

  • Swimming is considered moving in water/sea-water (only, no swimming in wine) with a water/sea-water block under your feet. If you have the rivers mod installed then simply treading water and letting the current move you counts as swimming.
1.0.4 hungertweaks
1.21.0-pre.1 - 1.21.6
33 Jan 11th at 6:15 AM HungerTweaks-1.0.4.zip 1-click install

Sorry for so many updates, bugs are a pain

Change log
-- Fixed temporal scaling (for real this time)

-- Fixed a bug where sometimes multipliers would stack on ticks instead of remaining on their assiged value

1.0.3 hungertweaks
1.21.0 - 1.21.6
8 Jan 11th at 3:53 AM HungerTweaks-1.0.3.zip 1-click install

--Fixed Temporal storm logic

1.0.2 hungertweaks
1.21.0-pre.1 - 1.21.6
6 Jan 11th at 1:50 AM HungerTweaks-1.0.2.zip 1-click install

Changelog:

--Added pro-pick to mining logic
--Added sitting on furniture to game logic
--Added sitting on animal mounts to game logic
--Added temporal Storm to game logic

1.0.1 hungertweaks
1.21.0-pre.1 - 1.21.6
24 Jan 10th at 1:56 PM HungerTweaks-1.0.1.zip 1-click install

Changelog:

Changed weapon swing behavior
----From: hunger counted while holding right mouse button down
----to: on right mouse button click with a non-specific weapon a timer starts and changes hunger rate while inside that timer window

 

---Added panning: checks for requirements to pan and on right mouse button click, will start a timer and modifies hunger inside that timer window, resetting the timer on a new mouse button click

1.0.0 hungertweaks
1.21.5 - 1.21.6
17 Jan 10th at 12:09 AM HungerTweaks.zip 1-click install

Initial Release

This is a server side mod, however, single player worlds only need to upload it like a normal mod as they are both server and client.


11 Comments (oldest first | newest first)

GraveCatalyst , Jan 12th at 2:09 AM (modified 6 days ago)

Hyomoto I just check compatibility with Walking Sticks mod and it is compatible with my mod, but my mod may not be compatiable (mechanically) with theirs.

Firstly, because my mod does not change ingame hunger rate percetage of the player's character sheet, which is considered the BaseDrain. Walking sticks add a negative modifier to the character's BaseDrain.

Secondly, my mod doesn't register walking as an action, simply standing is the action; the assumption is that walking and standing is similar enough that they might as well be equal (I may revisit this in the future). His mod ONLY changes hunger rates while walking. The only compaitbility issue may be that my mod uses the BaseDrain in its calculation, and the walking stick gives a static -x% to basedrain while holding a stick; this would inturn cause all calculated values in my mod to be slightly lower.

Again, my mod is an after-the-fact multipler on the hunger rate. It is called whenever the game itself calls its "ReduceSaturation" function and (with calculated values) applies the multiplier, which the game does every 2 seconds. I'm going to assume that, due to hunger rate simplicity in changing, that other mods that affect hunger rates will also apply their own multiplier to the hunger rates. Now this could have stacking issues, for example:

HungerTweaks: BaseDrain (1) * .5 * 1 * 1 * 2.75 (sprinting) * 1 = 1.375

HungerTweaks + walking sticks: BaseDrain(.95) * .5 * 1 * 2.75  * 1 = 1.30625

As you can see, walking sticks is not intended to change hunger rates while sprinting, but my mod does force a change. Both mods are server authoritative, so even though walking sticks is meant to prevent that feature, my mod would push it through anyway.

Other mods might work the same way. 

Hyomoto, Jan 12th at 12:50 AM

That's kind of what I meant.  If a mod reduces hunger rate, does it interact with the mod or does yours just completely override them?  For example, walking sticks reduces your hunger rate.  There are CAN jewels that do the same.  I think there might be an xskill skill that does, etc... so if you just wholesale replace it that's an important distinction versus expanding it.  Basically it's a compatability question.

MiraLeaps, Jan 11th at 3:11 PM

Thank you for explaining that. I think I got it dailed in. Great work!

GraveCatalyst , Jan 11th at 3:04 AM (modified Jan 11th at 9:07 PM)

gNecrOz

Its really just a little bit of math

change your player hunger speed to 1 for simplicity

60 minutes X 12 day months =  720 minutes in a month / 60 minutes in an hour = 12 hours per month

7.2 / 12 = .6

Your globalmultiplier should be .6
set ReferenceRealHoursPerMonth to 12

adjust the action multipliers to your prefrence, and use the formula in the description to see what they will be
for example, Baserate x .6 x 1 x 2.75 (sprinting) = 1.65, so a 65% increase in hunger while sprinting or
                     Baserate x .6 x 1 x .45 (sleeping) = .27, so a 73% decrease in hunger while sleeping

gNecrOz, Jan 11th at 2:06 AM

I feel like I need whole ass TEDtalk around hunger drain after trying to read this.

I love it, but I feel my brain is too dumb to comprehend sometimes haha. 

Some of my server Settings w/o this mod.

"playerHungerSpeed": "0.83",

Months = 12 days

Days = 24 hrs // 60 RLM

I would love to use this mod to help manage what feels "natural". So any guidacne there is appreciated.

GraveCatalyst , Jan 11th at 12:41 AM (modified Jan 11th at 3:30 AM)

MiraLeaps your calenderspeedmul makes real life hours correspond to a day length in game. Mine is set to .25 which gives me roughly 97 minutes for a 24-hr period. I'm not sure what a CSM of .1 make it, but there is where the calculations comes in to play. You should do this math:

IRL minutes per in-game 24-hr period x 28 = number of minutes for an in-game month ( rename this value to Z).

Z / 60 = hours in an in-game month (we will call this value K). [Thats how I get 48.5 for my .json file.]

7.2 / K = your GlobalMultiplier

ReferenceRealHoursPerMonth should = K

If you feel like your food rate is not fast enough, increase your globalmultiplier by a little bit.

MiraLeaps, Jan 10th at 10:50 PM

I'm a little confused....our /time csm is .1 and our days per month is 28...what should I put where?

GraveCatalyst , Jan 10th at 6:09 PM (modified Jan 10th at 6:13 PM)

Thank you Hyomoto for your comment. This mod works behind the scenes outside the client, so mods that change or alter food consumption, food timers, or satiety factors do not interact with this mod. This mod only affects the hunger rate calculations done by the server based on the factors specified in the json file. The mod looks for player tags like "mounted to bed" or "holding X item" or "standing in water" or "left/right mouse button click/hold". So mods that alter those types of tags may register or misregister depending on how tags are used. This mod is only multipliers on hunger rates; so if other mods also use multipliers for hunger rate changes, then it could make things out of wack.

Hyomoto, Jan 10th at 3:05 PM (modified Jan 10th at 3:13 PM)

You know, a lot of attempts have been made to make the hunger in this game less ass and I want to say that as a low-cost drop in solution for the largest benefits: aka, the smallest amount of complexity for the largest gain, I think you nailed it.  The problem with hunger is deep, varied and complex.  But ultimately I think the most visible issue is that a Seraph sitting completely motionless will starve to death in twenty minutes.  Even if we assume as large animals they metabolize like jet engines, large animals like elephants do not starve to death within ten minutes of missing a meal.  Hunger has to mean something, and fixing that is a whole other can of worms.  So while I don't think this fixes everything, it provides a gradient that simply tweaking the hunger rate does not and so I think this will be a popular mod barring any unexpected errors.  I'm happy to add it to my list.

That said, I am curious how it will interact with other mods that affect hunger rates like CAN.

GraveCatalyst , Jan 10th at 7:38 AM

You should sit if you afk to reduce hunger consumption. Standing is basically a placeholder, and It was the default that I based the other actions on.

Kompetan, Jan 10th at 7:09 AM

Thank you, it always surprised me how no one made a mod that actually makes sitting consume less stamina, until now at least. Is the behavior where your hunger rate got reduced if you were AFK listed as "Standing" now?