question about lag: causes and effects

Help with Setup, Hardware, Performance or other Issues...Or just pimp your rig.
Post Reply
User avatar
sn0w_m0nkey
Private First Class
Private First Class
Posts: 293
Joined: Tue Dec 24, 2002 4:26 pm

question about lag: causes and effects

Post by sn0w_m0nkey »

hi, i'm hoping the dev's could shed light on this scenario.

consider "player A" located physically close to a server, say in the same country, whose lagstats reflect 50 ms +- 10 ms.

question: does this mean that the player A's line varies from 40 to 60 ms? does this also mean that "player A" true lag is 20% inaccurate?

now consider "player B" on same server with 150 ms +- 2ms. this player seemingly has better line stability from this lagstat would you say? because "player B" true lag is 1.3% accurate?

what is the source(s) for "player A" high variance with seemingly low lag ping? would it be fair to say "player A" has an advantage over "player B"?

thank you for any discussion on this topic.

sm
oi!
User avatar
bzflaginator
Private First Class
Private First Class
Posts: 275
Joined: Sun May 01, 2005 1:50 am
Location: Upstate, New York, USA
Contact:

Post by bzflaginator »

I wouldnt call it an advantage...but "player B" will have a slightly greater margin for error. The inaccuracies of +- are silly. If you play someone with 50 ms +- 10ms its going to be like playing yourself (player B) at 150ms +- 0ms even. Someone with 50ms and no jitter is very good for them because it makes them harder to hit because their ping time is quite good compared to yours. Really though, on most servers this wont matter if you have 50ms +- 10ms and 150ms +- 2ms but if there is an issue and you are speaking "hypothetically" then maybe you should just come out right and tell the reason you ask :P. Maybe someone can resolve the issue.
Image
Image
"He that falls in love with himself will have no rivals."
Image
Image
User avatar
sn0w_m0nkey
Private First Class
Private First Class
Posts: 293
Joined: Tue Dec 24, 2002 4:26 pm

Post by sn0w_m0nkey »

not hypothetical at all, its more like an every day scenario when playing on servers across the ocean in europe.

what i'm trying to get here is the magnitude of the player A variance in lag versus player B lag ping.

certain players often say i'm laggy, on my stable line i get 160 +- 2ms (which i think i darn good), and they have stats similar to player A. on my home line + wireless i get 180 +- 3ms with about 1% packet loss, not so great i know...

also what i'd like discussed is: are there advantages to either player or disadvantages? i think for competition players in particular, its important to truly understand lag, its effects and possible causes besides being on the other side of the planet.

thanks,
sm
bzflaginator wrote:I wouldnt call it an advantage...but "player B" will have a slightly greater margin for error. The inaccuracies of +- are silly. If you play someone with 50 ms +- 10ms its going to be like playing yourself (player B) at 150ms +- 0ms even. Someone with 50ms and no jitter is very good for them because it makes them harder to hit because their ping time is quite good compared to yours. Really though, on most servers this wont matter if you have 50ms +- 10ms and 150ms +- 2ms but if there is an issue and you are speaking "hypothetically" then maybe you should just come out right and tell the reason you ask :P. Maybe someone can resolve the issue.
oi!
User avatar
bzflaginator
Private First Class
Private First Class
Posts: 275
Joined: Sun May 01, 2005 1:50 am
Location: Upstate, New York, USA
Contact:

Post by bzflaginator »

Well, of course there is that advantage for the players in Europe because they have the most central location and most near to the best servers. For me, on my home line with my wireless G, I get around 130ms +- 3ms and I live near the East Coast, but thats because Im sure I have a good ISP. And of course for those Duc, GU, pillbox league players it is frustrating in a match when your ping time isnt up to par against the others. I do find it hard to kill someone with an excellent ping time. For me, during a GU match I often find myself going against "player B" with 30 to 50ms with +- 0 to 1. In my case I have around 130 to 150ms with +- 3 to 4 ms. I notice that its almost like the opposing player has a thin tank cheat but that is not it at all. You are on the receiving end and you can not get your packets as quickly as "player B".
Image
Image
"He that falls in love with himself will have no rivals."
Image
Image
User avatar
Saturos
Art Master General
Art Master General
Posts: 1111
Joined: Mon Apr 19, 2004 2:48 pm
Location: Berlin/Germany
Contact:

