COUNTER-MAP:  Counter-Strike Mapping
Visit us on IRC at gamesnet.net, #countermap
Pic of the Week
Poll
Map Spotlight
Weekly Playtests
Random Map Idea
In the News
About Counter-Map
The Crew
Mapping Forums
Important Links

Submit

Tutorials

Mapster
Nemesis' Utilities
Map Packs
Texture Packs
Mapping Utilities
File Database
EditLife.net
 

 Back to Tutorials Page   Other Tutorials by Relic25 

Hint Brush Tutorial
By Relic25

Usefulness of content:  202 users  
 out of 5
 4.3 out of 5

Before we get started, to use hint brushes you must have Zoner's compile tools, which can be found at the Half-Life editing resources center at http://halflife.gamedesign.net, Then you must add ZHLT.wad to your list of textures in Hammer. You should also get the latest versions of Hammer and HLCC while you are there.

1 - How Does VIS Work?

VIS stands for Visibility Information Set, in other words, what the computer thinks you can see. The engine will only draw what VIS has determined is visible, and has trouble if it tries to draw too much. You only need hint brushes if your r_speeds are too high and you want to reduce them by controlling manually how VIS determines what is visible. (go into console, type '' bind p "developer 1; r_speeds 1" '' without the ''s, then p will always bring up your r_speeds). The r_speeds you are interested are the numbers in the middle (w-poly). r_speeds of under 600 are necessary for smooth multiplayer gameplay on lower-end machines. VIS calculates what you can see based on what VIS block you are standing in. Extremely large VIS blocks can cause the computer to think it can see more than in reality. VIS blocks are determined by world brushes (entity brushes DO NOT affect VIS blocks).

2 - What Do Hint Brushes Do?

Hint Brushes break VIS blocks into smaller pieces, which takes more time to compile, but can reduce r_speeds if done correctly. Say you have a large hallway with lots of protruding hallways. (Overhead View):

Here's how the VIS Blocks could be broken up (note that it will not always break up in the same way, as it depends on the order in which polygons were placed in WC. (overhead with VIS blocks - note that VIS breaks rectangles into triangles):

Now, standing *ANYWHERE* in the central hallway's VIS block, the computer would assume the player could see **EVERYTHING** (it calculates based on what could possibly be seen at any time from the VIS Block, in this case, the entire level. The Blue lines represent the Line of Sight from the VIS Block) which would make for obscene r_speeds, even though not many polygons are visible at any given place:

