Game Development Community

Enhancement modification for DIF and Portal in some certain circumstances

by Huan Li · in Torque Game Engine Advanced · 04/29/2009 (10:22 pm) · 2 replies

Other than a FPS game, for example a virtual social game, when you're looking at the door of a room(dif) very far away, it may be not necessary to expose the inside objects to you, so those objects can be ignored for rendering. But the stock TGEA only use detail 0 of the DIF for zone-traversal, so whatever the detail level it is(may be a detail level that doesn't have any portals, just a closet-box),as long as you face the portal which is in detail 0, all the objects in side the DIF will be rendering.

Modification:
in interiorInstance.cpp, at line about 766, do the following, just replace the 0 with detailLevel:
//[ li-huan modified
   /*<< original
   bool continueOut = mInteriorRes->getDetailLevel(0)->prepRender(state,
   >>*/
   //<< modified
   bool continueOut = mInteriorRes->getDetailLevel(detailLevel)->prepRender(state,
   //>>

ExtraInfo:
I have some more ideas for this type of enhancement about portal and dif, for example: add an effective distance dynamic attribute "visDist" to a portal, the portal will work only when camera faces it and the distance between the portal and cam is less than "visDist".Can someone give me some suggestion on how to implement this? Thanx.

#1
04/30/2009 (3:56 pm)
I'm pretty sure somewhere down the zone traversal process Torque calculates the portal's screen rectangle (used to limit the viewport to the area occupied by the portal on the screen). You could probably abort traversing into the portal if its rectangle is too small.

But don't ask me where this is done, it's been years since I messed with the zoning code.
#2
04/30/2009 (4:43 pm)
@Manoel
Thank u very much!!!It's a greate infomation for me!!