Here's a guide all about areaportals. Where to use them, where they are used, and just what the hell they do! What is an areaportal? An areaportal is a means of reducing the amount of objects that the engine has to render based on the player's viewing angle (the view frustrum) through an areaportal or a bunch of areaportals that are visible. Here's a simple diagram. Imagine this as a room with a wall dividing the area into 2 parts and in the center of the wall is a window. In this window, an areaportal is placed. On the one side of the wall is the player and on the other are 4 oildrums in a neat row represented by little black circles.. In red is the area outside the view frustrum and in green is the area inside the view frustrum. As you can see, the two oildrums are inside the view frustrum (remember, this is the player's view) and so they are being rendered whilst the oildrums outside the view frustrum are not. This means that everything which the player cannot see is not being rendered. Useful! Now let's put this to practice. A simple example Download this map! - Includes BSP and VMF Here is the same example previously described but made for real. It's the exact same setup as shown in the diagram except their are considerably more oildrums. Let's view this setup in game with some fancy comparisons to nail the point home! With the areaportal off, that's every single oildrum in that section of the room being rendered. All 32 of them. With it on, you will notice that oildrums on the left and the right are no longer being rendered. Clearly our areaportal friend is doing his job as he prevents the oildrums outside the view frustrum from being rendered! Now let's move closer and into a corner to see what's being rendered - remembering how our viewing angle affects the number of objects being rendered. And now let's turn it on again. As you can tell, that's a huge difference that when applied to real maps can greatly benefit it's performance. Speaking of which... Show me more (real life) examples! Now for a series of real-life examples taken from multiple stock and custom maps. Green bits represent where an areaportal has been placed. A description is written below each group of images. Looking to the right and left, you can see the number of objects that are no longer being rendered which includes both props and brushes. It's the same ordeal here but the difference is more extreme because the angle of the view frustrum is more acute then before. Most objects behind the wall on the left are no longer rendered. Again, it's the same. Lots of stuff being unrendered. Basic Areaportal Construction Areaportals are very easy to create within your map. Essentially, you place areaportals at every exit (doors, windows, etc) within an area to seal it off just like you would seal a map off from the void using world brushes. Creating one is as simple as creating a brush which completely fits the size of whatever you are trying to seal off, texturing it using toolsareaportal and then tieing it by hitting CTRL + T and choosing func_areaportal from the drop-down menu. Here's a simple example of how you would use areaportals in a simple room with 2 areas. Area 1 has two areaportals at either exit leading into Area 2. This will work correctly. However if we were to remove one of them... ...VBSP will get very angry and tell us that an areaportal "doesn't touch two areas". Loading up the pointfile will give us a red line which loops back out of the first leak it finds withing the area and back round into our single areaportal. Where and When to Use Them There are many ways in which areaportals are used. Here are some various methods. The 'Door' Method This method involves 'opening' and 'closing' an areaportal linked to a func_door. When the door opens, the areaportal opens; when it closes, the areaportal closes. You link your areaportal to your door by entering the name of the door under the 'Name of Linked Door' property of your chosen areaportal. Remember, when the areaportal is closed, anything behind it will not be rendered so make sure the areaportal is thin enough to fit inside the door brush or model otherwise it will disappear when the areaportal closes. The 'Always Open' Method These areaportals are used extensively and are the same type used in the simple example shown earlier in this tutorial. Here are a few examples from Valve maps to show how they've used them. This is by far the most common usage of areaportals; used to section internal rooms within a building nice and neatly. This is where we start to get a little more creative. This areaportal splits the middle area of Badlands from the 2nd CP area by fitting between the forward spawn building and the skybox near-by. Merging !- SUPER IMPORTANT -! Merging is something important to note! If several areaportals are along the same plane AND share common edges then VBSP will merge them all into one areaportal regardless of distance. Here are two areaportals. They are both the same height and thickness and are both the same distance from the floor. If we look in game, and enable r_drawportals 1 we will see 1 gigantic green box extending between both areaportals. This means they have been merged into 1 single gigantic areaportal. Now merging isn't a problem unless you have 2 areaportals incredibly far apart that merge together thus rendering their purpose completely useless like in my experience. However stopping areaportals from merging is simple! Simply change the height, width, or thickness of the areaportal so it's different from the other areaportals along the same plane and it will prevent them from merging. So I would simply change areaportal 2 from a thickness of 16... ...to 8 and... ...voila. 2 seperate areaportals! Conclusion Hopefully you should have an understand of how areaportals work and where and when to use them. Hopefully.