Here is an example of hint brushes being used to chop it up (we'll get into proper placement of the hint brushes in a later section):

Here is an example of what the game thinks the player could see from the same exact point in the hallway now. Note the difference:

3 - How do I Put Hint Brushes in my Level?

The term "hint brush" is somewhat of a misnomer. It really only has one face with the hint texture, the rest are "Skip". if you are using a 6-sided block (I recommend that shape for hint brushes) you should make 5 sides skip and 1 side hint. then, line it up so that the side with the "hint" texture lies exactly where you want the VIS block to be split. it should be slightly larger than the area you want to split, cutting into the walls a little. Then compile with Zoner's tools, and you are off. Here is a picture from Hammer of a hint brush (the other 4 sides are all skip texture, use the "Face Properties button in Hammer to select the one face you want and apply the hint texture to it):

 - CLICK TO ENLARGE
(click to enlarge)

4 - How Can I Tell if They are Working?

Your r_speeds should be lower, of course, if it you have used the hint brushes properly. But just adding hint brushes won't necessarily reduce r_speeds, you have to put them in correctly. In fact, misuse of hint brushes can actually increase r-speeds! We will discuss the reason for this later. You can tell if they have cut the level currectly by playtesting the level. You should be able to tell when you move from one VIS block to another because your r_speeds will jump all of a sudden. If they jump (up or down) in the right places, you'll know the hint brush is working.

5 - Where do I Put the Hint Brushes?

Using the previous example, it may feel more natural to place the hint brushes like this:

The result is a slightly greater increase in r_speed economy, at the cost of increased compile time:

However, if the player were to move several inches to the right, into the other triangle, the benefits would be lost. And if the player were then to step several feet forward, it becomes less advantageous:

Compared to the original with:

The second approach works better at the edges but not so well in the middle, and the middle is usually the place with the worst r_speeds. I would recommend going with the first approach, or--if you have lots of RAM/time to spare--Place hint brushes in both of the locations. It saves even more space, but at the cost of compile time. And remember, if the number of VIS blocks doubles, compile time QUADRUPLES (I'll explain this phenomenon later):

The reason the first approach works is because of the angles of the hallways, as can be seen here, where we are careful to provide slightly more room than absolutely necessary:

However, this is generally useless as this area would not have very high r_speeds anyway. Remember to limit your hint brushing to where it is needed.

Caution must be used in placing the hint brushes to avoid increasing r-speeds unecessarily. Always keep in mind that your hint brushes will 'fracture' object brushes that they intersect. For instance, if you have a flat wall and run a hint brush into or through it, the wall will be split, causing the addition of at least 1 w-poly, but probably more.

6 - Where do I Put the Hint Brushes II?

Levels are more than just ground, ceiling, and walls. (well, good levels are.) Good levels have lots of things in them which the players can see and possibly interact with. In my cs_library level, one area was very problematic VIS-wise, because it had lots of breakable computers and swivel chairs behind cubicle walls. The problem was, cubicle walls do not extend to the ceiling, so even when all of the computers/chairs were not visible, the computer thought they were, which drove my r_speeds over 1000. Using Hint brushes, I was able to better inform the computer of what to draw. Not only should you plan around your architecture, you should plan around the entities/entity brushes inside. Take this map, for example. It's another overhead view, with the pink pieces representing a bunch of highly detailed r_speed-draining func_walls, such as the swivel chairs from the Hammer prefabs):

Here are its VIS Blocks:

If the player is standing here, even though he cannot see the room full of r_speed-jacking chairs, the computer thinks the player can, and will waste resources drawing them:

If hint brushes were added like this, it would fix most of the problem:

As you can see here:

Note with this map that we were only able to reasonably reduce to half the number of entities in view from that position. However, that should be plenty to salvage your r_speeds. But any time you need a hint brush, first take time to consider whether the problem results from simplistic design or poor layout. For instance, that level could be changed to this, and there would be no need for hint brushes:

Ultimately, though, you can decide which way you want to set your level up, and you should rule r_speeds, not the other way around. Hint brushes give you an extra degree of freedom to decide which way to best create your level, to best implement your theme, rather than forcing a maze of drunken corridors on you.

7 - VIS, Hint Brushes, and Three Dimensions.

One similar aspect of all good maps is that they are conspicuously three-dimensional. There are multiple floors, staircases, ramps, elevators-the level is much more interesting like this. Unfortunately, VIS is easiest to understand when dealing with flat levels. Hint Brushes can be necessary if you plan on going vertical in your level (and you should, if you are this advanced.)

The VIS Blocks I have been referring to are 3-dimensional. In the past examples I have made them look 2D to simplify the diagrams, but this is not always the case. They normally rise to the ceiling, but can be cut horizontally as well as vertically. Therefore if your walls do not reach the sky, the computer will think it can see everything on the other side (side view):

And here it is with the VIS Blocks showing (they still have triangular bases, but each triangle rises upwards as one piece):

Remember that the VIS Block the player is in is not on the ground but at eye level. In the case of the items in cs_library, I had to set several horizontal hint brushes. Here is a screenshot from the player standing on a bit of debris:

 - CLICK TO ENLARGE
(click to enlarge)

Here is a screenshot from the same player jumping. Note how many computers and chairs become visible:

 - CLICK TO ENLARGE
(click to enlarge)

Here is a 2D Diagram of that part of the Level, with both perspectives (side view):

 - CLICK TO ENLARGE
(click to enlarge)

Here is a 2D Diagram of the breakdown of the VIS Blocks before the hint brushes:

 - CLICK TO ENLARGE
(click to enlarge)

Here is the 2D Diagram with the hint brushes I used to keep the player from seeing the computers/chairs without jumping (side view):

 - CLICK TO ENLARGE
(click to enlarge)

Note that all three hint brushes are necessary to keep the standing player from seeing the computers/chairs in the far cubicles (hint brushes are allowed to go across and cut more than one VIS Block) when the player jumps, the items all become visible, and r_speeds go past 800 for a second. There is really no way to avoid this as all of the objects are visible to the player--no amount of hint brushes can stop what the player can actually see.

It is important to note that this was a totally 2D version of a 3D problem--there were far more than 16/18 VIS Blocks as there were two rows of cubicles with a hallway in between, and there were other hint brushes nearby not relevant to this example. The general principle, though, remains the same. These hint brushes allowed me to shave over 200 off my r_speeds when in the office area.

8 - Conclusion

Use Hint Brushes carefully, because if the number of VIS Blocks doubles, the compile time QUADRUPLES. Therefore place them where necessary. The math behind the double-QUADRUPLE phenomenon: Think of the VIS Matrix as a 45 45 90 triangle. When you add one VIS Block, you are adding one to the length of both legs (not the hypotenuse). The time it takes to compile is represented by the area of this triangle. If you don't understand this, that's ok, just know that you shouldn't add hint brushes without good reason.

xm177e2 has released one map for Counter-Strike, cs_library, in which he used many hint brushes, which can be found at http://members.nbci.com/dh39_xm177e2/cs_library.html

Everything I learned about hint brushes, I learned from Geoffrey DeWan's tutorial --I kept hearing that people were having trouble with hint brushes, despite having read "a long tutorial," presumably Dewan's, (it's the first one that comes up on Yahoo!) so I decided to rewrite it with the goal of making it as easy to understand as possible. I thought I would attempt to use simpler examples/only explain what is relevant to half-life/cs, and to help explain where to put the hint brushes for the best results. After you are done reading my tutorial, you should read his, as it covers some different ground, and you will probably find that you understand it. One small note about it: It's written for Quake II, so the "detail brush" he refers to would be a "func_wall" in HL.

 Back to Tutorials Page   Other Tutorials by Relic25 

 Rate this tutorial for us! 
 Poor   1  2  3  4  5  Excellent
 Usefulness of Content  
Get Hammer level editor, the most commonly used editor for CS and HL levels.
- - - - - - - - - - - -

Get Zoner's Half-Life Compile Tools, the premier compiling tools for CS maps.
- - - - - - - - - - - -

Get the "experts" Hammer configuration for CS mappers to utilize advanced custom CS entities.
- - - - - - - - - - - -

An improved CS:S entity definition file, to allow CS:S mappers to use all entities and options.
- - - - - - - - - - - -