Frame Rate Considerations

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

The major framerate "bottleneck" 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. On normal PCs, the total of 60,000 entities are rendered with about 20..30 fps. You can see how the frame rate drops when you only increase the scale of the tree models and thus render 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 tips for increasing the frame rate in your games

Some tips for decreasing the frame rate in your games

Why would you want to decrease the frame rate? There are three reasons. Your movement 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