Page 2 of 2

Re: [Mod] Hunger NG: A next generation hunger mod (hunger_ng

PostPosted: Fri Feb 08, 2019 07:23
by Linuxdirk
Please make sure to use the latest available Git versions of Minetest, Minetest Game, Hunger NG, and Hudbars. Make sure that Hudbars runs without any issues, make sure Hunger NG runs without any issues. Then enable both Hudbars and Hunger NG and provide the error message you get. Preferably over at GitLab. Thanks!

Re: [Mod] Hunger NG: A next generation hunger mod (hunger_ng

PostPosted: Fri Feb 08, 2019 14:49
by runs
I use hbhunger with hudbar, and all OK. When I replace to hunger_ng, I get this error:

Code: Select all
2019-02-08 15:47:55: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'hunger_ng' in callback on_joinplayer(): .../games/bogart/mods/hunger_ng/system/hunger_functions.lua:26: bad argument #1 to 'get_player_by_name' (string expected, got nil)
2019-02-08 15:47:55: ERROR[Main]: stack traceback:
2019-02-08 15:47:55: ERROR[Main]:    [C]: in function 'get_player_by_name'
2019-02-08 15:47:55: ERROR[Main]:    .../games/bogart/mods/hunger_ng/system/hunger_functions.lua:26: in function 'get_data'
2019-02-08 15:47:55: ERROR[Main]:    ...games/bogart/mods/hunger_ng/interoperability/hudbars.lua:32: in function <...games/bogart/mods/hunger_ng/interoperability/hudbars.lua:30>
2019-02-08 15:47:55: ERROR[Main]:    /opt/minetest/bin/../builtin/game/register.lua:419: in function </opt/minetest/bin/../builtin/game/register.lua:399>

Re: [Mod] Hunger NG: A next generation hunger mod (hunger_ng

PostPosted: Fri Feb 08, 2019 14:59
by Linuxdirk
Thanks, I'll check this evening.

Re: [Mod] Hunger NG: A next generation hunger mod (hunger_ng

PostPosted: Fri Feb 08, 2019 15:47
by texmex
Have you ever thought of tracking basic nutrients individually? :)

Re: [Mod] Hunger NG: A next generation hunger mod (hunger_ng

PostPosted: Fri Feb 08, 2019 21:58
by Linuxdirk
runs wrote:I use hbhunger with hudbar, and all OK. When I replace to hunger_ng, I get this error:

Found the issue (embarrassing typo) and fixed it. I also fixed the default hunger bar not being removed when enabling the hudbars mod. Just fetch the latest Git versions of everything.

texmex wrote:Have you ever thought of tracking basic nutrients individually? :)

Processing nutrients changes their nutritive value so I need to check that, too. Also I need to get all recipes to check what’s in them and need to check if the ingredients are made from basic nutrients, and so on … So for the sake of simplicity I rather not do this :)

Re: [Mod] Hunger NG: A next generation hunger mod (hunger_ng

PostPosted: Sat Feb 09, 2019 00:44
by Linuxdirk
Attention modders!

The API changed a little. When getting the hunger information using hunger_ng.get_hunger_information you’ll get a slightly altered table back.

Also: all hunger data is now player meta data and no longer custom attributes because with Minetest 5.0.0 custom attributes are to be seen as deprecated!

In addition to that: Some of the (previous) custom attributes (now meta data) were renamed for better handling within the mod. You should not use them anyways :)

Just get the latest Git version and the Minetest 5.0.0 release candidate. An update via CDB will be available soon.

Re: [Mod] Hunger NG: A next generation hunger mod (hunger_ng

PostPosted: Sat Feb 09, 2019 20:24
by Lone_Wolf
This doesn't seem to be working with mobs_animal anymore. I got this mod and mobs_animal from the CDB. I use Minetest 5.0

Re: [Mod] Hunger NG: A next generation hunger mod (hunger_ng

PostPosted: Sat Feb 09, 2019 20:58
by Linuxdirk
Sigh … those Lua patterns driving me insane one day … please get the last version and try. I’ll push a new release to the CDB soon.

Re: [Mod] Hunger NG: A next generation hunger mod (hunger_ng

PostPosted: Sat May 04, 2019 10:36
by sfan5
Right back where we were:
The 30 hud updates per second is too much, you should only call hud_change when the value actually changes.
(Here's how another mod solves this)

Re: [Mod] Hunger NG: A next generation hunger mod (hunger_ng

PostPosted: Mon May 06, 2019 05:42
by Linuxdirk
sfan5 wrote:The 30 hud updates per second is too much, you should only call hud_change when the value actually changes.

The problem is that the value could change all the time with every update. So I either check for changes and always change the HUD depending on the breath status or I add another player value that I need to load and check (and set) all the time.

Just created an issue but how much of a difference does this really make? Is it actually noticeable under real-word circumstances?

Re: [Mod] Hunger NG: A next generation hunger mod (hunger_ng

PostPosted: Mon May 06, 2019 13:33
by sfan5
The "old hud value" would not be stored in a player attribute since it's not persistent.
Comparing an entry in a table every globalstep shouldn't be a problem.

Regarding performance impact, when I tested this in singleplayer it caused 30 hud updates per second (standing still and hunger didn't change).
If you consider a server with 20 players, this would be 600 packets sent per second. Now, any (decent) server network won't have a problem with this (won't be noticeable), but it's still lots of network traffic wasted for nothing.