After recently delving into Valve's mapping world in order to make a L4D campaign out of Half-Life: 2, I've gained some valuable experience. What better time then, I thought, than to write some of the optimisation tutorials I've been thinking about? Some of this is what I've picked up from Valve's maps; some, including this tutorial, are what I've come up with myself. I hope they come in useful. 
Stairs
When making your arbitrary bits-and-pieces for a map, your goal should always be to make the best structure you can while creating the least polys (triangles) you can for the engine to have to render. Before I go any further, I want to make a point which should NEVER be disobeyed, regarding the tools/nodraw texture: whenever you make a new brush, ALWAYS create it with the nodraw texture and then texture the faces you're able to see. This minimises the faces the engine will have to draw, since the ones you'll never see in-game aren't even compiled into the map.
That aside, we move on to stairs. They can be pesky little things if you don't get them right, and in my experience this is the best way I've found to do it.
Enclosed Stairs
These types of stairs are ones that reach completely from one wall of a corridor to the other. You cannot see the sides of them or go underneath them, so the number of faces drawn should be minimal.
First, choose your size of step. My recommended size is either 8 units high, 12 units deep (the general standard) or 8 units high, 16 deep (which I'm inadvertently used to), and wide enough to go the width of your hallway. Create one step in nodraw, place it at the top of your staircase and then shift-clone it in a stair-like fashion until you reach the floor. Note that you can texture the step before you clone it, but make sure not to have Texture Lock enabled (unless you're using a specially aligned step texture) otherwise your stairs' textures will look strangely identical from in-front, which can ruin the realism a tiny bit.
To quicken compile times, we want to get the simplest brush structure possible. A rectangle shape must be split into two triangles, whereas a triangle shape is obviously only one, so select all your steps and cut them at once to leave them just as triangular prisms. This isn't so important for enclosed stairs but is more important for others, as you'll soon see.
Now, tie all your stairs to a func_detail with Ctrl-T. Stairs make masochistical visleaf cuts unless they're func_detail, so don't forget this step.
You may also notice that there's a lot of empty space underneath the stairs. This won't matter as, since the stairs meet each other's edges, the player won't be able to see underneath. Do not fill the space with a brush, even a func_detail one, as it's completely unnecessary. Remember the Tesco motto: “Every little helps”.
Finally, the clip. Ever tried to jump on stairs? Isn't it annoying when you ricochet off them at an angle? Creating a clip brush like so solves this problem while also allowing Engineers to build properly on the stairs. If you have large, tall stairs and want Engies to be able to build on each individual step, make the clip brush a player clip and it won't affect the buildables. Also, don't func_detail the clip as it prevents it from being put into the correct visgroup and clips don't cut visleaves anyway.
Textured, things should look like this:
Open Stairs
Open stairs are still very simple and are where the stairs don't take up the entire width of a room but cannot be crawled under. They look like this:
Firstly, make the basic slope your stairs will be on. Once again, I'd recommend a 2:3 or 1:2 (rise:run) ratio.
Now, make your top step and cut the oblong into a triangular prism. This will reduce the amount of triangles the engine will have to draw for the end product, as shown below:
This is the main thing people get wrong with stairs: while the right may seem the simplest way to make them, it's by far more taxing on the game engine than the left.
Now, texture the stairs. You shouldn't end up texturing the base slope's face as it's covered by the rest of the stairs and so is unseen.
Finally, func_detail and add the clip:
If you want, you can add a bit of detail. Firstly, select the entire stairs and press "Apply Current Texture" with nodraw as the texture to get rid of all the previous textures. We will re-texture the stairs at the end.
Now, shrink the width of the stairs by one unit either side and create another ramp that runs along the full slope of the stairs, like so:
Split the ramp and shrink both new ones to become one unit wide. Then, sit them on either side of your stairs.
Delete the triangular ramp underneath, since it can no longer be seen and so is not needed.
Finally, re-texture, func_detail and clip.
Framework stairs
These are stairs that can be crawled under, like so.
There are two main types, either with or without gaps.
Without Gaps
Follow the Open Stairs method so that you have a base ramp with stairs on top, then delete the base ramp to leave the stairs. If you left them like this, imagine how many unnecessary polys you'd get on the underside:
To combat this, and make the stairs look generally nicer, create a nice brush that follows the slope of the underside of the stairs, like so:
Now, we have two polys underneath with our one rectangular face, instead of loads with our many stairs.
Shrink the stairs by a unit each side, then add the detail like in the Open Stairs method:
Finally, texture, func_detail and clip.
With Gaps
Stairs with gaps in-between require a little different setup. Firstly, create the outside guides for your stairs (which you could just clone from having done the Without Gaps method):
Next, put in your stairs. For this example they're one unit high.
Now, texture the rest of your stairs and func_detail them. Make the clip a player clip this time, as a normal clip may stop small objects from being able to drop through the gaps in the stairs.
With a little practice, Framework Stairs With Gaps can look pretty stylish. Check out the details on these:
If you'd like to use any of these stairs, the VMF is here: http://www.mediafire.com/?5gwuzmltztt. Note that the frames of some stairs, like grazr said below, should be made func_lod and are not currently in the VMF. I'll reupload once I've fixed them.
Stairs
When making your arbitrary bits-and-pieces for a map, your goal should always be to make the best structure you can while creating the least polys (triangles) you can for the engine to have to render. Before I go any further, I want to make a point which should NEVER be disobeyed, regarding the tools/nodraw texture: whenever you make a new brush, ALWAYS create it with the nodraw texture and then texture the faces you're able to see. This minimises the faces the engine will have to draw, since the ones you'll never see in-game aren't even compiled into the map.
That aside, we move on to stairs. They can be pesky little things if you don't get them right, and in my experience this is the best way I've found to do it.
Enclosed Stairs
These types of stairs are ones that reach completely from one wall of a corridor to the other. You cannot see the sides of them or go underneath them, so the number of faces drawn should be minimal.
First, choose your size of step. My recommended size is either 8 units high, 12 units deep (the general standard) or 8 units high, 16 deep (which I'm inadvertently used to), and wide enough to go the width of your hallway. Create one step in nodraw, place it at the top of your staircase and then shift-clone it in a stair-like fashion until you reach the floor. Note that you can texture the step before you clone it, but make sure not to have Texture Lock enabled (unless you're using a specially aligned step texture) otherwise your stairs' textures will look strangely identical from in-front, which can ruin the realism a tiny bit.

