Game Development Community

Max CPU usage in Torque

by Milan Rancic · in Technical Issues · 01/06/2008 (4:21 am) · 5 replies

When i start my game, TGB use max CPU resources that he can. The game will draw 1000 FPS-s if she can.

anyway, i decided to write this down:

t2dSceneGraph.setScenePhysicsFPSActive(true);
t2dSceneGraph.setScenePhysicsTargetFPS(80);

But its not working. I tried to call it from startGame() function and it reports an error. Then i tried from levelLoaded() functon, and that doesn't work neither.

What am i doing wrong?

#1
01/06/2008 (2:42 pm)
You need to specify it for a particular scene graph I think. You can set the frame rate for different scene graphs depending on their contents. Try:

SceneWindow2D.GetSceneGraph().SetScenePhysicsTargetFPS(80);

...after you load a scene.

And, by the way, 80 fps is much faster than you need. Anything faster than, say, 30 fps is imperceptible to the human eye.
#2
01/06/2008 (3:29 pm)
Hmmmm there by chance a similar function for TGE?
#3
01/07/2008 (1:00 am)
Hmmm.... still nothing.
Actually, how do i echo how much is my FPS? There is no getFPS() function? And i cant start debug banner during the game.

So i use a $counter++ in onUpdateScene() function to echo FPS-s. But the value is still unchanged, although it may vary a lot depending of the machine on which i am running my game. From 300 to 900. I dont know if those are real FPS-s? Debug banner in editor shows something like 100FPS-s, but i dont know how much is in the game.

You said:"After i load scene" will it be enough if i put it onLevelLoaded() function?
If i understand correctly, scenegraph is something like _root of all objects? But i dont understand how can it be more than one scenegraph?
Scenewindow is something like "visible screen" right?
#4
01/07/2008 (3:34 am)
To see the fps check out metrics(). In your case would be metrics(fps), but I dont know if it works for TGB though.
#5
01/07/2008 (1:16 pm)
Nope, there is no metrics() in TGB :(

Any other ideas?