Post by Saturos »

Just from my personal experience... I would rather play the guy with 150ms +-0 than the one with 10ms jitter... while lag is predictable (just shoot earlier) I cant predict the side-effects of jitter. Jitter's effects are more random than simple lag.

Packet loss is a different story though.
User avatar
sn0w_m0nkey
Private First Class
Private First Class
Posts: 293
Joined: Tue Dec 24, 2002 4:26 pm

Post by sn0w_m0nkey »

good discussion :) thanks guys!

like bzflaginator, from this end sometimes it does feel like they have thin tanks over there, but its been my thinking that my lag gets those packets back here later as described. when fighting tanks with 30-50 +- 10 ms however, i feel almost cheated in that the bullet seems to hit me before i think it arrives. so very difficult at times.

sat: i know the source of my packet loss, wireless at my home is located at back of house. going to buy longer cable soon to locate router closer.

however, i still seek an interpretation on magnitude of these stats:
does a 50 +- 10 ms player have a more inaccurate ping than player
with 150 +- 2?

and why do players with such low lag have such high line variation, even greater than a player across the planet?
oi!
User avatar
Chestal
Dev Guru
Dev Guru
Posts: 171
Joined: Fri Dec 06, 2002 11:56 pm
Location: Siegen, Germany
Contact:

Post by Chestal »

Some informaton on how the two lag numbers are measured:

The big number (latency) is measured by sending a special MsgLagPing packet from the server to the client (player), typically every 10s. The client will simply reply with an echo packet back to the server. The total round trip time is then used in the server to calculate the average latency (using an adaptive exponential smoothing, i.e. the value is an average of all measurements but with the newest measurement having the highest impact).

The +/- (jitter) value is measured differently. Each position/speed update packet the client sends to the server contains a relative timestamp, i.e. the time that has elapsed since it sent the last packet. On receiving such a message, the server compares the delta t from the message with the measured delta t on the server side. Ideally, these two values are identical, meaning no jitter. The absolute difference is averaged (again using adaptive exponential smoothing) and displayed as +/- value in lagstats.

So, what does it mean? The latency value is an estimation of the delay at which you observe the other player and he observes you (actually, it's the average of your own and the other player's latency, and that is only true if the latency for player->server and server->player is the same). As long as the jitter value is 0, the actual driving path of the other player will match what you see 100% - but with a delay. Movement should look smooth.

When there is jitter it means that the information about the other player's position are not received in the correct relative time. The effect is that the player's movements do not look smooth, but there might be small jumps observed. If the jitter is both ways for the player (only player->server is measured), that player would also see everyone else as a little jumpy.
The jitter could be compensated on the receiving end, and bzflag had some code do it actually but it obivously didn't work so well in the past and was deactivated. The current development version might have something like it again, I haven't been foloowing closely.

About the numbers: 50+-10ms means an average latency of 50ms and an _average_ deviation of 10ms. For this low a latency that means that the jitter is extremely high. Using the assumption that packets go as fast in both directions (possibly not true for many kinds of internet access), it would mean that it takes 50ms/2 = 25ms for a packet to go from the client to the server on average. But the average deviation of that time is 10ms. To know what that means, you would actually have to know the distribution of these values. If there are a lot of packets which have a delay of 15-35ms, there must also be some with an even greater spread. This might be a factor of 2 off, I would have to look at the actual code to see it exactly.

The actual observable effect of lag can be quite complex if you keep in mind that the measurements are only averages and do not differentiate between the sending direction (in the case of latency) or do not even capture the server->client direction (in case of jitter).

Also note that the exponential smoothing is done as new numbers come in. For the jitter value that means that when packets are sent at a high frequency (when the player makes a lot of movement changes), the average covers a smaller time period.

