Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm developing a portal-based scene manager. Basically all it does is to check the portals against the camera frustum, and render their associated portal zones accordingly. Is there any way my editor can generate portal zones automatically with the user having to set the portals themselves only? For example, the Max Payne 1/2 engine ("Max-FX") only required to set the portal quads, unlike the C4 engine where you also have to explicitly set the portal zones.

share|improve this question
2  
How do you divide your level into segments? Your solution will depend on this. For example Quake 1 don't use portals, but it's possible to generate them from the level (BSP) data. –  kolenda Aug 14 '12 at 11:08
add comment

2 Answers

It is entirely dependent how you implement and construct your portals in your code, it sounds like you currently rely on the user to physically create a portal from a rectangular shape or poly and transform this into the correct position, which is an editor design consideration.

You can however modify how you verify the placement and use of portals in your code to reflect geometry in your environment and what constitutes as a portal. Say you have a door in an internal environment, within the frame of the door, you can tag the planes of the door frame and check to see if the tagged frames create a loop, then check for a zone on either side of the door. From this, a portal can be automatically generated, but is limited by the shapes of doors.

Define an abstract concept of what a portal is, it is essentially a shape with a location. With this concept, you can create sub-elements that modify the portal concept, but allow more complex definitions, enabling you to portal external environments, but always remember they need defined parameters: a zone either side of the portal and the portal to be a shape and have a transform.

With the data from this concept, now link it to geometry within the environment as I previously mentioned (tagging a door frame to create a loop for example), that automatically generates the portal. The portal will check either side of its faces for the placement of the zone and then add it as a reference within itself, linking it to the frustum culling portion of your code.

If you wish to make it even easier in your editor, you can essentially "paint portals" over doorways, have a widget of a rectangular shape, click over the door frame, it automatically tags the door frame and creates the portal in that shape, that location and references both zones.

share|improve this answer
add comment

I am not sure I understood correctly what you need but I hope you find the following tutorial helpful.

Build a 2D Portal Puzzle Game With Unity

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.