Lag
The basics -
Ping -
What to do when pings are high -
Decrease the lag -
Strategies for lagged games
The basics
What is lag? In a network, there is always a certain time that a signal needs to reach its destination. First, we have to distinguish between throughput and signal delay.
Throughput
This is often called "bandwidth", even though this term is incorrect. It means the raw amount of data that can be sent to the destination, regardless of the time that it needs to arrive and any errors that occur underway.
Signal delay
The signals traval fast (nearly at light speed), yet there is a measurable delay until it arrives, even on Local Area Networks (LANs). On the Internet, this delay is not only determined by the distance, but also by the number of routers that lie between the source and the destination (often more than 20). Each router introduces a small delay, since packets are queued there, making the signal delay far greater than the distance might indicate.
Quality of the connection
This is another important parameter. It indicates the frequency of errors that happen when transferring a packet. This is usually not such a problem, because they are detected and false or lost packets are resent. However, in computer games, where packets are needed in real time (ideally), this introduces extra delays, so a connection with a reasonable quality is needed (packet losses greater than 5 % are inacceptable).
Other bottlenecks
If you play over the internet, the data packets have to travel many miles and through numerous bottlenecks, such as:
- CPU I/O capacity (both yours and the server's)
- satellites (they increase the distance compared to a direct connection, e. g. Europe - USA = 10,000 km over a transatlantic connection, but more than 80,000 km over a satellite).
These factors set the technical limits; of course they also apply for the server and the person who receives the data. Unfortunately, only the throughput can be influenced by the user (i. e. by buying a better computer, in case the CPU cannot handle the load, or a faster modem). Of course a 14.4 modem will not yield the necessary performance; for most games, 28.8 Kbps is enough, though. Even for the latest 3D shooters, you will never need a throughput higher than 56 Kbps. The crucial limiting factor is the signal delay. Only a minor part of the lag is caused by your CPU (unless it is overloaded, in which case you will also have slow single player games and you should upgrade). Modern modems (28.8+ Kbps) have the required throughput. Thus, most of the lag is introduced by the signal delay and the routers, especially when the net traffic is high.
There is nothing you can do against the rest, e. g. a bad connection (you may try to change the ISP or get ISDN phones, but these measures are expensive). Most people think they are immune to lag if they have a fast processor or a high throughput (e. g. 56 Kbps or higher). This is completely wrong. Since the CPU capacity and throughput is sufficient with newer computers and modems, the delay is pretty much the only factor that makes a difference. The delay mainly depends on where you are located, and there is pretty much nothing you can do about that.
Give me a ping - only one ping
In Kali or UNIX, you can ping players, and their current average "ping" is always shown when launching a game. The ping is the time that a small packet needs to go to the other computer and back to yours, also called the latency time.
Now your computer and the computer of the other player both lose around 25 ms for processing the in/output, and so do both ISPs. Together with the Kali server, this makes about 150 ms minimal lag. If the distance to the other computer is 7500 km, the signal itself already needs at least 200 ms to cover the distance [3*10**6 km/s /(2*7500 km)]. This would be the case if the computer and the modem were infinitely fast and the connection is perfect (fiber glass cable). So you see that even in the optimal case pings can already get pretty high. If the connection is bad due to high traffic, pings can increase dramatically (up to 2500 ms, sometimes even more).
What to do when pings are high
When setting up a game and packet loss (see above) and pings are high, you should try it on a different server or forget about it and try it again later. Usually, playing a game during "prime time" (when all other people use the Internet, too), produces games with high lag, since the routers and servers are working to capacity.
In War2, a special network model is built in for internet play: if you give a command, the unit will wait half a second before carrying it out. You won't notice that, and the computer will have 500 ms time to transmit the signal to the server and get the acknowledgement. If the lag is below 500 ms, you usually won't notice that you are not playing over a LAN.
Alas, it is not always so! If the lag is higher, your men will stop and wait until all computers have caught up; this is certainly familiar to all players. The game will slow down. The hourglass will be shown instead of a cursor. You can give commands to your guys but they wouldn't obey :-)
A high lag makes a game unplayable, so you will want to make the best of the situation. The best thing against lag is prevention. However, usually you do not want to try again later, so there are some other things you can do:
Fight against the lag!
If you get the message "Waiting for player Lagger" several times, then the player who calls himself "Lagger" is usually the one that is responsible for the slow game. If you see many names on the list with lag symbols, this indicates that you are the lagger! You have to decide then whether to quit or to go on.
If you do not want to have a player quit, pause the game for 30 seconds to give all computers a chance to catch up and to "synchronize the game", as it is usually called (in fact, the computers try to send all the lost packets again). However, this will not solve your problems (after a while, more packets will be lost again). If the lag is bad at the beginning, think about starting a new game. It is usually better than playing an awfully slow game. Later in the game, the decision is not that easy.
Before you are going to drop the lagger, give him a chance to leave the game himself. Tell him that his connection is too slow, and that he should leave the game. Of course you will have to reorganize the match then, usually turning it into an FFA game. It is still better to play a good game with fewer players than a slow, unplayable game.
While dropping a player is the most efficient measure against lag, there are also other things you can do, such as:
- close all programs in the background: this should be obvious, but there are many people who are running ICQ in the background while playing. You need the full bandwidth for your game.
- choose a host with a good connection and a fast CPU: the host has to handle a bit more than the other computers, so it should be the computer with the fastest connection and a reasonably fast processor.
- Turn the speed down: the game will still run slow but more smoothly than at a high speed setting. Many newbies turn the speed up when the lag is high, and I hate that! They make everything only worse, the men will jump around the screen and be totally uncontrollable.
- Avoid scrolling around like a maniac: I have noticed this first when playing over LAN. The other computer (a 486 DX2/66) slowed the game down when that player was scrolling his map. It was because the CPU had not enough power to keep the speed at an equal level. I don't know how strongly this affects internet play, but the more you click around, the more data will be transmitted.
- Turn the music off (Alt+M): another newbie mistake. When the lag is high, the shout "Alt+M, have you all pressed Alt+M?" or something like that. However, the midi music needs only very little CPU time and has a low priority, and the CD music only affects the game at the beginning (when searching the track). If you have a fast computer (Pentium), then turning the sounds off won't affect the performance. The modem is the slowest part of the connection, not the CPU! So if players say something about Alt+M, just ignore them unless you have a 486 DX/33 :-)
- Set a maximum ping in the game setup: while this feature is not 100 % reliable, it blocks at least all users with a very slow connection. Set the maximum to 800 or below (the more players there are in the game, the lower the ping should be). Note that the ping will rise will the others download the map. When setting a maximum ping, you might also block users that have other programs running in the background until the game starts. So you can alternatively set no maximum ping and then watch the ping values. Request the players with a high ping to leave, and if they don't, kick them :-)
- No critters in the scenario: they produce a lot of overhead because their positions have to be updated; just take them out of the map, and the game will run smoother.
Strategies for lagged games
When playing in games with high lag, you have to give up some strategies. Here are a few points that are affected in the game:
- Attack, no defense: due to the high time that units need to response, you will have no chance to respond to an attack. So make sure you are the attacking player. Keep the pressure up, and use the lag to your advantage!
- Don't guide your units individually in the battle: they won't listen to you anyway, and when they finally react, the situation has already changed and perhaps they should do something else then. Use the patrol command instead when attacking.
- Sappers: You cannot move your sappers around units anymore. Their speed will only help you if you tell them directly to blow something up. This is exactly the opposite of what you should do in a normal game. Of course you can only choose easy targets now with no obstacles in the way. This reduces the efficiency of the sappers.
- Mining peons: Don't try to give them any orders. They won't respond before the enter the mine, and then they will forget about your command. You have to watch your peons on wood very well, because you can't replace them with peons on gold if they are killed.
Lag is always annoying. You have to decide whether a game is worth to be played when the lag is high. Battles where the units are uncontrollable are very frustrating. Unfortunately, there is not much you can do against lag. Never forget that leaving a game due to high lag is nothing to be ashamed about. After all, the lag is not your fault :) - it is just a result of technical and physical limits. Of course you should ask the other players whether they want to go on without you before you leave.