I have also noticed that a lot of players with very low latencies have a relative high jitter value. I do not know why this is so, it might depend on the type of internet access they are using, I really don't know.
User avatar
sn0w_m0nkey
Private First Class
Private First Class
Posts: 293
Joined: Tue Dec 24, 2002 4:26 pm

Post by sn0w_m0nkey »

excellent Chestal, Thank you.

the jitter concerns me more than my lag from such a far distance (i would expect the higher lag).

something that i experience on this end is that the bullet seems to arrive quicker than expected. for example; timing of when i jump to avoid oncoming bullets is off and my tank blows up before i get off the ground.
i would describe it as a "fat bullet" hitting me.

just to add the thoughts of "ts" from another post:
ts wrote:The game was designed for lag up to 10ms, no jitter and no packet loss. It hasn't changed much of how the game works, so this is still true. Especially jitter and packet loss are huge problems. That's why I say horrible.
designed for lag up to 10ms and no jitter? right...
oi!
User avatar
bzflaginator
Private First Class
Private First Class
Posts: 275
Joined: Sun May 01, 2005 1:50 am
Location: Upstate, New York, USA
Contact:

Post by bzflaginator »

After reading that, I now have an understanding as to why the greatest players in the GU league and duc league are so good....they have gotten their shots to a science against laggy opponents.
Image
Image
"He that falls in love with himself will have no rivals."
Image
Image
User avatar
Saturos
Art Master General
Art Master General
Posts: 1111
Joined: Mon Apr 19, 2004 2:48 pm
Location: Berlin/Germany
Contact:

Post by Saturos »

sn0w_m0nkey wrote:designed for lag up to 10ms and no jitter? right...
BZFlag was first designed as a LAN game, thinking everybody would be on the same local network. So ts is correct, although I dont really see his point. Only because BZFlag was originally a lan-game doesnt mean playing over the internet isnt possible. Actually it works really well... compared to 10ms+-0 a 180 ping might be "horrible", but on the battlefield (with a bit of thinking where to shoot) its okay to play against. In addition one should always see that the lagging opponent has disadvantages too.
ts
Dev Monkey
Dev Monkey
Posts: 970
Joined: Fri Jan 14, 2005 6:26 pm

Post by ts »

Saturos wrote:
sn0w_m0nkey wrote:designed for lag up to 10ms and no jitter? right...
BZFlag was first designed as a LAN game, thinking everybody would be on the same local network. So ts is correct, although I dont really see his point. Only because BZFlag was originally a lan-game doesnt mean playing over the internet isnt possible. Actually it works really well... compared to 10ms+-0 a 180 ping might be "horrible", but on the battlefield (with a bit of thinking where to shoot) its okay to play against. In addition one should always see that the lagging opponent has disadvantages too.
The point is that as a consequence of the original design goals the game could so its job a lot better than it currently does. In the original way one could see whether a player cheats just by looking if he starts playing same time as others or whether he's first doing some mods and compiling.

That means the game has a long history and its source code partially is really..umm..bad for playing using the internet. Even my own shots are lagging in the view of the opponent, making it a difficult task to guess what is needed to hit the opponent. There are no server side computed kills, which means you eventually see bullets going right through the other tanks in case they have packet loss. I'll still have to check whether the shots use UDP or TCP/IP but whatever they do, packet loss obviously has a high impact.

Jitter makes opponents jumpy..no good DR used (which is part of the history I guess).

When the opponent is steadily moving (people call that Mouse Enhancement) it's difficult to guess where they will drive next.

I'm not certain whether it is better to have lower, middle or high lag. Of course with high lag you loose some "reaction time" but on the other hand a player with high lag feels like an alien tank if the playing field is full of tanks with low latency. It is clearly noticeable whether the opponent has 20ms or 100ms lag to me.

All this history leads me to the conclusion one should avoid playing on servers that have 1-3 players that have a different lag, jitter or even have packet loss. Don't get me wrong, I love being able to play using the internet, but BZFlag really needs a lot of work until it is really suited for that.
GU league: http://www.guleague.org/
An introduction to TCP: http://www.lafkon.net/tc/
User avatar
Sky King
Private First Class
Private First Class
Posts: 166
Joined: Mon Jun 05, 2006 8:07 pm
Location: Twin Cities, Minnesota, USA

