Difference between revisions of "Lag"

From BZFlagWiki
Jump to: navigation, search
Line 1: Line 1:
Lag is a horrible, awful thing that plagues BZFlag players around the world.
+
The term Lag is a shorthand version for the concept of [http://en.wikipedia.org/wiki/Lag Network Latency]. It represents the real world delay in sending messages from one computer to another over a network. All network connections have latency.
  
==What is lag?==
+
==Overview==
While playing BZFlag, each player's client (the BZFlag program) needs to communicate with a server, which in turn communicates with other players' clients. The amount of time it takes for packets of information to be relayed from your client to the server is "lag." You can check lag for all players by typing the command '/lagstats' while playing. Keep in mind that lagstats shows an approximation of the amount of time it takes for a network message to go back and forth from one player to the server and back again, not the amount of time it takes to go from one player to another player. For example, if you fire a shot, your client sends a message to the server, giving shot direction and speed. The server then relays this information to all the other clients.
+
Lag is the network latency of a connection, or the time it takes for a network packet to travel from one host to another. Due to the speed of light, all network transmissions take some time, there is no such thing is a true "0" lag.
 +
 
 +
Different types of internet connections have different latency characteristics, dependent on the technologies they use. Most modern broadband systems ( like cable modems or DSL ) have a minimum latency that measures in a few milliseconds. Modems can have minimum latencies that measure in the 10s to 100s of milliseconds. The bandwidth rating of a network connection has little impact on it's minimum latency. A DSL line rated at 3 megabits in bandwidth often has the same latency as one rated at 1 megabit.
 +
 
 +
The distance along the network a message travels will also increase the time it takes to reach it's destination. The more hubs, routers, and switches the packets have to travel ( or hops ) will add additional time, as each hop takes some time to complete. Hosts that are more physically distant usually have more hops between them, due to the nature of the internet.
 +
 
 +
==Lag and BZFlag==
 +
Latency affects real time games in a very specific manner. A message sent from one user to the server will take some time to reach the server. This means that by the time the server receives a position update from a player, that user may  and probably has) have already moved from that position. Additional time is spent sending the message from the server to the other players. Depending on the latency of the various network connections, each player will get the update message at a different real world time.
 +
 
 +
The short version of this is, when you get a message, the client isn't there anymore. This presents problems for messages that are time sensitive, such as positional updates, and shots.
 +
 
 +
The current version of BZFlag ([[BZFlag 2.0.8|v.2.0.8]]) does not do any type of latency compensation on player messages. This means that the player you see on your screen is not where he is on his screen. This can produce an error in the perceived game states between the 2 users. One user may shoot where he believes the other is, and in his view score a hit, while on the other user's screen he has moved away from the position and saw a clear miss. The first user simply has not received his new positional update yet, because it is in the middle of network transmission.
 +
 
 +
The BZFlag server has a method for measuring the latency of each client, and displaying it as a numeric value in milliseconds. You can check lag for all players by using the command '''/lagstats''' while playing. Lagstats shows an approximation of the amount of time it takes for a network message to go back and forth from one player to the server and back again, not the amount of time it takes to go from one player to another player. For example, if you fire a shot, your client sends a message to the server, giving shot direction and speed. The server then relays this information to all the other clients.
  
 
Other lag-related problems are "missing packets" and "jitter". These can occur if there are more severe network problems which cause messages between players and the server to simply get lost, or to be delayed by inconsistent amounts of time. In an attempt to keep this explanation simple, these problems will not be covered here, other than to say that they compound the effects of lag to an even higher degree.
 
Other lag-related problems are "missing packets" and "jitter". These can occur if there are more severe network problems which cause messages between players and the server to simply get lost, or to be delayed by inconsistent amounts of time. In an attempt to keep this explanation simple, these problems will not be covered here, other than to say that they compound the effects of lag to an even higher degree.

Revision as of 22:21, 20 February 2007

The term Lag is a shorthand version for the concept of Network Latency. It represents the real world delay in sending messages from one computer to another over a network. All network connections have latency.

Overview

Lag is the network latency of a connection, or the time it takes for a network packet to travel from one host to another. Due to the speed of light, all network transmissions take some time, there is no such thing is a true "0" lag.

Different types of internet connections have different latency characteristics, dependent on the technologies they use. Most modern broadband systems ( like cable modems or DSL ) have a minimum latency that measures in a few milliseconds. Modems can have minimum latencies that measure in the 10s to 100s of milliseconds. The bandwidth rating of a network connection has little impact on it's minimum latency. A DSL line rated at 3 megabits in bandwidth often has the same latency as one rated at 1 megabit.

The distance along the network a message travels will also increase the time it takes to reach it's destination. The more hubs, routers, and switches the packets have to travel ( or hops ) will add additional time, as each hop takes some time to complete. Hosts that are more physically distant usually have more hops between them, due to the nature of the internet.

Lag and BZFlag

Latency affects real time games in a very specific manner. A message sent from one user to the server will take some time to reach the server. This means that by the time the server receives a position update from a player, that user may and probably has) have already moved from that position. Additional time is spent sending the message from the server to the other players. Depending on the latency of the various network connections, each player will get the update message at a different real world time.

The short version of this is, when you get a message, the client isn't there anymore. This presents problems for messages that are time sensitive, such as positional updates, and shots.

The current version of BZFlag (v.2.0.8) does not do any type of latency compensation on player messages. This means that the player you see on your screen is not where he is on his screen. This can produce an error in the perceived game states between the 2 users. One user may shoot where he believes the other is, and in his view score a hit, while on the other user's screen he has moved away from the position and saw a clear miss. The first user simply has not received his new positional update yet, because it is in the middle of network transmission.

The BZFlag server has a method for measuring the latency of each client, and displaying it as a numeric value in milliseconds. You can check lag for all players by using the command /lagstats while playing. Lagstats shows an approximation of the amount of time it takes for a network message to go back and forth from one player to the server and back again, not the amount of time it takes to go from one player to another player. For example, if you fire a shot, your client sends a message to the server, giving shot direction and speed. The server then relays this information to all the other clients.

Other lag-related problems are "missing packets" and "jitter". These can occur if there are more severe network problems which cause messages between players and the server to simply get lost, or to be delayed by inconsistent amounts of time. In an attempt to keep this explanation simple, these problems will not be covered here, other than to say that they compound the effects of lag to an even higher degree.

Lag affects what you see while playing BZFlag, especially if the delay is high. The most common effect seen is "shots going through other tanks." Many times you will hear players say "my shot went through you", or "why didn't you die." Many people have been accused of cheating due to the sometimes misunderstood affects of lag.

Fixing Lag

How to fix lag depends on what is causing it.

Slow Internet Connection

Lag can be caused by a slow internet connection, such as dial-up. In that case, find a server that is more allowing, or get a better connection.

Satellite Internet

Satellite internet is far too laggy for BZFlag. Sorry.

Automatic Updates

Make sure software is not running scans for automatic updates in the background.

Downloads

Don't download something and play BZFlag at the same time.

Internet-intensive programs

Other programs, such as other people playing an online game on your network, can cause lag.