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

Post Reply
User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

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

by orwell » Post

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
Attachments
poshud.png
poshud.png (9.87 KiB) Viewed 1121 times
Last edited by orwell on Mon May 20, 2019 09:39, edited 1 time in total.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

gpcf
Member
Posts: 382
Joined: Fri May 27, 2016 10:48
GitHub: gpcf
In-game: gabriel

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

by gpcf » Post

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.

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

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

by orwell » Post

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.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
sorcerykid
Member
Posts: 1841
Joined: Fri Aug 26, 2016 15:36
GitHub: sorcerykid
In-game: Nemo
Location: Illinois, USA

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

by sorcerykid » Post

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).

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

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

by orwell » Post

So, then, I'm looking forward to that.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
sorcerykid
Member
Posts: 1841
Joined: Fri Aug 26, 2016 15:36
GitHub: sorcerykid
In-game: Nemo
Location: Illinois, USA

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

by sorcerykid » Post

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).

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

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

by orwell » Post

Perfect.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

gpcf
Member
Posts: 382
Joined: Fri May 27, 2016 10:48
GitHub: gpcf
In-game: gabriel

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

by gpcf » Post

@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.

User avatar
sorcerykid
Member
Posts: 1841
Joined: Fri Aug 26, 2016 15:36
GitHub: sorcerykid
In-game: Nemo
Location: Illinois, USA

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

by sorcerykid » Post

Sure that's doable. I'm not at home right now, but when I return next week I'll publish it to my repository.

User avatar
BuckarooBanzay
Member
Posts: 435
Joined: Tue Apr 24, 2018 05:58
GitHub: BuckarooBanzay
IRC: BuckarooBanzai
In-game: BuckarooBanzai

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

by BuckarooBanzay » Post

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 :)
¯\_(ツ)_/¯ Not active here anymore, contact me on the minetest discord, irc, lemmy or github (for programming issues)

User avatar
SwissalpS
New member
Posts: 6
Joined: Tue Feb 09, 2016 17:44
GitHub: SwissalpS
IRC: SwissalpS
In-game: SwissalpS

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

by SwissalpS » Post

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)
:D

mase
Member
Posts: 91
Joined: Tue Feb 21, 2017 20:16
In-game: mase

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

by mase » Post

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests