Performance Tweeks (while waiting on HDR)
We're all waiting on Valve to release the beta SDK so we can add HDR lighting effects to our maps. I've spent the last few weeks looking at ways to pick up a few fps AND add detail to dod_anvil in anticipation of the SDK release. Although the following is pretty long...it's in response to a thread on the DoD forums on map optimization. Break out the no-doze...
I've learned map optimization by shear length of time spent mapping, reading a lot of info on the old valve mapping sites and the new wiki and the other mapping sites, plus there are a lot of really nice tools available in Source to help you optimize your maps. Some common sense things:
1) Build your levels from the ground up w/respect to gameplay and performance. You need both to be succesful.
2) Keep your skybox (not the 3d one) in as tight as you can make it...lower your skys to rooftoop height.
3) Try and keep your map units common. Use 8, 16, 32, 64, etc. This is the one I fail at and as such I have to spend a ton of time adding in optimization tricks. If you can stick to base units, wall thicknesses, heigths etc, your map will compile faster, there will be less face splitting, and fps will be greater right out of the box. All my maps are made at the one unit level and in Hammer they look like spagetti. It's been my greatest technical failing as a mapper (sticking to a one-unit grid). As such I have to rely on tips 7 & 8 more so than I should.
4) Keep volumetric smoke, ambient sounds, weather effects, and other non-critical gameplay events OUT of your maps. Sure...they add "ambience" but more often than not they kill perf. Screw the realists...I want a good MP fps experience and gameplay and FPS are EVERYTHING. Once you get a great playing map try and add those details as you can IF the map can sustain them FPS-wise.
5) Use the following tools for the associated reasons:
+showbudget...this tool shows you what impact models, sounds, textures, world geometry, etc has on performance. You can see what's causing your perf drops and as such you can fix problem areas
mat_leafvis...This is a GREAT tool. Ever wonder why, as you walk around, you get these HUGE fps drops but you can't see anything that would cause it? It's because what the engine see's is not what you see. The engine see's whatever happens to be visible from the "LEAF" you are standing in. mat_leafvis draws a box around you in-game and shows you what the engine can see. In a lot of cases all that's needed to break up those really large leafs is a hint brush. In amny cases it's because the leaf you are standing in extends far into the sky so the engine see's over portions of the map you, as a player, don't see.
mat_wireframe...Use that in conjunction with mat_leafvis and you'll be able to see what the engine see's.
6) Be ruthless. If you build a map with lots of "stuff" but nobody ever uses the "stuff" or goes in the room w/ the "stuff" then KILL THE STUFF! Remove the room from your map. There's a reason why people don't use the room you put in and as such there's then no pupose for it in-game and all it's doing is taking up valuable resources. It's like the deleted scenes from a movie you see on DVD: "I hated to let this one scene go but it didn't advance the story so it had to go to get our running time under 2 hours"
7) Playtest, playtest, playtest, playtest and get a thick skin. Let your friends tell you exactly what they think about your map w/o suger-coating it. If it has perf issues listen to them...if it has gameplay problems...listen to them. You may have an artistic side yearning to be let free but the reality of the situation is if you make a pretty map that nobody plays because perf sucks so bad what's the point? The world is full of wanna-be artists who eat dirt for dinner. Don't be one of them.
8) Be patient. Don't rush into releasing a map before it's time. If you are dedicated to mapping but have real-life issues go tackle the RO issues and get back to mapping when you have time. I've seen many, many rush-jobs that might have been something special ruined because they were released too early and got bad press.
9) Build your maps first w/o the eye candy...you MUST have solid gameplay before you go into a Sourcification process to beautify your map...don't get so hung up on that pretty house facade or the gentle curvature of a spiral staircase that you forget about rule number one: GAMEPLAY UBER ALLES.
I could go on and on and on but soon the entire mapping community will be fast asleep. Just remember gameplay is far more important than anything else. The look might get you noticed, but the gameplay keeps you in the house.