A lag detector

CTMN
Member
 
Posts: 113
Joined: Sat Aug 25, 2012 15:02

A lag detector

by CTMN » Thu Sep 27, 2012 12:47

There should be something like a lag detector that shows if theres a lag(I mean the multiplayer server lags).

I lost lots of things in lags and Im tired of losing things again in lags.
 

User avatar
VanessaE
Member
 
Posts: 3894
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaEzekowitz

by VanessaE » Thu Sep 27, 2012 19:57

+1
You might like some of my stuff:
Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (16-512px)
Tips (BTC): 13LdcdUFcNCFAm7HfvAXh5GHTjCnnQj6KE
 

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Thu Sep 27, 2012 21:20

well this would be quite interesting, there are multiple aways to detect this. What is lag anyways, you should ask yourself? The delay in communication between the client and the server? If that is your definition of lag then there should be a node that changes from black to white every second (serverwise) to show you what your client is recieving from the server.

Another way you could go about this is with a pingputer. A pingputer is a way to calculate the delay of time in between a client doing something and a server actually registering what happens. This could be really easy or really difficult depending on how in depth you want to go for detecting lag, but the simplest thing i can think of at the time of writing this is a white block with the word "Sleep" on it, and when you hit it, it turns black and has the word "Active" on it for aproximately 1 second. With that you'd be able to calculate how much a server is lagging based on the delay of time of you hitting the block and the block staying "active"

A different form of the pingputer could also be a simple forumspec, just one box where you can put your items in (kind of like a 1 slot chest) and see how long it takes for the server to register that you've put an item in the pingputer. now this should not eat your item because chests normally don't eat items if you have less than 10 different items in it, hence the 1 spot lag detection.

A ping command would be the simplest though, you could go /ping and the server could return "PONG!", this is used in minecraft bukkit servers and a lot of chat-encorperated multiplayer servers. BUT a more complex version of this could be a /calcspeed command. It could detect the delay clientside if that would even be possible, and tell the client what the lag is, or a connection speed on a scale of 1-10. So it would send back "Connection Speed: 6" or something.

Anyways that's my thoughts on that. Any better ideas out there?
If you can think it, you can make it.
 

User avatar
VanessaE
Member
 
Posts: 3894
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaEzekowitz

by VanessaE » Thu Sep 27, 2012 23:25

It need not be anything complicated since the server and client are in constant communication anyway. I don't know what all the server sends to the client, but surely you can take advantage of the existing packet flow:

Measure the time between adjacent packets in the server's "keep alive" stream (it does seem to have one if you look at the profiler graph while the client is idle). Keep variables indicating the current, minimum, and maximum times measured between packets of that type. Update these variables on every received packet.

Measure the elapsed time from the moment of the most recent player action to the moment the client receives the server's response to that action. Keep variables indicating the current, minimum and maximum times. Update these variables every time the client receives a server response to an action.

Add the two above minimum times. The result is your best packet time.

Add the two above maximum times. The result is your worst packet time.

Add the current received packet time to the current action response time.

Compute the difference between this summed current packet time and the summed minimum time.

Keep a running average of this difference, integrated over the last 5 or 10 seconds' worth of measurements. This is your lag time.

In the F5 "debug" output, display the current difference average as the amount of lag, in seconds, rounded to the nearest 1/10 second. Update the display once per second as long as it's visible.

Put all of the raw values into one of the F6 profiler pages.
You might like some of my stuff:
Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (16-512px)
Tips (BTC): 13LdcdUFcNCFAm7HfvAXh5GHTjCnnQj6KE
 

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Thu Sep 27, 2012 23:39

VanessaE wrote:It need not be anything complicated since the server and client are in constant communication anyway. I don't know what all the server sends to the client, but surely you can take advantage of the existing packet flow:

Measure the time between adjacent packets in the server's "keep alive" stream (it does seem to have one if you look at the profiler graph while the client is idle). Keep variables indicating the current, minimum, and maximum times measured between packets of that type. Update these variables on every received packet.

Measure the elapsed time from the moment of the most recent player action to the moment the client receives the server's response to that action. Keep variables indicating the current, minimum and maximum times. Update these variables every time the client receives a server response to an action.

Add the two above minimum times. The result is your best packet time.

Add the two above maximum times. The result is your worst packet time.

Add the current received packet time to the current action response time.

Compute the difference between this summed current packet time and the summed minimum time.

Keep a running average of this difference, integrated over the last 5 or 10 seconds' worth of measurements. This is your lag time.

In the F5 "debug" output, display the current difference average as the amount of lag, in seconds, rounded to the nearest 1/10 second. Update the display once per second as long as it's visible.

Put all of the raw values into one of the F6 profiler pages.

build it, test it, save it, commit it, party
If you can think it, you can make it.
 

User avatar
RabbiBob
Member
 
Posts: 335
Joined: Sat Jan 28, 2012 22:40