Post by Sky King »

Saturos wrote:Don't get me wrong, I love being able to play using the internet, but BZFlag really needs a lot of work until it is really suited for that.
While I agree that future versions of BZ may benefit from more server-side processing, I don't think it will be in the direction you may be thinking. Putting more of the game's thinking on the server certainly increases flexibility in game design, and helps mitigate cheating.

But in the matter of lag, there is not a lot that can be done. Assume you and I both have 100ms round-trip lag, or 50ms one way. Where I see you right now is where you were 100ms ago. I apply a little lead and fire. It takes 100ms for my shot to get to you, so I have to lead you by a total of 200ms from where I see you on the screen.

Now we switch kill detection to the server. Where I see you on the screen is where you were 100ms ago. I apply some lead and fire, and it takes 50ms for the firing to get to the server. The most recent position report the server has on your tank is now 50ms old, my firing report is now 50ms old, and was based on your position 150ms ago. The kill is calculated, and reported to both of us 50ms later. The server then has to intercept and cull any of your shots made in that 50ms interim.

In the end, moving processing to the server reduces the net accuracy lag by 1/4. That's a reasonable amount, but it is not, and never will be, the "order of magnitude" kind of improvement that people would like to see.

Network lag is an inherent problem, implicit in real time applications like BZ. It is a network problem that can't be solved by more development or a change in development priorities... It just is what it is.
Retired Army--Proud to have served
Armored Cavalry Crewman, 1981-1984 (M60A5)
Infantry Officer & Paratrooper, 1984-1986
US Army Ranger & Sniper, 1986-1989 (LRSD)

Water Cooled 8-Core Ryzen 7 2700x @ 3.7GHz | Radeon RX590 GPU | 43" 4K Monitor
User avatar
bzflaginator
Private First Class
Private First Class
Posts: 275
Joined: Sun May 01, 2005 1:50 am
Location: Upstate, New York, USA
Contact:

Post by bzflaginator »

Thank you for stating what we have previously discussed. :roll:

Just suck it up and learn to play with it, as do many other of the best players out there. The matter on "lag" and ping times is all in the hands of the host and developers. Just a matter of time before someone forwards these ideas into action... :roll:

EDIT:
Sky King wrote:While I agree that future versions of BZ may benefit from more server-side processing, I don't think it will be in the direction you may be thinking. Putting more of the game's thinking on the server certainly increases flexibility in game design, and helps mitigate cheating.

In the end, moving processing to the server reduces the net accuracy lag by 1/4. That's a reasonable amount, but it is not, and never will be, the "order of magnitude" kind of improvement that people would like to see.
Last edited by bzflaginator on Fri Jan 19, 2007 4:08 am, edited 1 time in total.
Image
Image
"He that falls in love with himself will have no rivals."
Image
Image
User avatar
blast
General
General
Posts: 4931
Joined: Fri Mar 21, 2003 3:49 pm
Location: playing.cxx
Contact:

Post by blast »

bzflaginator wrote:Thank you for stating what we have previously discussed. :roll:

Just suck it up and learn to play with it, as do many other of the best players out there. The matter on "lag" and ping times is all in the hands of the host and developers. Just a matter of time before someone forwards these ideas into action... :roll:
It's not all in the hands of the host and the developers. There's this thing called "the speed of light" that we can't seem to get around. This induces a minimum delay based on distance. Then there is also the processing time at each hop, the delay on the computer, etc. So a lot of it is just unavoidable or dependent on the ISPs that are in use.
"In addition to knowing the secrets of the Universe, I can assure you that I am also quite potty trained." -Koenma (Yu Yu Hakusho)

Image
User avatar
Sky King
Private First Class
Private First Class
Posts: 166
Joined: Mon Jun 05, 2006 8:07 pm
Location: Twin Cities, Minnesota, USA

