Optimising maps

From modwiki

Jump to: navigation, search

To test a map and gauge the performance there are several CVars that can be set or toggled to give you visual information about you map. You can type the bind console command at the console or set it in your "autoexec.cfg" file to make it a semi-permanent feature. For all CVars with multiple settings (instead of just on/off) you can use the toggle console command, for instance:

bind m toggle "r_showTris 0 1 2 3"

In general, the com_showFps allows you to keep tabs on the framerate of the current scene. It's not very useful to determining hardware bottlenecks though.

After you've finished your map and are exclusively optimising the level it may pay off to record a .DEMO of you playing through and then benchmark it with the timeDemo function. This way you can more quickly and accurately see which parts need to be optimised.

Contents

Lighting

The r_showLightCount CVar allows you to check how many lights are hitting each polygon. You can even make it a bindable toggle so that you can switch from disabled, to number of lights, to number of lights plus overdraw rate.

When viewing with r_showLightCount, surfaces in the game (and the editor) display a colour, representing the number of lights hitting a surface. Red green and dark blue are good, light blue, white and pink are bad. Surfaces which have these bad colours will generally run sluggishly on your rig. Split the surfaces up (through manual brush carving or via the lightCarve compile option) along the light's volumes until you've got mostly reds, greens and dark blues meaning that each surface is being hit by as few different light sources as possible.

It can also be helpful to set both r_showTris and r_showLightScissors to "1" along with r_showLightCount. You could use the following:

bind l "toggle r_showLightCount 0 1; toggle r_showTris 0 1;toggle r_showLightScissors 0 1"

If you make use of patches then make sure surfaces behind them (which are not seen by the player) have the "caulk" material. Being single-sided meshes, they never block light so this will prevent the engine from having to waste time calculating per-pixel lighting on those the unseen surfaces.

Geometry

The r_showTris CVar is helpful for gauging the amount of geometry being processed but it's more commonly used to acertain how your visportals are affecting performance. You should combine it with the following CVars:

bind p "toggle r_showTris 0 2;toggle r_useScissor 1 0;toggle r_showPortals 0 1"

See also the models vs brushes section.

Textures

You can use the listImages console command to check how the texture memory utilization of your map compares to the official maps. Make sure you test at each of the quality settings.

Visportals

An important part in optimizing your maps is the usage of visportals, which tells the engine how to split up your map for rendering.

See also

Personal tools
Main