by RabbiBob » Fri Sep 28, 2012 00:43

My mind goes right to the Valve NetGraph.
 

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Fri Sep 28, 2012 01:03

RabbiBob wrote:My mind goes right to the Valve NetGraph.

that's seeming to be a great idea, i have a strange, strange idea to base that on
If you can think it, you can make it.
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Fri Sep 28, 2012 01:15

You can just get a tree, put it in your craft area, and see how long it takes for wood to appear in the output box.

However, i think the OP wants an indicator to tell them the server is lagging without them having to check every 2 minutes.

When you press F5 twice, in red at the bottom is says "client received packets". If none are coming through then its lagging.
 

User avatar
Echo
Member
 
Posts: 121
Joined: Tue Jul 31, 2012 08:11

by Echo » Fri Sep 28, 2012 09:17

I don't know if it could work, but is it possible to use "register_globalstep" get the current time (minetest.env:get_timeofday()) save the value for the next globalstep and detect the difference between both "timestamps"?
It wouldn't detect lags for client server communication, but if the server gets slow.
 

irksomeduck
Member
 
Posts: 224
Joined: Tue Aug 28, 2012 21:45

by irksomeduck » Fri Sep 28, 2012 18:34

My suggestion is-
1. Look at the top bar of screen
2. Look at FPS clock
3. If it's under 10 FPS, you probably have lag

Sources- Personal experience
I love exploring minetest worlds :D
If you have a good seed let me know
--------------------------------------------------
My world/house pack- http://minetest.net/forum/viewtopic.php?id=3066
 

User avatar
Menche
Member
 
Posts: 994
Joined: Sat Jul 02, 2011 00:43

by Menche » Sat Sep 29, 2012 00:59

I usually use /status to see if a server lags. A simple command like that should complete almost instantly, if it takes longer than half a second its lagging.
An innocent kitten dies every time you top-post.
I am on the Voxelands Forums more often than here.
Try Voxelands (forked from Minetest 0.3) by darkrose
 

CTMN
Member
 
Posts: 113
Joined: Sat Aug 25, 2012 15:02

by CTMN » Sun Sep 30, 2012 14:49

I know too that there are such methods, but I wanted a light that appears on tne screen and that blinks when the server changes the light. Or a symbol that shows if the server lags.

I have the problem that my server always sends messages and such things, but it doesn't see it if I remove or place a block. That's what means "lag" for me. I never saw a server sending NO packets, even during real lags(there are always red lines moving and there's always a number above 0).
 

User avatar
jordan4ibanez
Member
 
Posts: 1865
Joined: Tue Sep 27, 2011 18:44
GitHub: jordan4ibanez
IRC: jordan4ibanez
In-game: jordan4ibanez

by jordan4ibanez » Sun Sep 30, 2012 19:15

Here, a lag tester
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_chatcommand("ping", {
    params = "",
    description = "Test the lag",
    privs = {},
    func = function(name, param)
        minetest.chat_send_player(name, "Pong!")
    end
})
If you can think it, you can make it.
 

CTMN
Member
 
Posts: 113
Joined: Sat Aug 25, 2012 15:02

by CTMN » Tue Oct 02, 2012 10:16

Is it for the client or the server? I know plain NOTHING about Lua or the api.
 

User avatar
Calinou
Member
 
Posts: 3124
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou

by Calinou » Tue Oct 02, 2012 10:36

irksomeduck wrote:My suggestion is-
1. Look at the top bar of screen
2. Look at FPS clock
3. If it's under 10 FPS, you probably have lag

Sources- Personal experience


Lag != slow performance.

Anyway (in reply to VanessaE's post), I think the current FPS count and ping time should be shown on the bottom right of the screen (so that you can see your FPS while you're in fullscreen).
 

LazyJ
Member
 
Posts: 479
Joined: Wed Sep 12, 2012 12:29

by LazyJ » Tue Oct 02, 2012 12:53

Calinou wrote:
irksomeduck wrote:My suggestion is-
1. Look at the top bar of screen
2. Look at FPS clock
3. If it's under 10 FPS, you probably have lag

Sources- Personal experience


Lag != slow performance.

Anyway (in reply to VanessaE's post), I think the current FPS count and ping time should be shown on the bottom right of the screen (so that you can see your FPS while you're in fullscreen).


Yes, a small FPS/Ping indicator in fullscreen mode would be nice.
.: Minetest 0.4.14 ~ Linux Mint ~ A moka pot, a French press, a dirty coffee cup, and a spoiled-rotten kitty :.
Visit our Minetest server at: LinuxGaming2.com, port 30000
Screenshots, overview maps, and server info at: http://forum.minetest.net/viewtopic.php?f=10&t=5684
My blog: http://lazyjminetest.blogspot.com/
 


Return to Minetest Features

Who is online

Users browsing this forum: No registered users and 9 guests

cron