Optimizing and Checking Your Map
Once you get your map built, you may want to check on its performance in the engine and see how you can optimize it (if you need to at all). This document describes some of developer features of the Source engine that let you evaluate performance.
Useful Console Commands
One useful feature of the console in Source: there is a help command! For a brief bit of
help on any command, type help followed by the command text. Also, if you need any help finding a command, you can use the new
find command. For example if you type
find mat you will get a list of all the console commands with the text
"mat" in the command text. For more information on using the console, see The Developer Console.
One other point: you will want to enable the console to access it in the game. Go to Options/Keyboard/Advanced... and there is a checkbox there to enable the console.
||This is the same as in Half-Life 1. It turns off and on the use of "cheat" console commands. You will need to activate cheats with |
||The first thing you'll want to do is bind some key (or mouse button) to |
For a complete list of what the different categories mean, see Showbudget for more information.
||This toggles off and on the display of wireframe detail for all brush and model objects in view. It is useful for showing you how your map's brushwork has been split up by the engine. It is also useful to show you just what is being drawn in any given view.
You will need to activate cheats with
||This command turns off and on display of a wireframe box around the current leaf. For more information on using this command to debug visibility issues in your map, see Controlling Geometry Visibility and Compile Times.|
||This console command toggles off and on the display of bumpmap effects by the engine. If you want to see how much impact on framerate bumpmap display has, toggle the effect on and off and view the changes (if any) with |
||Similar to the mat_bumpmap command, this toggles on and off specular reflection in the engine. You will need to activate cheats with |
||Turns on and off display all entity input/output activity. As each entity is activated by input or output, the action is drawn at the entity's location, and a line drawn between entities as they target other entities. Can be useful for tracing and debugging entity actions in the game.|
||Turns on debugging output to the screen listing all entity triggers and activity. Can be useful for tracing and debugging entity actions in the game.|
||Shows and updates the frames per second that the frame rate is currently running at. (|
||Replaces your weapon with a set of reflective balls (|
Now that you know how your map's performing, a few optimizations may be required. There are a few simple tricks for your map's layout that might help speed up your map.
The single worst thing you can do for your map's speed is create a giant skybox around your entire map. This renders useless faces and wastes speed and time. To fix this, think of a skybox not as a box, but as a roof. Use the buildings of your map as the walls, where possible. Long story short, only place skybox brushes where needed.
They slow down your map and generally aren't used anyway. If you place a point_spotlight, make sure the No Dynamic Light flag is checked. Also, don't name any lights you don't need to. This causes the engine to treat each light specially, which slows down its rendering.
If you're going to use water, use it wisely. Make sure models that don't need to be in water aren't in water. Doing so causes the model to be rendered twice, which can slow down the map more as more of these cases appear. Another solution is to make the water cheap by using a water_lod_control entity. As with the skybox, only place water brushes where they are required.
Use as few brushes as you can, while not losing your desired detail. The biggest problem happens when you carve with a cylinder, resulting in too many small brushes in the wall. Use carve wisely, if at all. Also, use standard-size brushes -- 8, 16, 32, 64, 128, and so on. Not only are these easier to texture, they're easier for the engine and will help prevent leaks.
If you can see your whole map from one spot, there's not much you can do. Either redesign your map or take drastic measures to optimize it.