Ads keep us online. Without them, we wouldn't exist. We don't have
paywalls or sell mods - we never will. But every month we have large bills
and running ads is our only way to cover them. Please consider unblocking us. Thank you from GameBanana <3
Practical guide on areaportals placement
- An Article for GameBanana
Practical guide on areaportals placement
This article is a continuation of the series that I started two months ago with the practical guide on hints placement ([hints about hints](http://gamebanana.com/articles/59 "")).
Just as with the previous one, this article is not a tutorial or a wiki on areaportals but rather a practical guide on how I proceed with areaportals in a systematic way and the prime locations to place these areaportals. For the rest of the article, I will assume that you are familiar with the working of the Source engine and you have an understanding of areaportals, visleaves and overall optimization. If it is not the case, then it is highly advisable to start on the Valve developer Wiki page ([areaportal wiki](https://developer.valvesoftware.com/wiki/Areaportal)) and ([optimization](https://developer.valvesoftware.com/wiki/Visibility_optimization)), as well as read my comprehensive Source optimization paper ([Man vs Engine](http://source.gamebanana.com/tuts/11178 "")) for an in-depth explanation of areaportals and optimization in general.
Areaportals are one of the most effective and deadly weapons in your optimization arsenal and should be used extensively when your map is large and detailed. As the name implies, an areaportal is an “area” where a “portal” can be placed by the portal gun in Portal and Portal 2. It is also…deep silence, blank stare…it seems that my producers are telling me this is not true. We’ll have to stop this broadcast due to technical difficulties.
Twisted jokes aside, just imagine the areaportal as a powerful gate that separates two areas in your map and cuts visibility between them. And since Source engine architecture is all about visleaves, areaportals are the natural remedy to separate and cull the contents of these leaves.
I usually proceed with areaportals in a systematic way by searching for five major locations that are prime candidates for placing areaportals effectively to help cut visibility and increase frame rate.
This is the first place that you should be looking for to place your areaportals. Due to the nature of the BSP and visleaves, doors and windows are gateways between different areas and between indoors and outdoors, therefore placing areaportals at these openings is the natural thing to do (and Source will be really happy when you do so).
Notice in the above screenshot how the two windows and two doors openings are nicely “choked” by areaportals. It is worth reminding you that areaportals should only be placed between regular world brushes that are taken into account for visibility calculation during VVIS phase; therefore func_detail, func_brush, displacement and prop_static should not count when you are attempting to place the areaportal.
Here’s another screenshot of the same place without the decoration. Notice how the areaportals are resting between world brushes once we hide all the details from the previous screenshot.
After doors and windows, hallway ends are the second pattern that I look at to add areaportals. In the most basic form, you just need to add one areaportal to each end of the hallway; areaportals can range from 1 to 8 units in thickness depending on the surrounding world brushes where the areaportal will be tucked.
This is the most basic of hallways consisting of a small passage between two areas.
Hallways are not always this simple and straight and can be of different shapes and sizes but the same concept applies: make sure that both ends are fitted with an areaportal.
Here’s a case where the hallway is not straight and forms a 90° curve in its middle; notice that the 2 areaportals on its end are there just as if it was a simple hallway. If your hallway contains some extensive and expensive detailing, then it would be a good idea to add a third areaportal right at the curve as denoted by the green dots in the above screenshot. This areaportal, coupled with a corner hint, will make sure that little to nothing gets rendered from the one side of the corner while the player is at the other side. In my case, I have not added this 3rd areaportal because my hallway is rather simple and does not warrant an additional areaportal (adding it will be an “overkill”, and unlike Unreal Tournament deathmatch’s “Overkill” praised by the announcer, an overkill in optimization will start to negatively impact the overall performance due to the cost of the areaportal itself).
In the below screenshot, the hallway is rather long and thus warrants an areaportal to be placed in its middle to further delimit areas and reduce visibility.
Many folks make the mistake of not adding areaportals on all hallway ends and miss the opportunity to tightly seal and cull their areas from an optimization standpoint. Always get in the habit of scouting for all of these ends/openings and making sure that each one is neatly “areaportaled”.
To make sure you don’t miss these ends, examine each area of your map, one at a time, and tally the openings leading to it then make sure that each one has an areaportal. Once done, proceed to the next room/area and repeat. In the above screenshot, you can see how each hallway end/opening labeled from 1 to 5 is “decorated” with an areaportal to completely “seal” this room.
Just like horizontal hints, horizontal areaportals do exist and can prove beneficial in many situations, although they might not be needed in every map.
One of the scenarios for horizontal areaportals is when there is a relatively large area surrounded by solid walls (regular world brushes), and this area connects to surrounding areas from above those walls. The screenshot is coming right away as I can see you scratching your head trying to figure out how this area looks like.
You can see the horizontal areaportal denoted by the green arrow resting on top of the area below; you can also see the three openings (blue arrows) above the walls that connect the area to adjacent ones (notice the openings also have areaportals).
Another scenario for horizontal areaportals is the “industrial warehouse setup”.
While this scenario applies to mostly all warehouse buildings, it is mostly seen in industrial themed maps because of the way these warehouses are built. The warehouse will be mostly made of four walls (regular brushes) and a slanted roof (func_detail) with various decorations; the horizontal areaportal will be exactly at the top of the four walls not taking the detail roof into account.
The green arrow indicates the horizontal areaportal while the red lines show where the slanted roof is supposed to be. (Notice all the doors in the warehouse are nicely “areaportaled”).
While it is always better to add a horizontal areaportal to an area with four walls, it is possible to add such setup to an area with two or three walls, or even one wall (it is possible also to have the four walls replaced by four areaportals; it will work fine but the visibility culling will be less than that with at least one solid wall in the setup).
The trick here is to add the horizontal areaportal (green arrow) like you would normally do then add vertical areaportals as needed (red arrow) to compensate for the lack of solid walls (regular world brush) that can support the areaportal.
As I mentioned in my paper “Man vs Engine”, streets in Source are nothing more than large hallways. You guessed it: an areaportal at the street’s end will be needed.
Notice how the three areaportals labeled 1, 2 and 3 are placed at the end of each street. You might want to add a small vertical skybox brush (red arrow location), as thick as the areaportal itself, to better support its placement (if you don’t want to add this small brush then you need to extend the areaportal further up until it reaches the horizontal skybox brush).
Whenever you have street intersection (large city map or small town theme), think of applying the above setup for your areaportals for optimal results (an areaportal at the street’s end making a 90° angle, more or less, with the next street’s areaportal).
We have come to the last area I look for to place areaportals in my systematic approach. Bear in mind that this kind of areaportals might not be needed in all maps but can prove helpful in specific cases of large areas with unbroken line of sight.
In the screenshot above, after hiding all details, we are left with a large wide-open area with not so many solid structures to apply areaportals as seen in the previous examples. However, we can still use a nice feature of areaportals called “view frustum culling” (refer to my paper Man vs Engine, Paragraph III.8 for a full explanation).
In this case, we add a big areaportal going from floor level to skybox level to act as a separator for this large area. Using this setup, the player standing in the lower right corner of the screenshot will have details in the upper right corner of the area culled because of the areaportal effect.
This is another example where the large areaportal separates two wide areas that have direct line of sight. To the left of the areaportal is “mid” area (labeled on screenshot) while CT spawn and surrounding area is to its right. You can see that hallway/street end areaportals are not feasible due to the open nature of the areas, and horizontal areaportals would be a hassle to setup and would only work on lower levels (up to building height). Adding this simple large areaportal will ensure that details on both sides are properly culled regardless of the player’s position on both sides of the areaportal.
Areaportals are the most effective and powerful tools in your optimization bag of tricks. Coupled with proper hinting, they help enormously to cut visibility, avoid over-rendering and increase frame rate.
Sure they need a bit more practice than hints because of their leak effect if not used properly, but once mastered, they will become your trusty ally in your optimization battle.
I hope that this article has given you enough practical guidance and info to jumpstart your knowledge on proper areaportals placement.
Will2kAugust 25, 2014
> **Posted by Sweeny**
> Does it effect the performance if i put to many area portals down?
Proper fps testing will let you know when adding further areaportals starts degrading the performance of the map.
Please refer to my detailed post below where I explained this issue in details.