Post by Sky King »

bzflaginator wrote:Thank you for stating what we have previously discussed. :roll: ...The matter on "lag" and ping times is all in the hands of the host and developers. Just a matter of time before someone forwards these ideas into action... :roll:
I am not quite sure what you are getting at. Lag and ping is NOT in the hands of developers.

There seems to be this common idea that if only the developers weren't so lazy... if only they would finally "forward these ideas in to action", then finally we'd have a lag-free game.

This attitude is nonsensical and counter-productive. There is no magic bullet here where coding is concerned. There are a number of tweaks that the development team can apply, but, in the end, latency is a physical manifestation, a necessary and unavoidable component of networks. No amount of coding will change that.
Retired Army--Proud to have served
Armored Cavalry Crewman, 1981-1984 (M60A5)
Infantry Officer & Paratrooper, 1984-1986
US Army Ranger & Sniper, 1986-1989 (LRSD)

Water Cooled 8-Core Ryzen 7 2700x @ 3.7GHz | Radeon RX590 GPU | 43" 4K Monitor
anomaly
Private First Class
Private First Class
Posts: 220
Joined: Tue Jul 26, 2005 10:32 pm
Location: Gainesville Florida

Post by anomaly »

ts wrote: I'll still have to check whether the shots use UDP or TCP/IP but whatever they do, packet loss obviously has a high impact.
Using WireShark I have found that the MsgShotBegin and MsgShotEnd messages are sent UDP on my server. So latent and unreliable. Good combination.
User avatar
bzflaginator
Private First Class
Private First Class
Posts: 275
Joined: Sun May 01, 2005 1:50 am
Location: Upstate, New York, USA
Contact:

Post by bzflaginator »

Sky King wrote:I am not quite sure what you are getting at. Lag and ping is NOT in the hands of developers.

There seems to be this common idea that if only the developers weren't so lazy... if only they would finally "forward these ideas in to action", then finally we'd have a lag-free game.

This attitude is nonsensical and counter-productive. There is no magic bullet here where coding is concerned. There are a number of tweaks that the development team can apply, but, in the end, latency is a physical manifestation, a necessary and unavoidable component of networks. No amount of coding will change that.
Maybe not so much the developers, but more along the lines of the host. It is their job to make sure that if they want to up hold their popularity and practicality, then they should work on tweaks to help this latency. I know I made a mistake in saying developers. And there is no need to attack me about :P.
Image
Image
"He that falls in love with himself will have no rivals."
Image
Image
User avatar
Sky King
Private First Class
Private First Class
Posts: 166
Joined: Mon Jun 05, 2006 8:07 pm
Location: Twin Cities, Minnesota, USA

Post by Sky King »

No attack intended at all... but still, I think you are missing the bigger picture here. There is very little a host can do, there just isn't a lot of tweaking to be done.

From my house, it takes 11 hops and 74 ms average round trip to ping bzfx.net. It is taking me about 50 ms to get from my PC into the core switching fabric of the internet... about 12 ms to traverse the really big-iron routers in the core, and about 8 ms to get to and from the server from that core.

If the owner of that server worked with his ISP, tweaked his server, monkeyed with the source code... with a lot of effort he may find a way to shave 2 ms off the round trip.

No matter what he does, 62 ms of the total latency is totally, 100% out of his reach, and there is nothing he, or his ISP can do about it. Yes, he may choose to move the server... but being closer to me, makes it farther for others.

There are some servers that are running on home cable or DSL lines, and for them, very high lag is going to be a way of life until they move their servers onto bigger pipes. But the bulk of the popular servers are already in carrier-class data centers, fiber connected to several internet peers.
Retired Army--Proud to have served
Armored Cavalry Crewman, 1981-1984 (M60A5)
Infantry Officer & Paratrooper, 1984-1986
US Army Ranger & Sniper, 1986-1989 (LRSD)

Water Cooled 8-Core Ryzen 7 2700x @ 3.7GHz | Radeon RX590 GPU | 43" 4K Monitor
Post Reply