You know that the map "V2 Facility" has one of the best FPS:es among the maps shipped with MOH:AA... Not really that strange as there are a lot of corridors that does not show that much of the map at once, so there is not a lot to draw for the graphic engine. But there is another reason that the blazing FPS of the "V2 Facility" has been achieved as well... If you have a modest or bad computer: you may have noticed that FPS drops every time the doors to the V2 area is open... this is because the V2 area is not drawn when they are closed.
So? You say... naturally the things I cant see is not drawn!
Well, this is unfortunately not true. Especially when it comes to doors. But it can be true if you learn to use areaportals.
The problem
Consider these three rooms:
...the picture above shows three rooms. Two of them contains some complex brushes. One contains the player starting points and nothing more. The rooms are connected with short corridors. At both ends of the corridors, there are doors.
Normally every brush in this little map will be drawn all the time.
If you doubt me, soon is the time for you to look like this: (o_0) ...and yell Eureka!
The doors to the room with the sphere has no areaportals, the doors to the room with the twelve cones does contain areaportals. Now lets look at the rooms from the middle room using the r_showtris 2 command ( if you don't know this command, learn about it here ).
The two doors without areaportals:
With both doors open:
With the farthest door closed:
With both doors closed:
...as you can see: The contents of the room is draw even if there are two closed doors in the way. If this is news to you, make this face now: (o_0)
Now the two doors with areaportals:
With both doors open:
With the farthest door closed:
With both doors closed:
...this is what I expect many of you thought happened all the time a door closed. But not without some areaportals and some conscious architectural decisions.
How areaportals work
Area portals work together with structural brushes ( if you don't know what a structural brush is, read "Vis for Dummies" ) to create a closed section in the map: a separate area. When an area is closed, it is not drawn if you are outside that area And if you are inside a closed area, nothing outside it is drawn. To close an area, you need it to be totally sealed off from the rest of the map with a combination of areaportals and structural brushes.
How areaportals don't work
To create a separate area, it must be sealed. No translucent brushes ( like windows and water) and no fence textures ( like iron gates or fences ) and no entities ( other than doors ) can be part ofthe sealing off of the area.
How to insert areaportals in your map
If you have a func_rotatingdoor entity like this ( door selected in red ):
...place a brush with the common/areaportal texture like this ( areaportal selected i red ):
... so that is sticks out into the ( structural ) wall a few units. It should be:
Bigger than the doors height and width
Thinner than the doors "depth"
Stick out a bit into the wall on each side of the door ( sides, over and under)
NOT stick outside the doors "front" and "back"
Here is how it should look in MOHRadiant ( You can't see the areaportal brush ):
...and here is the same view with the View->Filter->Entities activated ( a func_rotatingdoor is an entity ):
That's it!
Controlling areaportals manually
Sooner or later you will for some reason want to manually activate and deactivate an area portal instead of doing it "automagically" with a door. An example of this is when you create a hatch in the floor/ceiling that turns up or down by executing a move command on a script_object entity in the script of the map, like this:
$hatch rotateXup 90
In this case you will have to deactivate the areaportal manually once the hatch starts to open, and activate it once it has been closed again. This is done with these two simple commands:
$my_hatch closeportal // Closes the areaportal and seals the area
and
$my_hatch openportal // Opens the areaportal, exposing the area
The example *.map below contains a scripted hatch that controls an areaportal manually.