Frame Rate Optimization

The frame rate is the number of video frames per second (fps), and determines the 'smoothness' of game play. It is dependent on:

These factors must be balanced to keep the frame rate well above 25 fps for a smooth gameplay. The good news is that you've got one of the fastest engines available today, able to manage huge scenes with up to 100,000 entities. With a given scene, the major framerate influence factor is the speed of your graphics card and the number of pixels drawn per frame. You can test the performance of your hardware with the infinite terrain example that renders 9 views with about 6600 entities each. Even on old PCs, the total of 60,000 entities should be rendered with 20..30 fps. You can see how the frame rate drops when you increase the camera.clip_far range so that more entities are actually drawn, or when you increase the scale of the models and thus draw more pixels. This should give you an idea how many entities you can put in your game for a given graphics hardware.

The fps contribution of certain elements can be seen in the [F11] panel in ms per frame. In some cases it can be larger than the real rendering time by the engine and hardware, especially in fullscreen mode in which the frame rate is limited by the monitor frequency (mostly 60 Hz on LCD screens and 70..80 Hz on CRT monitors).

Monitor frequency and fps

In fullscreen mode, DirectX keeps the frame rate always in sync with the monitor frequency between 60 and 80 Hz in order to avoid tearing artifacts. The screen refresh is artificially delayed for matching the time when the monitor has finished its video cycle. This delay is visible in the 'screen refresh' time in the [F11] panel. Thus you'll never get a higher frame rate than your monitor can display. Your frame rate will be an integer division of the monitor frequency (such as 60, 30, 20, or 15 Hz when the monitor frequency is 60 Hz). When the frame rate is close to the monitor frequency, a small change of the rendering time will cause the frame rate to suddenly jump from 60 to 30 fps or vice versa.

Some hints for increasing the frame rate in your games

Some hints that will NOT increase the frame rate in your games

Sometimes you encounter strange advices on the user forum about how users increased their frame rate. The following advices will most likely not improve your game:

Some hints for decreasing the frame rate in your games

Why would you want to decrease the frame rate? There are three reasons. Your script functions might only work properly within a certain frame rate range, and fail at 1000 fps. You won't want your application to consume all the CPU cycles. And most important, you want to avoid stuttering. Stuttering means a camera and actor movement that appears unsteady. It won't be noticeable in a game with complex levels and medium frame rate, but mostly in games with almost empty levels, little content, and consequently very high frame rate that is then capped by fps_max.

The main reason for stuttering is a coarse PC scheduler resolution that leads to inaccurate task start times, especially when many tasks are running on a particular PC. This problem can be avoided by limiting the frame rate not only with fps_max that just gives task time back to the Windows task scheduler, but by really burning CPU cycles in some or the other way. Fortunately, this is easily done. If your game experiences stuttering, just place some more details in your levels for avoiding a too-high frame rate.


► latest version online