Areaportals?

Areaportals?

Re: Areaportals? Posted by G4MER on Sat Sep 20th 2008 at 5:53am
G4MER
2460 posts
Posted 2008-09-20 5:53am
G4MER
floaty snark rage
member
2460 posts 360 snarkmarks Registered: Sep 6th 2003 Location: USA
I am making a map.. I need to bump up the FPS in game.. I have been told to use areaportals.. I have never used them.. I have seen the wiki, please don't link it..

http://developer.valvesoftware.com/wiki/Areaportal

I need more help than a link.. anyone here have a tut they can share? or more advise? Please.
Re: Areaportals? Posted by Le Chief on Sat Sep 20th 2008 at 9:50am
Le Chief
2605 posts
Posted 2008-09-20 9:50am
Le Chief
member
2605 posts 937 snarkmarks Registered: Jul 28th 2006 Location: Sydney, Australia
Basically, you have dynamic areaportals called occludes and you have the normal areaportals which you can trigger in game. Dynamic areaportals suck and are only useful in multiplayer. I'm going to tell you how to set up a normal areaportal.

What you want to do, is construct a little space in your map with the existing brush geometry and brushes textures with the areaportal texture. You can construct the space with as many areaportal brushes as you want, but they must be tied individually to the func_areaportal entity, must have the same name, and have the same state (open or closed). That whole space inside the little bubble you have created can now be controlled, and told to render on/off in game. Anything that lies within both the bubble and outside the bubble will be rendered regardless.

You can render/hide the insides of the bubble (to save performance ofcourse) with triggers. The best way I find is to make two trigger multiple brushes. One will trigger it "open" which means it renders the insides, and one triggers it "closed" which means it does not render the insides.

You want the two trigger multiples to cover the whole pathway so the player can not go under/around or ontop and you want them paper thin. You also want them close to eachother maybe 64 units close, and ofcourse, you want them ranged in a logical way.

This diagram should help you (if img preview dosen't work, kill me now):
User posted image
To conclude:

-You can use as many areaportal brushes to seal off your bubble as you wish
-They must be individually tied to the func_areaportal entity
-Your bubble must not have any leaks!
-Set your trigger_multiples reset time very low, like 0.1 seconds

Edit: So basically, if vis was perfect, than you wouldn't need to construct areaportals. But its not and will often (understandably) render areas that the player can't see.

Btw, another good way to save on performance is increase the lightmap scale on things that it dosen't matter if the shadows are more diffuse. Light map dosen't really decrease the quality of the lighting on that particular surface, but it makes the shadows more diffuse and increased lightmap scale will decrease compile time and increase ingame performance.

Edit2: Oh yeah, don't use normal areaportals in Multiplayer maps because Valve foolishly made it so that if you trigger an area portal off, some poor sucker will suddenly have his surroundings disappear on the other side of the map. Darn valve and their non client side areaportals.
Aaron's Stuff
Re: Areaportals? Posted by G4MER on Sat Sep 20th 2008 at 4:14pm
G4MER
2460 posts
Posted 2008-09-20 4:14pm
G4MER
floaty snark rage
member
2460 posts 360 snarkmarks Registered: Sep 6th 2003 Location: USA
OK so I am building a map for Counter-Strike Source.. A multi-player game.. I have halls with open areas that connect in the roof. DO I need to close these off too? Also I have one large skybox that covers the whole map.. my plan was to include a 3d skybox after the map was complete. Do I use these occulars or areaportals on top of the buildings to block the draw between the two areas?
Re: Areaportals? Posted by Le Chief on Sat Sep 20th 2008 at 9:11pm
Le Chief
2605 posts
Posted 2008-09-20 9:11pm
Le Chief
member
2605 posts 937 snarkmarks Registered: Jul 28th 2006 Location: Sydney, Australia
Areaportals can be any size, and any shape. They can be just comprised of two areaportal brushes one on each end of a hallway or complicated made up of 10 or more areaportal brushes. They can be irregular as possible but the bubble inside the areaportal space can not have any leaks (just like your level can not have any leaks and there must be an "inside" and an "outside").

Here is an example. As you can see, all those trees and displacements can not be seen on the other side of that building so I created an areaportal so I can turn it off when the player is on the other side of that building, and if the player comes back, it will turn back on. BTW, thats the map I am putting the model in :).

However, they are only for singleplayer. Your going to have to use occludes, however, they are dynamic and calculated in game so they actually demand a little bit of processing power, so the gain from the occluder must outweigh the performance drop from the occluder.

I don't know how to make one because I've never bothered, but if you want a good example, decompile the map de_forest (remember that map?). He has used a complex setup of occludes which really save on the fps (imagine that map if every space was visible). Remember, there are other ways to increase the in game performance.
Aaron's Stuff
Re: Areaportals? Posted by G4MER on Sat Sep 20th 2008 at 9:44pm
G4MER
2460 posts
Posted 2008-09-20 9:44pm
G4MER
floaty snark rage
member
2460 posts 360 snarkmarks Registered: Sep 6th 2003 Location: USA
Your gonna have to teach me how you do them trees.. that looks great.. I have not found them yet. They would be great in my new map. So the big blue box is your areaportal?
Re: Areaportals? Posted by Le Chief on Sat Sep 20th 2008 at 10:01pm
Le Chief
2605 posts
Posted 2008-09-20 10:01pm
Le Chief
member
2605 posts 937 snarkmarks Registered: Jul 28th 2006 Location: Sydney, Australia
Yeah, the insides of that blue box is the "bubble" and all those trees and displacements can now be "not rendered" to save performance. But if you also notice, there are several other opportunities for more areaportals.

Oh, and that map is a heavy WIP, still not finished. I stole the trees from de_forest and Half-life 2 Episode 1.
Aaron's Stuff
Re: Areaportals? Posted by G4MER on Sun Sep 21st 2008 at 7:10am
G4MER
2460 posts
Posted 2008-09-21 7:10am
G4MER
floaty snark rage
member
2460 posts 360 snarkmarks Registered: Sep 6th 2003 Location: USA
Hey zip them trees up and send them to me would ya.. I am not very good at the whole decompile thing. muhnay@hotmail.com

Please.. That map is looking good though.. I should send you mine and maybe you could give me some input.. want me to do that?
Re: Areaportals? Posted by Le Chief on Sun Sep 21st 2008 at 10:57am
Le Chief
2605 posts
Posted 2008-09-21 10:57am
Le Chief
member
2605 posts 937 snarkmarks Registered: Jul 28th 2006 Location: Sydney, Australia
You can download the trees here.

Yeah sure, I'd love to check out your map :).
Aaron's Stuff
Re: Areaportals? Posted by G4MER on Sun Sep 21st 2008 at 4:39pm
G4MER
2460 posts
Posted 2008-09-21 4:39pm
G4MER
floaty snark rage
member
2460 posts 360 snarkmarks Registered: Sep 6th 2003 Location: USA
WOW!, that is packed full of Foliage goodness. Thank You!

I will do some work to it today and upload it here to my pit for you to DL and check out. I have another mapper who is going to help me make those cool rotating CPL signs that are in most of their maps.. so I can put a Snarkpit advert and a couple others in there and just have the one sign.. but we shall see.
Re: Areaportals? Posted by ReNo on Mon Sep 22nd 2008 at 2:11pm
ReNo
5457 posts
Posted 2008-09-22 2:11pm
ReNo
member
5457 posts 1991 snarkmarks Registered: Aug 22nd 2001 Occupation: Level Designer Location: Scotland
The best resource I know of regarding area portals, and of optimization in general, is definately zombie's optimization guide. Not sure if you've come across it before, but if not then it's well worth a read and I can guarantee you'll learn a whole bunch in doing so.

http://www.student.ru.nl/rvanhoorn/optimization.php?chapter=areaportals
Re: Areaportals? Posted by G4MER on Mon Sep 22nd 2008 at 4:06pm
G4MER
2460 posts
Posted 2008-09-22 4:06pm
G4MER
floaty snark rage
member
2460 posts 360 snarkmarks Registered: Sep 6th 2003 Location: USA
Thanks RENO.. I just stumbled upon that last night while searching. I am still at a loss with them though. I know I need to get my FPS up on the map.. if I don't it will be unplayable. It was suggested that I use Area Portals. I tried them last night and it broke my map.. I will keep trying though maybe I missed a step or something. I was also thinking of breaking the open areas into 3 sky boxes instead of one open one clear across the whole map.. even though thats what works best for this.. maybe a 3D skybox will help?
Re: Areaportals? Posted by ReNo on Mon Sep 22nd 2008 at 6:45pm
ReNo
5457 posts
Posted 2008-09-22 6:45pm
ReNo
member
5457 posts 1991 snarkmarks Registered: Aug 22nd 2001 Occupation: Level Designer Location: Scotland
In what way did it break your map? Did you get any compile errors? The most common problem people have with area portals is not having them properly seal in an area - you have to ensure that there is no way to get from one "area" into another without passing through an area portal. Make each one as small as you can. You only really want to be using them to seperate areas that have small passages between them like doorways and windows. If there are lots of holes and/or huge holes you need to plug up with area portals, you're (probably) trying to use them somewhere where they won't benefit you.

It's hard to suggest what method of optimization will help you most without knowing what the map is like. Could you post up some screenshots, even from hammer, showing what your problem area is like?
Re: Areaportals? Posted by G4MER on Tue Sep 23rd 2008 at 2:20am
G4MER
2460 posts
Posted 2008-09-23 2:20am
G4MER
floaty snark rage
member
2460 posts 360 snarkmarks Registered: Sep 6th 2003 Location: USA
The map is the one I posted de_statepen_b1.

I have very few doors.. the map is in my eyes small and open. Please take a look at it and let me know Reno what I can do to fix it on the FPS front.