A Guide to Using Hints

I’m getting tired of seeing people ask for help with optimisation, getting linked to this tutorial… http://optimization.interlopers.net/ then coming back with a mess of occluders and func_detailed buildings complaining that it didn’t work. Personally, I learnt optimisation through that tutorial coupled with reading numerous papers on the subject from various sources. I’m not going to talk about all the techniques available since they can usually be explained in a sentence, except for this one which I feel is the most important. To the end of stopping this problem now, I present my guide to using hint brushes…

[release]
[h2]A Guide to Using Hints[/h2]
Foreword
Game levels are huge, complex combinations of triangles which makes it incredibly intensive on computers to render all these triangles. To this end, different engines employ different techniques to cull these triangles so there is less to render and the whole game runs smoother.

VVIS.exe
The method source employs in order to cut down on polygons to render is pre-computed visibility checking. This basically involves separating the level into boxes or visleaves. The compiler then calculates for each box which other boxes are visible (even in the smallest possible way) and what objects reside inside the box. When you are moving around in game, the engine will see what box you are in and it will render all the other linked boxes and all the props contained within them. Contrary to popular belief, this is quite a favourable system since it is significantly less intense than real time occlusion when in game.

The Tools
The way to control these visleaves is by using hint brushes. Simply create a brush textured in ‘tools/skip’ texture and use the material editor to texture faces with ‘tools/hint’. It is important to do it this way because the skip texture does nothing (create a brush with just skip textures then compile and you’ve just wasted 10 seconds of your life). Conversely, the hint texture tells VVIS to define that face as the edge of a visleaf. Unnecessary hint faces will increase compile time and can potentially make the map run worse.

The Method
Firstly, you must understand that hints can’t work miracles. That is to say if you can see it, it’s going to get rendered. Below is a basic diagram of two rooms connected by a door along with the most common method attempted to optimise it (by those who don’t know how). It s quite easy to see that while standing in any of the boxes the other two are visible and all the mapper’s effort was wasted.

http://img832.imageshack.us/img832/3161/op1d.jpg

Now, this is the correct way to optimise this map. While standing in A, you can see B, C and D but not E. I’ve added a small scenario where it would be worth your time to optimise this section.

http://img405.imageshack.us/img405/3268/op2cx.jpg

http://img17.imageshack.us/img17/5797/op6t.jpg

As layouts get more complex, it becomes necessary to think for a while how you are going to optimise it. I cannot stress this enough… take the time to think about optimisation because if you don’t, you’re effort will be wasted.


I will however offer a shortcut, simply draw hint faces parallel to doorways to opposite walls (or even the skybox if necessary) and this will work pretty well (see below)

http://img195.imageshack.us/img195/6041/optimisation5.jpg

Special cases
When making stairs or holes through floors, you want to make the layout shown below. Basically, you define the area between the floors, extend the shape up to the ceiling and outwards to the walls. This method can be adapted to stairs and also holes by walls, just think about it.

http://img807.imageshack.us/img807/5162/op4h.jpg

Sometimes a gap between rooms will be long enough that it becomes possible to use diagonal visleaves to further optimise the area. One such example is shown below. As you can see, when standing in the green areas, more areas have been culled to optimise frame rate. This technique can also be used when dealing with corners.

http://img860.imageshack.us/img860/1410/op5.jpg

Optimisation at the object level is a very specialist technique. This technique works at the theoretical level and is best described in words. The idea is to make a brush around a singular specific prop with hint faces on all sides. This will separate the prop into its own visleaf. This means that VVIS will check if each visleaf can see this prop specifically, maximising the optimisation of it. This technique will make compile times increase dramatically so only use it for really high poly static props such as ragdolls or cars.

Final Notes
There is no hard and fast rule about the number of visleaves to use in a map. The more visleaves you have, the longer the compile time. However, if you separate each visleaf into 16 smaller ones, the effect will be largely the same. That is to say, if you have a spare year you can fill your map with 111 hint brushes and get to best optimisation possible (just a joke, not worth the effort).

When making hint brushes, it is best to use visgroups to hide all props, point entites and func_details. These aren’t considered by VVIS when making visleaves so why should you?

“Hey, didn’t I hear about this cracked VVIS that compiles better, why not just use that?” All that compiler does is allow VVIS to make bigger visleaves (currently limited to 1024 unit cubes)… this will make your map run slower compared to the normal VVIS assuming no extra optimisation.

Sometimes it won’t be worth optimising. If you have low poly props spread evenly throughout your map, normal VVIS will do a good job culling them in game. It’s always advisable to add hint brushes but it is worth a quick cost/benefit analysis in your head.

Finally, this tutorial is not complete. I cannot offer a general, perfect process of optimisation. Every map is different and all I hope to do is make the process more understandable.

Thanks.
[/release]

This was put together in one evening so I apologise for the quick images. I might update them with time. Also, I don’t want this thread to turn into a thread full of ‘how would you optimise this <image>?’ so please read through this and learn from it. I hope it’s useful.

Perfect timing, I need to optimize Luoto! :h:

thankyouthankyouthankyou :love:

I’ve been looking for a dumbed down version that anyone can understand, this just might do it (no offense meant with the “dumbed down”, but I find this to be alot easier than the other ones out there). Thank you

I was going for dumbed down to be honest. The ‘here are all the facts’ method in the other tutorial didn’t seem to work that well and no-one likes a laggy map.

I can’t remember where i learnt to optimize but i must say it was a bloody good source because my optimization is pretty good - hate to brag and such but i think ive got the method pretty well thought out

[editline]12th June 2011[/editline]

You would be the last person who i would think can’t optimize

Nice tutorial, hopefully people will see this and make adjustments to their maps, even if it is a little more work, the end map will be a lot more optimized.

you mean to tell me, people didn’t already do this?

Tis a worry

I recently had an insight into the VMF of someone who read the interlopers tutorial and tried optimisation. It was a mess, ergo this tutorial. I’m sure there are a lot of people who know this stuff already and I’m not denying that.