Game Development Community

Framerate hit for difs which are entirely out of view

by Orion Elenzil · in Torque Game Engine · 05/12/2007 (12:22 pm) · 9 replies

Hey all -

i'm struggling w/ a little framerate problem in TGE here -

i have an urban scene,
with some sixty or so DIF buildings in it.

when i stand at the far edge of my city and look away from it,
so that nearly the DIFs (except the one i'm standing on) are totally behind me
or at least entirely out of view,
the framerate on my machine is about 110FPS.

now, if i go and delete all the DIFs except the one i'm standing on,
the framerate from the exact same empty view goes up to 170FPS!

i'm trying to figure out why these out-of-view DIFs are causing a framerate hit.

i'm running server and client in a single instance. (aka "single-player mode")

perhaps i should compare actual server / client to make sure it's not some server-side slowdown.

some of the buildings are pretty close together
and we occasionally get Zone Manager errors,
but we clean those up.

there are about 37 NPC avatars in the environment,
and when the DIFs are removed, they fall into the ocean and get respawned
back on the one DIF i'm standing on. i wonder if it could be the CPU used to
calculate who's in what zone, etc.

anyhow,
any thoughts appreciated.

#1
05/12/2007 (1:40 pm)
I dont believe that TGE or TGEA support culling of objects that are out of view....

Soooo, if im not mistaken, even though the objects are out of view, they are still being rendered.

I dont know if there is thoughts of culling being integrated in the future but it looks like you are on your own for that...
#2
05/12/2007 (2:17 pm)
Her Robert,
thanks for writing.

i believe TGE does cull DIFs and other objects when they're not in the view frustum. - at least it should.

.. yes, i believe it is in most/some cases.
for instance if i run a near empty mission, the framerate is 160.
i then add 35 copies of a particular DIF behind the camera, and it stays right at 160.
this particular DIF is moderately complex inside, but basically a box outside, and is well-portalized,
so perhaps it's not such a good test.

i'm hoping to find one or two of my sixty DIFs which are the culprits, but i'm a bit dubious.
#3
05/12/2007 (3:20 pm)
Can you run the profiler and see where it spends most of its time? SceneTraversal?
#4
05/12/2007 (4:54 pm)
I'm actually not that familar w/ the profiler.
That's #define ENABLE_PROFILER and then profilerEnable() and profilerDump(), yeah ?

my current suspicion is that it's due to DIFs who's bounding boxes overlap.
#5
05/12/2007 (4:57 pm)
[5/12/07 16:56:17][Inf][General] ==>profilerDump();
[5/12/07 16:56:17][Inf][General] Profiler Data Dump:
[5/12/07 16:56:17][Inf][General] Ordered by non-sub total time -
[5/12/07 16:56:17][Inf][General] %NSTime  % Time  Invoke #  Name
[5/12/07 16:56:17][Inf][General]  20.714  33.651      464 AdvanceObjects
[5/12/07 16:56:17][Inf][General]   9.953  54.270      286 CanvasRenderControls
[5/12/07 16:56:17][Inf][General]   9.294  32.565    30682 SceneStateRenderImage
[5/12/07 16:56:17][Inf][General]   8.911  11.258    14536 Player_PhysicsSection
[5/12/07 16:56:17][Inf][General]   7.842   7.842     1283 IRO_RenderARB_FC
[5/12/07 16:56:17][Inf][General]   7.189   7.464     1860 TSShapeInstanceRender
[5/12/07 16:56:17][Inf][General]   6.060  18.721      286 AdvanceClientTime
[5/12/07 16:56:17][Inf][General]   3.702   3.702     4602 DrawText
[5/12/07 16:56:17][Inf][General]   2.347   2.347     9065 Player_UpdatePos
[5/12/07 16:56:17][Inf][General]   2.169   2.169      286 RegisterLights
[5/12/07 16:56:17][Inf][General]   2.169   2.169     1283 IRO_RenderDynamicLights
[5/12/07 16:56:17][Inf][General]   2.100   2.962      286 BuildSceneTree
[5/12/07 16:56:17][Inf][General]   1.770  39.927      286 SceneGraphRender
[5/12/07 16:56:17][Inf][General]   1.642   1.642      286 SkyRender
[5/12/07 16:56:17][Inf][General]   1.555  12.902    15544 Player_ProcessTick
[5/12/07 16:56:17][Inf][General]   1.269   1.269    10126 ContainerCastRay
[5/12/07 16:56:17][Inf][General]   1.246   1.246      286 ServerNetProcess
[5/12/07 16:56:17][Inf][General]   1.118   1.118      286 CanvasPreRender
[5/12/07 16:56:17][Inf][General]   1.115   1.115     1283 ISAPL_Setup
[5/12/07 16:56:17][Inf][General]   1.043   9.093     1144 ShapeBaseRenderObject
[5/12/07 16:56:17][Inf][General]   0.944   0.944      286 SwapBuffers
[5/12/07 16:56:17][Inf][General]   0.738   0.738      286 SimAdvanceTime
[5/12/07 16:56:17][Inf][General]   0.583   0.583     1283 ISAPL_Merge
[5/12/07 16:56:17][Inf][General]   0.570   0.781     1283 InteriorPrepRenderImage
[5/12/07 16:56:17][Inf][General]   0.461   6.607      572 PlayerRenderPrimary
[5/12/07 16:56:17][Inf][General]   0.458  33.023      286 TraverseScene
[5/12/07 16:56:17][Inf][General]   0.365  40.291      286 GameRenderWorld
[5/12/07 16:56:17][Inf][General]   0.286  19.187      286 ClientProcess
[5/12/07 16:56:17][Inf][General]   0.284   0.284     1283 IRO_UpdateAnimatedLights
[5/12/07 16:56:17][Inf][General]   0.271   0.271     1860 TSShapeInstanceMaterials
[5/12/07 16:56:17][Inf][General]   0.234   0.234      286 ClientNetProcess
[5/12/07 16:56:17][Inf][General]   0.212   0.212    17110 UpdateActionThread
[5/12/07 16:56:17][Inf][General]   0.172   8.014     1283 IRO_RenderSolids
[5/12/07 16:56:17][Inf][General]   0.168   0.168      286 WinGetInput
[5/12/07 16:56:17][Inf][General]   0.129   0.129     1283 InteriorTraverseZone
[5/12/07 16:56:17][Inf][General]   0.113  99.562      286 MainTime
[5/12/07 16:56:17][Inf][General]   0.082   0.211     1283 InteriorZoneTraversal
[5/12/07 16:56:17][Inf][General]   0.077   1.776     1283 InteriorSetupActivePolyList
[5/12/07 16:56:17][Inf][General]   0.076   0.245     2432 GetLightingAmbientColor
[5/12/07 16:56:17][Inf][General]   0.057  99.449      286 ProcessTimeEvent
[5/12/07 16:56:17][Inf][General]   0.056   0.056      286 MainNet
[5/12/07 16:56:17][Inf][General]   0.054   0.054     1283 IRO_GetZones
[5/12/07 16:56:17][Inf][General]   0.052   0.090      286 WinMessages
[5/12/07 16:56:17][Inf][General]   0.051   0.052       42 ProcessInputEvent
[5/12/07 16:56:17][Inf][General]   0.049   1.189      572 ShapeBaseRenderPrimary
[5/12/07 16:56:17][Inf][General]   0.045  12.356     1283 InteriorRenderObject
[5/12/07 16:56:17][Inf][General]   0.039  21.640      286 AdvanceServerTime
[5/12/07 16:56:17][Inf][General]   0.039   0.039      286 MainCURLObjects
[5/12/07 16:56:17][Inf][General]   0.018   0.018       76 InteriorScanZoneNew
[5/12/07 16:56:17][Inf][General]   0.015   1.791     1283 IRO_ComputeActivePolys
[5/12/07 16:56:17][Inf][General]   0.015   0.042      286 WinConsole
[5/12/07 16:56:17][Inf][General]   0.012 100.000      286 MainLoop
[5/12/07 16:56:17][Inf][General]   0.011   0.011      286 WinProcessInput
[5/12/07 16:56:17][Inf][General]   0.011   0.322      286 MainPlatform
[5/12/07 16:56:17][Inf][General]   0.010  56.342      286 RenderFrame
[5/12/07 16:56:17][Inf][General]   0.010   0.010      572 PlayerRenderShadow
[5/12/07 16:56:17][Inf][General]   0.006   0.006      286 MainConsoleAndDebug
[5/12/07 16:56:17][Inf][General]   0.005  21.644      286 ServerProcess
[5/12/07 16:56:17][Inf][General]   0.004   0.004     1860 TSShapeInstanceRenderBillboards
[5/12/07 16:56:17][Inf][General]   0.004   0.004      286 BuildFogTexture
[5/12/07 16:56:17][Inf][General]   0.004   0.004      286 MainJournal
[5/12/07 16:56:17][Inf][General]   0.002   0.002      572 ShapeBaseRenderShadow
#6
05/12/2007 (4:57 pm)
[5/12/07 16:56:17][Inf][General] Ordered by stack trace total time -
[5/12/07 16:56:17][Inf][General] % Time  % NSTime  Invoke #  Name
[5/12/07 16:56:17][Inf][General]  12.780 -87.220        0 ROOT
[5/12/07 16:56:17][Inf][General] 100.000   0.012      286   MainLoop
[5/12/07 16:56:17][Inf][General]  99.562   0.113      286     MainTime
[5/12/07 16:56:17][Inf][General]  99.449   0.057      286       ProcessTimeEvent
[5/12/07 16:56:17][Inf][General]  56.342   0.010      286         RenderFrame
[5/12/07 16:56:17][Inf][General]  54.270   9.953      286           CanvasRenderControls
[5/12/07 16:56:17][Inf][General]  40.291   0.365      286             GameRenderWorld
[5/12/07 16:56:17][Inf][General]  39.927   1.770      286               SceneGraphRender
[5/12/07 16:56:17][Inf][General]  33.023   0.458      286                 TraverseScene
[5/12/07 16:56:17][Inf][General]  32.565   9.294    30682                   SceneStateRenderImage
[5/12/07 16:56:17][Inf][General]  12.356   0.045     1283                     InteriorRenderObject
[5/12/07 16:56:17][Inf][General]   8.014   0.172     1283                       IRO_RenderSolids
[5/12/07 16:56:17][Inf][General]   7.842   7.842     1283                         IRO_RenderARB_FC
[5/12/07 16:56:17][Inf][General]   2.169   2.169     1283                       IRO_RenderDynamicLights
[5/12/07 16:56:17][Inf][General]   1.791   0.015     1283                       IRO_ComputeActivePolys
[5/12/07 16:56:17][Inf][General]   1.776   0.077     1283                         InteriorSetupActivePolyList
[5/12/07 16:56:17][Inf][General]   1.115   1.115     1283                           ISAPL_Setup
[5/12/07 16:56:17][Inf][General]   0.583   0.583     1283                           ISAPL_Merge
[5/12/07 16:56:17][Inf][General]   0.284   0.284     1283                       IRO_UpdateAnimatedLights
[5/12/07 16:56:17][Inf][General]   0.054   0.054     1283                       IRO_GetZones
[5/12/07 16:56:17][Inf][General]   9.093   1.043     1144                     ShapeBaseRenderObject
[5/12/07 16:56:17][Inf][General]   6.607   0.461      572                       PlayerRenderPrimary
[5/12/07 16:56:17][Inf][General]   6.144   6.039      572                         TSShapeInstanceRender
[5/12/07 16:56:17][Inf][General]   0.104   0.104      572                           TSShapeInstanceMaterials
[5/12/07 16:56:17][Inf][General]   0.001   0.001      572                           TSShapeInstanceRenderBillboards
[5/12/07 16:56:17][Inf][General]   0.001   0.001      572                         GetLightingAmbientColor
[5/12/07 16:56:17][Inf][General]   1.189   0.049      572                       ShapeBaseRenderPrimary
[5/12/07 16:56:17][Inf][General]   1.140   1.062      572                         TSShapeInstanceRender
[5/12/07 16:56:17][Inf][General]   0.076   0.076      572                           TSShapeInstanceMaterials
[5/12/07 16:56:17][Inf][General]   0.001   0.001      572                           TSShapeInstanceRenderBillboards
[5/12/07 16:56:17][Inf][General]   0.243   0.074     1144                       GetLightingAmbientColor
[5/12/07 16:56:17][Inf][General]   0.169   0.169      226                         ContainerCastRay
[5/12/07 16:56:17][Inf][General]   0.010   0.010      572                       PlayerRenderShadow
[5/12/07 16:56:17][Inf][General]   0.002   0.002      572                       ShapeBaseRenderShadow
[5/12/07 16:56:17][Inf][General]   1.642   1.642      286                     SkyRender
[5/12/07 16:56:17][Inf][General]   0.180   0.088      716                     TSShapeInstanceRender
[5/12/07 16:56:17][Inf][General]   0.091   0.091      716                       TSShapeInstanceMaterials
[5/12/07 16:56:17][Inf][General]   0.001   0.001      716                       TSShapeInstanceRenderBillboards
[5/12/07 16:56:17][Inf][General]   0.001   0.001      716                     GetLightingAmbientColor
[5/12/07 16:56:17][Inf][General]   2.962   2.100      286                 BuildSceneTree
[5/12/07 16:56:17][Inf][General]   0.781   0.570     1283                   InteriorPrepRenderImage
[5/12/07 16:56:17][Inf][General]   0.211   0.082     1283                     InteriorZoneTraversal
[5/12/07 16:56:17][Inf][General]   0.129   0.129     1283                       InteriorTraverseZone
[5/12/07 16:56:17][Inf][General]   0.080   0.080      292                   ContainerCastRay
[5/12/07 16:56:17][Inf][General]   2.169   2.169      286                 RegisterLights
[5/12/07 16:56:17][Inf][General]   0.004   0.004      286                 BuildFogTexture
[5/12/07 16:56:17][Inf][General]   3.702   3.702     4602             DrawText
[5/12/07 16:56:17][Inf][General]   0.324   0.324      858             ContainerCastRay
[5/12/07 16:56:17][Inf][General]   1.118   1.118      286           CanvasPreRender
[5/12/07 16:56:17][Inf][General]   0.944   0.944      286           SwapBuffers
[5/12/07 16:56:17][Inf][General]  21.644   0.005      286         ServerProcess
[5/12/07 16:56:17][Inf][General]  21.640   0.039      286           AdvanceServerTime
[5/12/07 16:56:17][Inf][General]  21.600   9.158      232             AdvanceObjects
[5/12/07 16:56:17][Inf][General]  12.421   1.341     8816               Player_ProcessTick
[5/12/07 16:56:17][Inf][General]  10.992   8.712     8816                 Player_PhysicsSection
[5/12/07 16:56:17][Inf][General]   2.280   2.280     8816                   Player_UpdatePos
[5/12/07 16:56:17][Inf][General]   0.088   0.088     8816                 UpdateActionThread
[5/12/07 16:56:17][Inf][General]   0.017   0.017       28               ContainerCastRay
[5/12/07 16:56:17][Inf][General]   0.005   0.005       19               InteriorScanZoneNew
[5/12/07 16:56:17][Inf][General]  19.187   0.286      286         ClientProcess
[5/12/07 16:56:17][Inf][General]  18.721   6.060      286           AdvanceClientTime
[5/12/07 16:56:17][Inf][General]  12.051  11.556      232             AdvanceObjects
[5/12/07 16:56:17][Inf][General]   0.481   0.214     6728               Player_ProcessTick
[5/12/07 16:56:17][Inf][General]   0.266   0.200     5720                 Player_PhysicsSection
[5/12/07 16:56:17][Inf][General]   0.067   0.067      249                   Player_UpdatePos
[5/12/07 16:56:17][Inf][General]   0.014   0.014       57               InteriorScanZoneNew
[5/12/07 16:56:17][Inf][General]   0.487   0.487     8294             ContainerCastRay
[5/12/07 16:56:17][Inf][General]   0.124   0.124     8294             UpdateActionThread
[5/12/07 16:56:17][Inf][General]   0.181   0.181      400           ContainerCastRay
[5/12/07 16:56:17][Inf][General]   1.246   1.246      286         ServerNetProcess
[5/12/07 16:56:17][Inf][General]   0.738   0.738      286         SimAdvanceTime
[5/12/07 16:56:17][Inf][General]   0.234   0.234      286         ClientNetProcess
[5/12/07 16:56:17][Inf][General]   0.322   0.011      286     MainPlatform
[5/12/07 16:56:17][Inf][General]   0.168   0.168      286       WinGetInput
[5/12/07 16:56:17][Inf][General]   0.090   0.052      286       WinMessages
[5/12/07 16:56:17][Inf][General]   0.026   0.025       20         ProcessInputEvent
[5/12/07 16:56:17][Inf][General]   0.001   0.001        2           ContainerCastRay
[5/12/07 16:56:17][Inf][General]   0.012   0.012       26         ContainerCastRay
[5/12/07 16:56:17][Inf][General]   0.042   0.015      286       WinConsole
[5/12/07 16:56:17][Inf][General]   0.027   0.027       22         ProcessInputEvent
[5/12/07 16:56:17][Inf][General]   0.011   0.011      286       WinProcessInput
[5/12/07 16:56:17][Inf][General]   0.056   0.056      286     MainNet
[5/12/07 16:56:17][Inf][General]   0.039   0.039      286     MainCURLObjects
[5/12/07 16:56:17][Inf][General]   0.006   0.006      286     MainConsoleAndDebug
[5/12/07 16:56:17][Inf][General]   0.004   0.004      286     MainJournal
#7
05/13/2007 (5:09 am)
Looks like this is a major hit on performance (server-side btw):
[5/12/07 16:56:17][Inf][General]  21.600   9.158      232             AdvanceObjects
[5/12/07 16:56:17][Inf][General]  12.421   1.341     8816               Player_ProcessTick
[5/12/07 16:56:17][Inf][General]  10.992   8.712     8816                 Player_PhysicsSection

And, try to run profiler in both cases - with DIFs behind, and without and see where is a major "change" (if any). And, try removing AIPlayers from scene too (with and w/out DIFs). So after you will have four dumps - enough information to see/compare.
#8
05/13/2007 (12:05 pm)
Heya.
yes, we're taking a hit with NPCs,
which we should do something about,
but there's something else going on just around DIFs which i'd like to track down.

if i delete all NPCs the framerate improves from a baseline up to 112% of that.

however there's this one fairly simple DIF which if delete it yields 108%,
which seems like an awful lot for a DIF which is totally behind the player.
aha: if i even just *move* the DIF to a different location where it's not overlapping other DIFs,
i get that same 108%.
#9
05/13/2007 (6:35 pm)
Hmm... that's strange. I know that it's a big issue when you have errors of overlapping DIF zones with each others, but if you say - when you move it out and still get the same..... not sure about that. I'll try to find some time tomorrow (it's 5:30am here already) to run some tests on this and give a reply on results (with profiler).