Can you debug random game crashes?

Hi all.
My game tends to randomly crash when playing. I have the system console open and it reports no errors at all. I have crashed repeatedly on several computers and my main compyter only two weeks ago was upgraded to a shmick new graphics card with latest drivers. Is there some way to debug a running game other than the system console?


Post morten debugger is the best, but not so newbee freindly, option.

If the crash is in Your python code You can locate it by adding traces (flushing often needed too). But even if Your python code cause the crash it is not for sure it happens in Your code.

If you think a python call is crashing it you can add print statements in your code, starting from the beginning of the logic loop to the end of it. If you see the print statement - you know it happened before the crash, if you don’t see the statement you know it happened after it. Keep doing this until you locate the call that crashes your game and then you can try and work out why it happened.

It can be a pain in the ass, especially if you use callbacks for some stuff, but its really the only way to do it.

If it isn’t a python call that crashes it, you’re going to have to try isolate the problem. Remove certain game aspects or features or objects until your game runs fine.

If you don’t keep periodic backups you should start doing so, its happened to me before and I haven’t been able to find the error so I’ve had to roll back to an earlier update.

p.s. might be sounds?

It’s funny how much more stable the game is (ie, hasn’t crashed yet) with the sounds removed. Is there a preferred workflow for sound? is ogg better than wav or mp3? Any thoughts appreciated.


What do You us for sound - actuator or aud module, OpenAL or SDL… or something else.

I’m using sound actuators and openAL, all pretty standard.
Is there a better way? I guess someone’s going to say python aren’t they :wink:


No, I think sound from the logic bricks and from python are the same. I’m not too sure why it happens.

Well. It’s pretty offical. Sound is crashing my game. No matter if I use SDL or openAL it crashes. I have made all of my samples OGG but to no avail. The only way to play my game is mute.
Could anyone shed any light on this? I have tested at work and the result is the same.


Is it a certain sound file or sound type that crashes blender?
If you can isolate it as much as possibke then post a bug report a developer might hopefully try and solve it

I’m not sure that it’s a certain sound type as I’ve tried ogg and wav and mp3 and now I am changing it all over to Python and Audaspace (which is trying my python patience :))


If you can easily reproduce the problem, please report it to the bug tracker with a sample file.

Create a new blend file and append all objects from the other blend file(the one.with problems) ,do not append the scene, and save it as a different blend file then try again.

If you have an svn checkout of the bge source, you can just compile it with debug symbols, and then run it through gdb.

Although, unless you plan to fix the issue yourself, it’s probably not going to be all that useful to you.

As Moguri suggested, you should make a detailed report in the tracker:

I will make a deatiled report once I figure it out. I have started to rebuild the audio using Audaspace and Python and the whole thing is becoming stable again (but it’s a lot of work to track down all of the audio and rebuild it.)
…which leads me to a question…

I am calling sounds as I need them with some sample code I found on the web…

def falling():

    cont = logic.getCurrentController()
    obj = cont.owner

    if not 'init' in obj:
        obj['init'] = 1
        logic.device = aud.device()
        falling = logic.expandPath('//sounds/Fall_004.ogg')
        obj['sound'] = aud.Factory.file(falling)
        handle =['sound'])
        handle.volume = 1

Now, this plays a sound once only which is fine. When i have a character jumping where I need the sound to repea, I have simply taken out the if statement like so…

def dirtfall():

    cont = logic.getCurrentController()
    obj = cont.owner
    logic.device = aud.device()
    dirtfall = logic.expandPath('//sounds/dirt2.ogg')
    obj['sound'] = aud.Factory.file(dirtfall)
    handle =['sound'])
    handle.volume = .5

But now I get the sound playing twice each time it’s triggered. Is there a way to play it once as in the first snippet of code, but reset for the next time?

Thanks again,