Game Development Community

Object Pooling / FPS Impact

by Jeremy Easoz · in Torque Game Builder · 09/24/2008 (8:27 am) · 8 replies

For my current project I have created the beginnings of an object pooling
and recycling framework.

When I create the pool of objects they are visible = false;

Yet they still seem to impact my Frames Per Second.

Now, it's not a huge issuse, was just wondering if this is supose to happen.
I haven't written the recycler yet so I allocated a huge amount of objects
so I wouldn't run out until the recycler was done.

900 - 80-99FPS
5000 - 23FPS

#1
09/24/2008 (11:12 am)
Be sure that the objects in the pool are not contained in a t2dSceneGraph. Otherwise they will be updated and clutter the collision/picking system.
#2
09/24/2008 (12:08 pm)
That did the trick, thanks.
#3
09/24/2008 (2:36 pm)
Can you post the FPS you are getting now? Just out of interest.
#4
09/24/2008 (9:46 pm)
What if they are set to disabled? I currently have a similar system, and I simply disable all the entities (and their associated schedules) when they are added back to the inactive entity pool.
#5
09/25/2008 (5:48 am)
900 Objects - 100-110FPS
5000 Objects - 100-120FPS

The load time is noticable different too. (much faster);
#6
09/25/2008 (10:53 am)
@Jeremy: Thanks :)

@Wes: what version of TGB are you using? I've been looking and looking but I cannot find enabling and disabling sceneobjects any more in my 1.7.3 source code. It seems that this feature has been silently removed. Or do I miss something here?

I have a 1.1.3 install where it is still present. In that version disabled objects are still present in the spatial hash container but there container references and everything else is not updated. Removing them from the scene would definitely be better but I don't know how much of a difference it would make. Probably it's not worth the trouble.

-Michael
#7
09/25/2008 (9:06 pm)
Hi Michael,

There's a function on all t2dSceneObjects "setEnabled". You pass a bool to this function which will set the object to enabled or disabled. You still have to kill all schedules manually though. This function is definitely in 1.7.4 which I am using, don't know about 1.7.3 though.
#8
09/26/2008 (1:14 am)
Wes,

yeah, I just found it :) It has been moved from t2dSceneObject to one of its base classes - SimComponent.