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

User avatar
orwell
Member
 
Posts: 719
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
In-game: orwell

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

by orwell » Mon Nov 05, 2018 22:01

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 (see below)
- Current player position

The "Lag" value is determined by analyzing and averaging the "dtime" value of globalsteps. This value can be used to measure the current server load. The avg value in () is a longer-term average. The max value is constantly decreased by small amounts. This is not synced to the engine's max_lag, because there's no convenient way to get this value.

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
(9.87 KiB) Not downloaded yet
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...
 

User avatar
gpcf
Member
 
Posts: 274
Joined: Fri May 27, 2016 10:48
In-game: gabriel

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

by gpcf » Tue Nov 06, 2018 21:44

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: 719
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
In-game: orwell

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

by orwell » Wed Nov 07, 2018 14:48

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: 861
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

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

by sorcerykid » Fri Nov 09, 2018 11:50

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: 719
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
In-game: orwell

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

by orwell » Fri Nov 09, 2018 14:01

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: 861
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

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

by sorcerykid » Fri Nov 09, 2018 14:30

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: 719
Joined: Wed Jun 24, 2015 18:45
Location: Raxacoricofallapatorius
In-game: orwell

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

by orwell » Fri Nov 09, 2018 18:21

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

User avatar
gpcf
Member
 
Posts: 274
Joined: Fri May 27, 2016 10:48
In-game: gabriel

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

by gpcf » Sat Dec 01, 2018 12:11

@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: 861
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

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

by sorcerykid » Sat Dec 01, 2018 19:09

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

BuckarooBanzay
Member
 
Posts: 127
Joined: Tue Apr 24, 2018 05:58
Location: Switzerland
GitHub: thomasrudin-mt
In-game: BuckarooBanzai

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

by BuckarooBanzay » Sun Dec 09, 2018 17:51

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


Return to Mod Releases



Who is online

Users browsing this forum: No registered users and 7 guests