To quicken compile times, we want to get the simplest brush structure possible. A rectangle shape must be split into two triangles, whereas a triangle shape is obviously only one, so select all your steps and cut them at once to leave them just as triangular prisms. This isn't so important for enclosed stairs but is more important for others, as you'll soon see.

Now, tie all your stairs to a func_detail with Ctrl-T. Stairs make masochistical visleaf cuts unless they're func_detail, so don't forget this step.

You may also notice that there's a lot of empty space underneath the stairs. This won't matter as, since the stairs meet each other's edges, the player won't be able to see underneath. Do not fill the space with a brush, even a func_detail one, as it's completely unnecessary. Remember the Tesco motto: “Every little helps”.
Finally, the clip. Ever tried to jump on stairs? Isn't it annoying when you ricochet off them at an angle? Creating a clip brush like so solves this problem while also allowing Engineers to build properly on the stairs. If you have large, tall stairs and want Engies to be able to build on each individual step, make the clip brush a player clip and it won't affect the buildables. Also, don't func_detail the clip as it prevents it from being put into the correct visgroup and clips don't cut visleaves anyway.

Textured, things should look like this:

Open Stairs
Open stairs are still very simple and are where the stairs don't take up the entire width of a room but cannot be crawled under. They look like this:

Firstly, make the basic slope your stairs will be on. Once again, I'd recommend a 2:3 or 1:2 (rise:run) ratio.

Now, make your top step and cut the oblong into a triangular prism. This will reduce the amount of triangles the engine will have to draw for the end product, as shown below:

This is the main thing people get wrong with stairs: while the right may seem the simplest way to make them, it's by far more taxing on the game engine than the left.
Now, texture the stairs. You shouldn't end up texturing the base slope's face as it's covered by the rest of the stairs and so is unseen.

Finally, func_detail and add the clip:

If you want, you can add a bit of detail. Firstly, select the entire stairs and press "Apply Current Texture" with nodraw as the texture to get rid of all the previous textures. We will re-texture the stairs at the end.
Now, shrink the width of the stairs by one unit either side and create another ramp that runs along the full slope of the stairs, like so:


Split the ramp and shrink both new ones to become one unit wide. Then, sit them on either side of your stairs.

Delete the triangular ramp underneath, since it can no longer be seen and so is not needed.

Finally, re-texture, func_detail and clip.
Framework stairs
These are stairs that can be crawled under, like so.

There are two main types, either with or without gaps.
Without Gaps
Follow the Open Stairs method so that you have a base ramp with stairs on top, then delete the base ramp to leave the stairs. If you left them like this, imagine how many unnecessary polys you'd get on the underside:

To combat this, and make the stairs look generally nicer, create a nice brush that follows the slope of the underside of the stairs, like so:

Now, we have two polys underneath with our one rectangular face, instead of loads with our many stairs.
Shrink the stairs by a unit each side, then add the detail like in the Open Stairs method:

Finally, texture, func_detail and clip.

With Gaps
Stairs with gaps in-between require a little different setup. Firstly, create the outside guides for your stairs (which you could just clone from having done the Without Gaps method):

Next, put in your stairs. For this example they're one unit high.

Now, texture the rest of your stairs and func_detail them. Make the clip a player clip this time, as a normal clip may stop small objects from being able to drop through the gaps in the stairs.
With a little practice, Framework Stairs With Gaps can look pretty stylish. Check out the details on these:



If you'd like to use any of these stairs, the VMF is here: http://www.mediafire.com/?5gwuzmltztt. Note that the frames of some stairs, like grazr said below, should be made func_lod and are not currently in the VMF. I'll reupload once I've fixed them.
Last edited: