PCZ ... is it for me?


18-03-2009 15:58:40


I started reading about PCZ Scene Manager in the context of using it for my game, and many questions formed in my mind. I'll paint a picture of what I'd like to achieve, perhaps a knowledgeable few could point out whether PCZ is for me?

The game is a third-person isometric-influenced RPG (akin to Diablo/Ultima/Fallout camera style). The view can be rotated around the Y axis, or put into first-person "lookaround" mode (movement not possible).

There are two main levels of scene; the first is terrain, which is generated from a typical heightmap, uses the ST_EXTERIOR_CLOSE scene manager. In PCZ terms, terrain would be the 'root' zone.

The second are buildings. These are comprised of the exterior shell (one mesh per storey, one roof), interior rooms (one mesh per room), staircases, and doorways linking rooms to the exterior (or other rooms). In PCZ terms, rooms would be subzones of the terrain zone.

So far, sounds like PCZ could be a huge asset, time-saver, and fps-saver.

The additional features I considered implementing, before reading up on PCZ:
1) When a character is inside a building, the exterior shell disappears for all storeys above and including the storey in which the player character is located (leaving exterior shells below him visible), thus permitting visibility in a certain style.
2) Rooms' visibility are controlled by the state of doors. If open, attached rooms are revealed. There is no LOS-checking for parts of rooms, etc.
3) Staircases which attach floors are usable-objects rather than collision-detected objects, to trigger transition between storeys.
4) Terrain (ST_EXTERIOR_CLOSE), sky (Caelum), and water (Hydrax) can potentially be 'on' while inside buildings, since their visibility is possible indoors.
5) Room interiors are (for the most part) composed of walls, ceiling, and floor; backface culling prevents walls between player character and camera from obscuring the player character.

My questions regarding PCZ are:
1) What happens to terrain/sky/water (part of the root zone) when inside a building, from a third person view? Can zones be culled based on an arbitrary point, or are they culled according to the viewport?
2) Is #1 (features, above) possible? If the building is attached to the root zone, would the exterior of the building only cull if the exterior portal was invisible?
3) Can portals' visibility be controlled by the addition/deletion of scene node objects? (e.g. using a door mesh to obscure the room behind it.) Or is their visibility solely at the discretion of whether they are contained in the viewport (and not back-facing)?
4) In terms of using PCZ for terrain-object zoning, I'm assuming I would need to divide my world into X*Y equally sized zones, and define 4 portals along the edges of each zone. e.g. if a zone was 256*256 units, the four borders would each have a 256*height portal assigned. Is this right?
5) Do portals offer visibility through other portals?
6) Could I use portals for windows, enabling players to 'see outside' when nearby them, but are non-traversable (or are they ;))?

I'm sure I sound like a n00b with these questions, please go easy on me (and watch the face!) :)



19-03-2009 19:35:58


I don't have enough time to answer your questions individually, but I will say that you should be able to do what you want to do with PCZSM. Just keep in mind that culling and scene traversal take place relative to the camera. The way I would do it is something like this:

1) When you make your buildings, make the roof a separate object with a large portal in the same place. When the character goes inside the building, turn off the roof, and turn on the portal (so the interior of the building gets drawn). When the character is outside the building, turn on the roof, and turn off the roof portal (so the interior of the building isn't drawn, except those things which are visible through windows/doors).

2) In first person mode, everything is just drawn as regular. But turn off the roof portal to improve efficiency.

You can turn portals on and off, so it's easy to handle doors. You can also utilize the new antiportals to help with this too (but for your uses, I'd just enable/disable the door portals.



08-04-2010 14:51:30

The same question for me - will PCZSM fit my needs?

I am building some kind of a city where you can drive or walk around, my friends are helping me with some parts of the city. There are also some "enterable" places - houses with many floors and so on.

Now I understand how to use for separating indoor zones from outdoor zones, the Wiki is great. But what would be the best way to build the outdoor? Obviously, I do not want to load all the city in the scene at once - I do not know, how large it will grow, but also I want the player to be able to walk all the city without nasty "Loading...." screens. It is just a hobby project, so I would like to avoid implementing my own scene manager.

Is it a good idea to separate the city into PCZSM zones? If I walk into one zone of the city, I turn on the adjacent zones (so the player does not see "the edge of the world" when driving his car to the end of the zone :D ) and I can turn off the farther zones, right? How then I organize the outdoor zones and which is the default zone then?

Also - how large portal should I make at the edge of a city zone - is it ok to create it as wide as the zone edge is (if player would like to cross zone boundary in some unknown place, not walking the road)?

Or maybe I could use that Paging Landscape SM somehow (but what about the indoor scenes then)?