by FeaRog - Programmer Splash Damage
I've noticed a few questions about the FPS locking, so rather than respond in individual threads to queries I thought I'd create a new thread to avoid confusing things.
I hope this guide & explanation helps you all out some.
Please remember that it isn't final yet, this is a beta and things can and will change!
BACKGROUND INFO
The most important thing to maintaining the perception of as game being smooth is a constant, consistently spaced framerate. I'm sure many of you have played console games - you'll have noticed that a game feels dead smooth until you get "hitches", happening in intense periods of activity, that make the game no longer feel smooth. These happen when the game can't achieve its target framerate (eg 30fps on NTSC) and drops a frame, momentarily going at 15fps. It usually feels better for a game to run at a constant 30fps than at 60fps but regularly dropping to 30fps.
The game (and physics) runs at 30fps, so the rendering also runs at 30fps unless it is unlocked from the game framerate.
There is a cvar - com_unlockFPS - which enables you to unlock the game and the renderer to some extent. This allows the renderer to draw more frames than just the 30fps.
CVARS
There are several cvars that can be modified to adjust how the unlocking behaves. Note that none of these are a universal solution - it is a heavily subjective thing, and depends a lot upon your hardware and software. Warning: This is a fairly technical explanation. I've tried to keep it pretty understandable.
com_unlockFPS - this is the master cvar. If you do not set this to '1' then it will never attempt to exceed 30fps.
com_unlock_timingMethod - this selects one of three timing methods for unlocked frames:
0: This will try rendering another frame whenever it estimates it has enough time left for rendering before the next game frame is done. This will give you the highest possible framerate, however it can lead to frame "bunching". To many (including myself) this feels really jerky - 200fps in the best case is no good if its regularly dropping to 60fps.
1: This is similar to method 0, but instead of squeezing in rendering whenever it can it tries to space them at even multiples of 30fps. This is a slight improvement over method zero in terms of smoothness, but sacrifices some FPS.
2: This is the same as method 1, but instead of estimating if it can fit another rendering frame using only the render time estimate it estimates using the total time of game + renderer. Hypothetical explanation: Lets say the time between two game frames was meant to be 10ms. Game + render time takes 5ms, leaving 5ms left. Rendering only took 2.5ms. Method zero would then render two more graphical frames before the next game frame - in effect feeling like the game should be running at 400fps but dropping a frame every 10ms, giving it a jerky feel. With this method it would only draw a single extra frame so it wouldn't feel sporadic. You'd only get 200ms however.
com_unlock_maxFPS - this only does anything if com_unlock_timingMethod is set to 1 or 2. This limits the maximum fps your PC will try to achieve. This will be rounded to the next lowest multiple of 30 - eg if you set this to 59 it will in effect be treating the maximum as 30. This helps to control the fluctuation sometimes prevalent.
There are a couple of other tuning cvars but those shouldn't really need much tweaking. com_unlock_safetyMargin adjusts how conservative the estimation is, and com_unlock_avgFrames is there to help ignore spikes & troughs in the estimation. The defaults of these should be fine for most people.
TUNING
The defaults are to unlock the FPS, with a maxFPS of 60 and timing method 2. This basically means that if your system is fast enough to exceed 60fps all the time then it will do a constant 60fps. If your system isn't fast enough to exceed 60fps at all times then it will fluctuate between 30 and 60fps. Lower end systems may well be unable to exceed 30fps most of the time - for these people you are probably best off disabling unlockFPS and satisfying yourself with a smooth 30fps. You can try to increase your FPS by lowering the graphics resolution & quality settings. A lot of middle-of-the-range systems can probably achieve a pretty regular 60fps with some tweaking here.
If you have a really good system you can probably do better than 60fps - in that case try increasing your maxFPS. I find that on my dev system here (2.4GHz Core 2 Duo, 7800GT, 2gig ram) I can do 90fps pretty constantly, so I have mine set to 90. You'll need to experiment a bit to find a level of this that doesn't fluctuate too much for your liking.
If the only thing you care about is the absolute maximum FPS then try setting com_unlock_timingMethod to zero! This is highly unlikely to feel smooth, but again it is totally subjective. Whatever floats your boat, hey
V-SYNC
If you have your monitor's refresh rate set to 60Hz and have v-sync enabled then you might as well set com_unlock_timingMethod to zero. This is because the new frame won't display until the evenly spaced 60fps point anyway - this is what timing methods 1 & 2 try to achieve. It will also limit you to a maximum of 60fps. Having V-sync enabled with refresh rate set to anything other than a multiple of 30fps will probably feel jerky.
USAGE
These cvars ("console variables") are adjusted using the console. If you are unfamiliar working with the Quake-style console then it is a good idea to read a guide first.
Here has a good description of how to make an autoexec config to make sure these settings stick around. CTRL+ALT+~ opens the console. To set the cvars so that they stick around for next time you start the game enter something like this at the console (or insert it into your config):
seta com_unlockFPS 1
seta com_unlock_timingMethod 2
seta com_unlock_maxFPS 60
The "seta" command "set"s the cvar and then "a"rchives it. Use this seta command to set each of the cvars.
MISC
I highly recommend that you also enter the following so that you can see what impact your settings are having:
seta com_showFPS 1
com_unlockFPS does not have any affect when you are not connected to a server. So don't worry if you're locked at 30 at the menu - thats normal. Connect to a server and test it there.
Note that there are a few bugs with it in the public beta build, meaning that sometimes in timing method 2 your framerate will drop to 30 and never be able to recover, and a few other things.
A generalization of the timing methods:
0 - max FPS with no regard to the "smoothness" of the FPS
1 - lower FPS than method zero but slightly more smooth
2 - lowest FPS of the three methods, but the most smooth
Method 2 is much more CPU speed dependant than the other two - if you have a fast CPU then method 2 will likely not cut your FPS a lot but will result in a much smoother framerate. Otherwise methods zero and one are more likely to yield a higher framerate.