Page 1 of 1

[Mod] Time, Lag and Position HUDisplay [poshud]

Posted: Mon Nov 05, 2018 22:01
by orwell
Hello again,

This is a small server-side mod which displays the following information on a head-up display in the bottom right screen corner:
- Current game time
- Average and maximum lag time
- Current player position

Image

License: LGPLv2.1
Uses code from minetest_time (kazea's code tweaked by cg72 with help from crazyR and Zeno) and mthudclock (https://gitlab.com/Rochambeau/mthudclock/tree/master, WTFPL)
Depends on nothing.

Download: https://github.com/orwell96/poshud/archive/master.zip
Git: https://github.com/orwell96/poshud

Re: [Mod] Time, Lag and Position HUDisplay [poshud]

Posted: Tue Nov 06, 2018 21:44
by gpcf
You can actually get the max_lag, using this hacky code I found here: https://github.com/Pitriss/overridemodp ... ster/munin

Code: Select all

local status = minetest.get_server_status()
local status_splitted = {}
for k, v in string.gmatch(status, "([_%w]+)=([%+%w%.]+)") do
        status_splitted[k] = v
end
local uptime = status_splitted.uptime
local max_lag = status_splitted.max_lag
Another, different problem, is that max_lag is essentially worthless, since it doesn't say that much about actual server lag.

Re: [Mod] Time, Lag and Position HUDisplay [poshud]

Posted: Wed Nov 07, 2018 14:48
by orwell
I said, there's no convenient way to get this value. I know this approach, and the original unpublished version of this also used this code. I just didn't want to publish a mod that will likely break somewhen in the future.

Re: [Mod] Time, Lag and Position HUDisplay [poshud]

Posted: Fri Nov 09, 2018 11:50
by sorcerykid
gpcf wrote: Another, different problem, is that max_lag is essentially worthless, since it doesn't say that much about actual server lag.
I developed a mod that measures server lag far more accurately than the max_lag value calculated internally by the engine. (including a variety of different metrics like peak lag, mean short-term lag, mean long-term lag, current lag, etc.). It also has an API for use by mod developers. I kind of put the project on hold due to other things in my life at the moment, but I'll try to get it published soon!

PS. Worth noting is that dtime itself is not a reliable nor accurate method for measuring server lag, because it doesn't always correspond to the elapsed time between server steps (I've performed a variety of tests comparing dtime vs minetest.get_us_time).

Re: [Mod] Time, Lag and Position HUDisplay [poshud]

Posted: Fri Nov 09, 2018 14:01
by orwell
So, then, I'm looking forward to that.

Re: [Mod] Time, Lag and Position HUDisplay [poshud]

Posted: Fri Nov 09, 2018 14:30
by sorcerykid
Yes, I've made note to send you a PM when it's ready (I might also get your help testing it with your mod if that's okay).

Re: [Mod] Time, Lag and Position HUDisplay [poshud]

Posted: Fri Nov 09, 2018 18:21
by orwell
Perfect.

Re: [Mod] Time, Lag and Position HUDisplay [poshud]

Posted: Sat Dec 01, 2018 12:11
by gpcf
@sorcerykid: Can you publish the mod, even if it is not ready, so we can reuse the ideas? Otherwise, we might be doing work in parallel, which is a waste of resources.

Re: [Mod] Time, Lag and Position HUDisplay [poshud]

Posted: Sat Dec 01, 2018 19:09
by sorcerykid
Sure that's doable. I'm not at home right now, but when I return next week I'll publish it to my repository.

Re: [Mod] Time, Lag and Position HUDisplay [poshud]

Posted: Sun Dec 09, 2018 17:51
by BuckarooBanzay
I added some settings, configurable hud position, chat-toggle command and mapblock position to your mod.
The changes are split-up in 3 pull-requests:
https://github.com/thomasrudin-mt/poshud

I had a similar mod in planning but adding the features i needed in your mod was easier, thx :)

Re: [Mod] Time, Lag and Position HUDisplay [poshud]

Posted: Sat Oct 26, 2019 18:14
by SwissalpS
I have forked this mod and made a light version without the lag calculations.
Named the branch 'light' and changed the settings to poshud_light....
Thanks.

https://github.com/SwissalpS/poshud/ (checkout light branch)

Re: [Mod] Time, Lag and Position HUDisplay [poshud]

Posted: Mon Feb 22, 2021 20:44
by mase
It would be nice, if the mod would also display the current node name I am pointing to. So it could replace the debug info.