I've been optimising stuff for the last few days, so I thought I'd post a bit about it. A lot of level designers already know this stuff, so I'm just posting it more of a "what the hell are they playing at over at FF towers" kind of fashion.
So, here's a bit about "the process", as I like to call it. The process is an ongoing process. It isn't a fun process. If you want your map to run quickly and vis to chomp through it like nobody's business, then you must adhere to the process. Basically, this means keeping your world geometry as boxy and orthogonal as possible. Every part of the map that is not concerned with visibility should be func_detailed or changed into a prop. At a very basic level, the bsp map format uses each polygon face to 'cut up' the world. This happens recursively until it cannot be split up any more. Why is this important? Well, you want to keep the 'cutting up' of the map controlled. Too much splitting = lots of leaves = slow, both to compile and to play. A level designer generally wants to control this splitting and use it where necessary, but omit it where it's not. We have a decent amount of control, but of course it's not possible to get everything as we want it. It makes more sense to spend time on the important things, too. Try and get the largest returns in speed for your investment. Also, while gnashing your teeth, remember that it will cut your compile times down significantly. I optimised push and vis went from four minutes to one minute. With the bases flipped, this will likely translate into something like a ten minute saving per compile. Now, push is fairly simple; imagine how much time you can save with larger maps.
In many cases, geometry is not serving any actual purpose when it comes to vis-blocking. If you've made a tin hut on the top of a building roof, it will probably be advantageous to make it a func_detail. The reason being is that the hut will cut up the world and it won't actually aid the engine in blocking off any kind of useful stuff in terms of visibility. Furthermore, in many cases, it may be quicker to actually render something than to have to partition it off, particularly if it's an odd shape. Ever compile something and get the rather abstract-sounding "Leaf portal saw into leaf" warning? That's vis yelping because the map needs to be optimised.
I find staying on a 32 unit grid helps a lot when it comes to keeping things tight and fast. Nearly every curve, corner, strut, girder, column is a func_detail or a prop. If a room is circular then, if possible, I will tend to create it as a box, then create func_details for the curves. If the back side of the curve is not viewable to the player, then you can simply merge the vertices to form a point. The nodraw texture should always be applied to the hidden faces of func_details since the func_detail doesn't visblock. Same deal for any world geometry that is completely obscured behind the func_detail. The same goes for geometry hidden by displacements. If you have the time and you feel it is effective, go nuts.
Here's some pictures of push from hammer with various things turned on/off so you can get a feel for what I'm talkin' 'bout. I'm going from everything on and progressively turning everything off; you can see how the detail strips away to leave what vis actually has to deal with -- the vis compexity is a fraction of what is on display.
Click the thumbnails for a larger picture.
Yard -- everything on:
No 3d skybox geometry:
No displacements:
No props:
No func_details & func_ brushes:
Other stuff. The shell of the main corridor (this could be optimised still further, but it's already nice and fast, so I'm not going to spend more time on it):
The side warehouse with everything on:
The side warehouse stripped down to world brushes:
In other news, I've been optimising away and creating some LOD models for my props in the past few days. All I have to say is "Jeez" because the SDK and tools aren't making this much fun. I created everything as described by the valve wiki, yet I've had nothing but problems. This culminated in my props compiling perfectly (no errors, no warnings) and the LOD functioning perfectly in HLMV and Hammer, yet ALWAYS displaying the LOD1 model at all distances ingame.
So, I've wasted umpteen hours on this and there'll no doubt be a simple but esoteric problem. It seems half of my dev journals involve complaining about the SDK so I probably sound ungrateful and embittered, but it is a huge problem for me when I spend time on stuff that could be better spent elsewhere. I resent spending time resolving problems when there is no error message to guide me! I also had a collision model problem with a rubbish skip prop. The collision model would refuse to work. It finally worked after re-trying about a million times, but I'm not quite sure why. *gnashes teeth*
In addition to this problem, Hammer has now started picking up our SVN working copy resources. This results in duplicates for every sound, model, material and other resource type showing up twice in Hammer. Want to search for a model? Two will show up. Want a brick texture? They'll all show up twice. It's really, really annoying. Mirv has been able to knock up a script to eliminate this problem with our materials, but everything else is still affected by the problem. I've emailed valve, but received no reply as of yet. Other mod developers are suffering from the same problem, so I hope they fix it soon.
I would like to thank Thom Yorke and The New York Dolls for easing me through this particularly frustrating period of time.
In .. more... other news, the testing tonight (Sunday) went pretty well. Hunted is looking rather nice and the player models look very solid. Rebo finally fixed the bounding boxes for the models, so you can now throw players around properly with explosive weapons; a long-standing bug had prevented this working correctly in the past. Watching player models die & fly always gets a laugh out of me, especially when they slam brutally against a wall, spraying blood against the surface. :D
Our LUA is being overhauled once more, with Mulch, Olah and the trepids putting in a lot of work. The trepids are more knowledgeable than the rest of us mortals when it comes to entities and the TFC entity system in general, so they've been doing a lot of probing, debating, complaining and saying "can our LUA do this and if not, why not?" There've been a few tensions here and there, but ultimately we're getting a better LUA system for mappers to use, so it's all good.