Decreasing Compile Times

One of the reasons why mapping is not a common hobby among people is due to the fact that much of the time involved in the activity is spent "idle", meaning that the time being spent is when you are not performing work on your projects. The culprit behind this "idle" time is the compiling process. For many years, mappers have struggled with lengthy compile times. A typical-sized map may take around 30 minutes to compile. That`s not so bad. But as you get larger and more complex, compiling times skyrocket. Very large maps can take several hours to compile. My first published map, "Maximus Overdrive", took around 5-6 hours to finish compiling. If a map is poorly designed, in particular, (technically, not necessarily aesthetic-wise) compile times can reach days, far more than what is considered "normal" for a map.Fortunately, compile times can be fought. It just takes some knowledge of certain level design techniques, and applying them carefully throughout your map so as to not cause other errors, such as leaks. Although many places discuss this same issue, I felt it was important enough to warrant another article.Below is a list of methods you can utilize to decrease compile times. Don`t think that all of them should be usedall the time - there are situations where something must be done a certain way. Some also may cause your map`s performance to spike if used in excess amounts. The trick here is to take advantage of these tips whenever it`s feasible.1. Detail BrushesOne of the best ways to fight long compile times is with detail brushes. Basically, a detail brush is a brush that appears in-game and functions normally, but is ignored during the compiling process. Because it is not counted in the compiling process, it makes compiling faster since it doesn`t have to consider that brush while it does it`s work.Detail brushes can be a lifesaver, but they must be used with caution. Detail brushes do not block visibility, since they are not counted in the compiling process. Because of this, you should never mark external geometry (i.e brushes that separate your map from the void) as detail, or you will end up with nasty leaks. In my opinion, it is best to begin marking brushes as detail once you finished designing the entire map. This way, you won`t accidentally copy a detail brush when trying to build your map, and you won`t be pulling your hair out trying to find that detail brush responsible for the leak.2. CaulkAnyone who has attempted to build maps for Quake III Arena or similar games probably has seen this texture. At first glance, it doesn`t seem like much - it`s an ugly bright pink color with the word "Caulk" written in big black letters. This is only how your editor sees it. The game, however, sees caulk differently. Rather than drawing a pink color on the brush that this texture is applied to, it draws nothing.Caulk is special in the sense that it does not draw, but it still blocks vis, meaning that you can use it to seal your map from the void without generating leak errors. Not only that, but it also helps to reduce compiling times, as well as the double-whammy effect of increasing FPS as well. Quite an accomplishment for just one simple texture! One of the most common uses for caulk is on the surfaces of brushes that cannot be seen by the player. For example, if you have a crate that is turned so that it is not directly facing the wall it is placed next to, and the player will never be able to see the back of the crate (the side facing the wall), it is an appropriate situation to use caulk.Another use for caulk is sealing curves from the void. Curve patches, unlike brushes, do not block vis, so attempting to use them to seal your map will cause leaks. For this reason, brushes must be placed behind curves that supposedly appear to make the external framework of your map. Of course, if you use a typical texture like concrete, your map will suffer in performance and compile time because the game still draws those textures, and the compiler still considers those faces. Caulk, in this situation, is definitely your friend. Apply caulk to the brushes concealed behind the curve.3. Use Entity LightsThere are some textures - light fixtures in particular - that automatically emit light from the surface in which the texture was applied. The light is the same color as the dominant (most common) color in the texture, so a green light fixture will emit green light, a blue one with blue light, and so on. Some sky shaders also have the ability to emit light, which is especially useful for outdoor areas.That said, there is a cost to their convenience and beauty, and that cost can be measured in increases to compiling time. Your best bet? Think in your head, "Can I recreate the light coming from a surface light shader with an entity instead?" If the answer is yes, then apply a no-light version of the light texture onto that surface, then place a light entity of the appropriate color right below the fixture. Change settings such as light radius as needed.4. Use Hint Brushes Sparingly, and Only When NeededUh oh, it`s that dreadful problem many mappers encounter - high r_speeds, low FPS... we`ve probably all been there before. There are numerous ways to solve this, and one common method is the use of hint brushes, which divide the visleaves / portals of a map so that the game doesn`t attempt to unnecessarily draw rooms that the player cannot see.Although hint brushes can be a great help in repairing such issues, it should only be used when you`ve tried everything else, and I mean everything - caulk, areaportals, etc. you name it. The reason? Hint brushes are notorious for adding hours to compile times, mainly the vis process in particular. Dividing visleaves and portals causes the visibility data to become more complex since it is being "cut up" further. Think of a big sheet of dough, for example. Cut the dough in half, that only takes a second. Cut the dough into say, 100 individual pieces, that`s going to take a bit longer, especially if you are concerned with delicacy.

You probably shouldn`t need to use hint brushes on small maps, especially if you have been working with caulk and area portals. On large maps, try just placing one or two hint brushes. You don`t need to put a hint brush in every single hallway or room. You may be able to reach a reasonable FPS through very few hint brushes.5. Terrain Should Never be StructuralEarlier I discussed the use of detail brushes to decrease compile times. For terrain, this is especially important. One mistake a beginner mapper might make is use terrain to actually make up the external, void-separating geometry, as if it were a wall. Unless you want to add some hours to your compile time, you should never do this. Instead, place caulked brushes where you want to place the terrain, then add your terrain and mark it with the detail spawnflag so it is ignored by the compiler. This is a similar technique to the one used for caulking behind curves. It`s a bit of extra work, but your compiler will thank you.6. Attempt to Fix Overlapping Brushes Whenever PossibleNot only do overlapping brushes cause nasty Z-Fighting effects, (an effect where two textures share the same plane, and the game engine does not know which one to draw, so it does both, creating a "zebra-like" effect, typically undesirable in professional level design) they can put stress on your compiler, increasing it`s compile times. Sometimes overlapping brushes are easy to fix, other times they are not. There`s different ways to fix this, usually it is done by adjusting the geometry so that brushes aren`t occupying the same positions in space. More complex cases may warrant the use of caulking or nodraw.7. Don`t Box Your MapsYou`ve got a leak, a mapping error that plagues many level designers new and old. There`s two simple methods of fixing this - one is the right way, the other is the wrong way. In the right way, you locate the position of the leak (gap in the wall, entity out in void, etc.) and fix it yourself. In the wrong way, you put a big box around the map. While this fixes the error, the problems that stem from a real leak will continue to scourge your map. This includes external faces not being culled, players can fall out or see outside your map, FPS is hit, and your compiling times skyrocket. Plain and simple - don`t box your maps. Boxing your maps shows you don`t have the patience to fix the problem yourself, and you won`t be hitting game design studios anytime soon if your level construction isn`t worthy of a position in the industry. The only exception to this is space maps.