Sunday, December 19, 2010

cl_smooth & cl_smoothtime

One of the biggest concerns for many cs:s players is their configuration files. These two cvars standout in particular as two of the most misunderstood as important in 'hit registration'. Lets break them down.

cl_smooth

Valve's help text states:

- Smooth view/eye origin after prediction errors.
This cvar takes 1 or 0 as it's parameters. 1 will smooth the players view after a prediction error. 0 will not smooth the players view after prediction error. Disabling this renders cl_smoothtime useless.


cl_smoothtime

Valve help text states:
- Smooth client's view after prediction error over this many seconds
If cl_smooth is 1 (enabled) AND a prediction error occurred the game will smooth the players view to the correct position over the parameter of this cvar in seconds.


By now it should be very clear that these cvars are useful only in the case of a prediction error as they function to smooth the players perspective if one occurred .
So what is a prediction error? I go over prediction in this post. In short, prediction errors happen when the clients prediction position is different from the servers position response, these errors are rare.

All these two commands do is tell the client how to 'react' to the error by smoothing the view over a certain amount of seconds (the clients perspective technically can be subtly inaccurate based on cl_smoothtime) or not smoothing it at all (will appear like a jump/teleport when corrected).


 While cl_smooth 0 is technically more accurate, prediction errors are rare. I'd perhaps lower the cl_smoothtime to 0.01 if you have cl_smooth enabled (default) but in the end it really doesn't matter much if you're playing in a good server. :-)

prediction

The topic of prediction along with closely related lag compensation and distant topic, interpolation are equally disputed as causes of 'problems' in counter-strike: source game play. This couldn't be farther from the truth, this post aims at explaining prediction.

In the context of the source engine The Valve Developer Wiki's article on prediction states:

Prediction is the notion of the client predicting the effects of the local player's actions without waiting for the server to confirm them. An entity's predicted state is tested against server commands as they arrive until either a match or a mis-match is detected.
In the vast majority of cases the client's prediction is confirmed by the server and it continues happily as if there was no latency. If there is a mis-match, which is rare if the prediction code is written correctly, then the client goes back and re-simulates all of the commands it ran with bad data. Depending on the severity of the error this can cause a noticeable hitch in the player's position and state, and possibly the state of the world too.

 In a nut shell, prediction happens client side so that the client can perform an action such as pressing the W key to move forward without waiting for the server to say it was 'ok' and update your position on the sever. why? because it takes time for the command to be received by the server and for it to respond. This would make the game appear laggy. What happens is: the client predicts your position on your key-press, instantly follows through and sends that command to the server. The server then responds with the new position and if it is different from the clients prediction then a mis-match is detected (prediction error) and the client is corrected by going back and re-simulating the commands it ran with the incorrectly predicted data.

TL;DR? Data mis-match or a prediction error is rare to begin with so it's nothing to fret over.

Monday, November 1, 2010

weapon_showproficiency

Throughout many cs:s configs novice to pro there are many unnecessary cvars being used. weapon_showproficiency in particular is quite amusing as it is listed under many configs as a "FPS Booster" as if enabling this would some how grant the client more frames. As of today, this command does absolutely nothing in terms of any noticeable benefit or disadvantage to the client and works only on the server side of things. If you take the time to further explore by creating a listen server and setting the value to 1 (weapon_showproficiency 1) you would undoubtedly uncover that it is yet another command in counter-strike: source that is useless to the client given it's what the results indicate. The following is the console output result of enabling it:

player equipped with weapon_knife, proficiency is Average
player equipped with weapon_glock, proficiency is Average
player equipped with weapon_c4, proficiency is Average


Right now, It's not exactly clear right now why weapon_showproficiency even exists.
In short, leave the command to it's default value (0).