- Problem: How to minimize lag and stuttering
Before reading this, make sure you know how to use console.
First of all, try to connect to servers that will give you a lower ping. Even though the ping shown in Arcade is not the exact measure of the real ping you will have in game, it is a good point to start from. Also note that if your connection to a server is dropping packets, it might be better to try one that has greater ping, but doesn't drop packets. In some cases it is possible to compensate even for the packet loss, but it is better if there is none. It all depends on different factors, and you will have to experiment. Here we will explain how to do it and what to pay attention to.
To adjust your settings, you need to be connected to a game server of choice, so you can see how it respons on the settings. You might have to readjust depending on the server you connect to. For connections of lower quality you will need different settings than for a low ping stable connection.
Diagnostic Tools
When connected, you should have the diagnostic tools turned on. Those tools are the latency display and netgraph.
Latency is turned on with the console command 'hud_bShowLatency=1' and it shows your current ping in the lower right part of screen. The ping is shown in milliseconds and is a smoothed value averaged over a few last seconds. Lesser value is better. All below 100 will give you excelent experience, but is usually not possible with a plain modem connection. Modem users should expect between 200-500 and it can all work very smooth if there are not too many dropped packets and your framerate is smooth otherwise.
Netgraph is turned on with 'hud_bShowNetgraph'. It is displayed as a vertical graph of horizontal lines scrolling up in the loer right part of screen, just above the latency. Netgraph shows how your ping varies with time, whether your connection is dropping packets and if you have any other instabilities.
Each line in the graph represents one packet you receive (or don't receive) from the server. Length of the lines shows its latency - full row equals 1000ms, so one half equals 500ms etc. The color of the line shows type of the packet and its other characteristics:
GREEN:
This is a normal action packet is received in sequence. All is well. The shorter the line is, less you are predicting and the better will your accuracy be.
RED:
Packet is missing. Your computer must request resend from the server before proceeding. This will cause a complete halt of the game or small stuttering, depending on your ping. It can be compensated.
WHITE:
A non-action sequence is received. This happens when the game is paused, when you receive chat messages, new players are joining, someone has changed his/hers model, nickname, or other settings and similar. While the game is under pause, you will keep receiveing a steady stream of those. White lines are completely normal and does never indicate any problem.
BLUE:
A replicated action is received. This means that packet stream from you to the server is unstable, so the action buffer emptied and server had to make your player repeat the last action you did with keyboard/mouse, since it didn't receive the packet from you in time. It can be compensated.
YELLOW:
An action was skipped. This means that server action buffered overfilled and server had to drop one of the actions you did. This is similar to BLUE and they usually come in pairs. when you receive blues you always receive yellows and vice-versa.
Client settings to change
Here is the list of settings you need to change in order to set your connection well. These are all client-configurable variables. This means that event though some of them control the behavior of the server, they are all configured by each client independently on their own machines. If server needs to have some setting it is then automatically transmitted to it when you change it in console. Allow about a second for a setting to take effect.
cli_bAutoAdjustSettings:
Initially, 'cli_bAutoAdjustSettings' is set to 1. That means that engine will automatically adjust the settings for you. If it doesn't work well, you have to first set 'cli_bAutoAdjustSettings=0' or it will snap back everything you try to change. After you have set autoadjustment off, you can proceed with finetuning.
cli_bPrediction:
This controls prediction. It is a simple toggle: 'cli_bPrediction=0' turns it off and 'cli_bPrediction=1' turns it on. Prediction removes lag by predicting what will happen a few fractions of seconds ahead before even receiving that information from the server. It can predict your own movements perfectly, since you play on that computer. The movements of enemies in coop will also be predicted very acurately, especially if some enemy is attacking you. Movements of other players are not very predictable since they are humans and tend to jump around quite a bit, but the prediction system will at least try to smooth that out.
If your lag reaches 100ms (or even 50ms if you are very sensitive to lag), you will want to have prediction turned on, or it will feel very strange and sluggish. If prediction is on, it effectively removes any lag you can feel.
cli_iBufferActions:
The variable 'cli_iBufferActions' controls size of the action buffer on the server. That buffer compensates for the lag variation. Its values range between 1-5 usually. Default value of 1 actually disables buffering. Each unit above gives you 50ms of buffer at server to compensate for lag variation. So, if your latency varies between 200-300ms you will need at least 3 buffers - 1 is initial and 2 extra to account for that 100ms variation. Too high buffering will just add additional lag to your game and you don't need that. Always increase/decrease by one and see what happens.
Note that if you use prediction, you _have_ to set buffer to at least 2. Using prediction with buffer set to 1 can cause stuttering.
cli_iMinBPS:
This controls incoming bandwidth from server to client. It is stated in bytes per second, and is usually refered to (in net gaming community) as 'rate'. This is ammount of data server will send to your client per second. It controls how many times a server will send you one packet. By default it doesn't resend any packets to you, assuming that your connection is stable. But if your connection is unstable, you might need to increase this and by that way compensate for the lost packets. You should usually try with settings in the range 1000-3000. If you have a 56k modem, don't try to go above 5000, or you'll choke it. You can never set this too low, because it always sends at least copy of each packet. You can only make it send more than default.