How to Optimize UPBGE

I am running UPBGE and almost every time I press the escape key to end the game, the program stops responding. Does anyone have any tips on how to prevent these unexpected crashes?

You might be freeing up data incorrectly or creating an exception access violation. Try deleting stuff in your scene till you can exit without crashing and then isolate the object or script that causes the crash.

are you clicking on the debug console?

if you do that you have to click it and hit escape

it waits for input in the console - freezing the main window

Ok. Thanks.

Would the fact that I’m using a USB game controller and keep coming up with a warning have anything to do with it? This is the message that keeps popping up in the system console: Warning: Game Controller (Logitech Dual Action) with index 0 has not force feedback (vibration) available.

Mine does the same, I don’t think that’s a problem.

Sometimes the engine freezes up on exit because Blender runs out memory; I see it happen a lot with files too large for their own good. If you have a lot of materials, textures, meshes and objects all packed into the same blend, tightly crammed into just a few layers if you want to make it worse, having to revert back from ingame to that original scene can be too much.

Also, if your code is opening up a lot of files – even small ones – or generating objects holding too much data, serious funk may ensue. Maybe, append a clean-up function to KX_Scene.onRemove to ensure likely culprits are taken care of?

I tried removing all complex materials and excess objects from the scene and combined all of my scripts into one, removing all repeating lines of code, but the application sill crashes frequently while the game is playing.

It doesn’t happen every time, but still quite often.