Optimizing and Checking Your Map: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Fixing double redirect. This action was performed by a bot.)
Tag: Redirect target changed
 
(11 intermediate revisions by 8 users not shown)
Line 1: Line 1:
[[Category:Level Design]]
#REDIRECT [[Optimization/Level Design]]
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 [[Developer Console | console]] in Source: there is a help [[command]]! For a brief bit of <code>help</code> on any [[command]], type help followed by the [[command]] text. Also, if you need any help finding a [[command]], you can use the new <code>find</code> [[command]]. For example if you type <code>find mat</code> you will get a list of all the [[console command]]s with the text <code>"mat"</code> 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.
 
{|
| <code>[[sv_cheats]] 0/1</code>
| This is similar to [[Half-Life]], except in [[Source]], the cheats are enabled right away instead of on the next map change. It turns off and on the use of "[[cheat]]" [[console command]]s. You will need to activate cheats with <code>[[sv_cheats]] 1</code> before using some of the [[command]]s listed below.
|-
| <code>[[Showbudget|+showbudget]]</code>
| The first thing you'll want to do is bind some key (or mouse button) to <code>+showbudget</code> What does <code>+showbudget</code> do? It displays a breakdown of how the engine is spending it's time drawing each frame on the screen. You'll see how long it's spending time drawing world brushes, entity brushes, prop models, displacement surfaces, 3d skybox, ropes, and other items. Now, with this information, you can optimize your map with good information. With what <code>+showbudget</code> shows you, you will know exactly what to optimize. Is your worldbrush load high? Then you know you need to simplify or improve vis blocking. Are static prop models overloading your view? Then you'll need to work on them, etc.
 
For a complete list of what the different categories mean, see [[Showbudget]] for more information.
|-
| <code>mat_wireframe 0/1/2/3</code>
| 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 <code>[[sv_cheats]] 1</code> to use this [[command]]. Mat_wireframe 2 and 3 give slightly different wireframe tracings, focusing on textures and brushwork, respectively.
|-
| <code>mat_leafvis 0/1</code>
| 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]].
|-
| <code>mat_bumpmap 0/1</code>
| 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 <code>+showbudget</code>. You will need to activate cheats with <code>[[sv_cheats]] 1</code> to use this [[command]].
|-
| <code>mat_specular 0/1</code>
| Similar to the mat_bumpmap [[command]], this toggles on and off specular reflection in the engine. You will need to activate cheats with <code>[[sv_cheats]] 1</code> to use this [[command]].
|-
| <code>ent_messages_draw 0/1</code>
| 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.
|-
| <code>developer 1/2</code>
| 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.
|-
| <code>cl_showfps 0/1/2</code>
| Shows and updates the frames per second that the frame rate is currently running at. (<code>cl_showfps 2</code> is slower and much simpler to read)
|-
| <code>impulse 81</code>
| Replaces your weapon with a set of reflective balls (<code>models/shadertest/envballs.mdl</code>) used for checking cubemaps. You will need to activate cheats with <code>[[sv_cheats]] 1</code> to use this [[command]].
|}
 
==Optimized Design==
 
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.
 
===Skybox===
 
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.
 
===Dynamic Lights===
 
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.
 
===Water===
 
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.
 
===Brushwork===
 
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.
 
===Visibility===
 
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.
 
==See Also==
 
* [[Controlling Geometry Visibility and Compile Times]]
* [[Troubleshooting Level Design]]
* [[Optimization]]
* [http://www.student.kun.nl/rvanhoorn/Optimization.htm zombie@computer's Optimization Guide]

Latest revision as of 15:21, 21 January 2024