Game slowing down over time?

Blitz3D Forums/Blitz3D Programming/Game slowing down over time?

tonydillon49(Posted 2004) [#1]
Can anyone point me in the right direction for this? I have a game which loops through a number of routines fairly continuously. However, it seems to be taking a little more memory/system resource each time around as after about 10 minutes it starts to stutter and slow down.

I am not declaring any new variables, loading any new images or leaving any loops open - can anyone help me out with this? Is there any way to clear unused memory during runtime? What am I missing?

Tony D


Gabriel(Posted 2004) [#2]
Creating any type instances? Creating any geometry? or textures? Using the debuglog?


tonydillon49(Posted 2004) [#3]
I am using the debuglog - I will remove all calls to that and see how it helps. Thanks!


BlitzSupport(Posted 2004) [#4]
What sort of thing are your loops doing?


Shambler(Posted 2004) [#5]
You haven't got something like a=loadmesh("blah.b3d") or similar in your main loop have you?

I did that once , was most confuzzling for a few minutes.


Stevie G(Posted 2004) [#6]
I've found that when writing alot of info to the debuglog things slow to a canter after a while.


Ricky Smith(Posted 2004) [#7]
As the debug log file gets bigger it will get slower !
Make sure you are not writing too many lines to the debug log - avoid writing to the debuglog from loops etc.


Warren(Posted 2004) [#8]
I once had a bug in my game where I was allocating a pivot every frame accidentally. After 10-15 minutes the game speed would start dropping rapidly ... was most confusing until I systematically broke the game down and found the offending line.


Al Mackey(Posted 2004) [#9]
I had a similar problem EpicBoy... in my first 3D sound test I was making a pivot to mark the location of every sound played but not deleting them when the sounds finished. Took me forever to find the bug too.


Zethrax(Posted 2004) [#10]
Instead of constantly writing to the debuglog, perhaps you could try storing the debug data in a Type and then save the resulting Type chain to a file when your program ends.


tonydillon49(Posted 2004) [#11]
The only things I can think of that would cause the game to slow down (it's a lot better without the debuglog calls - but it still slows after a while) are:

- New graphics are being created within loops. These are being done by making copies of existing graphics which are held as global variables

- Same thing with 3D objects. I have a game board with a number of pieces which change relative to the current game activity, so I have 30 placeholder objects which I loop through and change

Would either of these activities cause the problem?


Danny(Posted 2004) [#12]
I would suggest to double check if you 'create' something during your main loop. Pivots, meshes, textures, image buffers, timers, handles to read a directory, sprites, memorybanks, sounds, music, etc. All these things can be loaded/created and need to be 'freed' when you're done with them. I always keep track of the amount of objects with variables like NUM_SPRITES or NUM_SOUNDEFFECTS. Increase them if you add something, and substract 1 when you remove something. That way, when I delete everything, those NUM_xx variables should all be 0. That way I know nothing is 'leaking through'....

hope this helps,

Danny


CodeD(Posted 2004) [#13]
might wanna make sure you're not running multiple instances of bb3d or bb3d windows as well, especially with debug enabled.