Game slowing down
by Backman · in Torque Game Builder · 04/09/2007 (3:15 am) · 5 replies
Hiya, I'm currently writing my first TGB game so I'm not terribly experienced, and I've got a problem with my game slowing down after playing it a few times. To solve it I'll need to restart TGB, just stopping the game and restarting doesn't do much.
It's a shooter type game and I'm kind of thinking it's got something to do with not deleting the ship's weapons properly although I do use safeDelete to delete both weapons and any attached fx. I've doublechecked this everywhere and can't find a reason why this happens. If anyone has any suggestions it'd be really helpful!
I was wanting to try to remedy this by deleting all objects that were created during the game in the function endGame() in game.cs, but I'm not sure how to 'store' those objects to be able to do so in there.. shouldn't be needed anyway I'm thinking. : /
Thanks!
It's a shooter type game and I'm kind of thinking it's got something to do with not deleting the ship's weapons properly although I do use safeDelete to delete both weapons and any attached fx. I've doublechecked this everywhere and can't find a reason why this happens. If anyone has any suggestions it'd be really helpful!
I was wanting to try to remedy this by deleting all objects that were created during the game in the function endGame() in game.cs, but I'm not sure how to 'store' those objects to be able to do so in there.. shouldn't be needed anyway I'm thinking. : /
Thanks!
#2
04/11/2007 (12:51 am)
Are you doing a lot of echoing? i once encountered the problem, after ensuring that unwanted objects are deleted, the problem did not stop. later i realised that i am doing so much echo that it is beginning to hang my game....
#3
Now the weird part, if I clean all the objects, the FPS count does not go up. I will take a look at it later on, probably shut down the object factories once there are x objects onscreen.
04/11/2007 (1:57 pm)
I have a similar problem without any echoing. The behaviour is somewhat... weird. I'm "throwing" new objects to the scene from time to time. If I don't play the game, thus eliminating the objects I notice a FPS decrease.Now the weird part, if I clean all the objects, the FPS count does not go up. I will take a look at it later on, probably shut down the object factories once there are x objects onscreen.
#4
I tried removing all my echoes that were quite a few actually but it doesn't seem to help that much.. the game starts running over 150fps but after a while it has dropped down to 60-70fps. Didn't have more time to check if it went down further but the problem's still there.
There is a bunch of error messages like can't find function blabla for object blabla, nothing unexpected and something I should fix. Didn't think that would slow TGB down but maybe it will? Will go through all my code and try to sort everything out properly next.
Thanks again for the help guys.
04/11/2007 (2:10 pm)
Ok thanks both, I do create datablocks but only once during startup using a exec("./datablocks.cs"); command so wouldn't think that's the problem but good to know nevertheless!I tried removing all my echoes that were quite a few actually but it doesn't seem to help that much.. the game starts running over 150fps but after a while it has dropped down to 60-70fps. Didn't have more time to check if it went down further but the problem's still there.
There is a bunch of error messages like can't find function blabla for object blabla, nothing unexpected and something I should fix. Didn't think that would slow TGB down but maybe it will? Will go through all my code and try to sort everything out properly next.
Thanks again for the help guys.
#5
Yes you should fix that as soon as possible. That may or may not be the reason for the FPS decline, but it's good to have clean code anyway!
04/11/2007 (7:25 pm)
Quote:There is a bunch of error messages like can't find function blabla for object blabla, nothing unexpected and something I should fix.
Yes you should fix that as soon as possible. That may or may not be the reason for the FPS decline, but it's good to have clean code anyway!
Torque Owner Kevin James
I think I experienced your problem before. The game was running fine, but all of a sudden the FPS dropped significantly.
I eliminated this problem by taking out a section of a script that was creating datablocks. What was happening was that almost 20 identical datablocks were being created at one time, thus slowing down the machine. I put the datablocks in by using the Image Map Builder, and haven't had that problem since.
Deleting every object in the EndGame() function isn't going to help. I actually considered this myself when I experienced your problem, but it would be ineffective and very tedious to write. You don't have to worry about objects created ingame after you end a level.
Hope this helps.