Cant exit game

I need some really quick help. I set it so that the camera in my game scene has logic bricks to switch the scene to the menu when I hit escape. I thought that once I was in the menu I could just hit escape again to exit the game, but escape does nothing. Is there any way to exit the game without closing blender and loosing my work?

I would check a few things to make sure everything would work.

  • You actually have a game logic brick that ends the game at the menu scene, one that doesn’t require any conditions to be met.

  • If the problem is you’re not making it to the menu, you need to make sure you typed the name of the menu scene correctly, note that the scene actuator is also case-sensitive.

  • If there’s any python being used and the scene actuator is connected through a script, you need to make sure there’s no errors that prevent it from working.

It does go to the menu when I press escape, the problem is that now that I’m in the game I can’t use escape to exit. I can’t access anything because it is stuck in the playing game engine. I need to know if I can exit the game without shutting down blender and loosing my work.

Do you have a keyboard sensor (in any object in the scene) mapping the escape key to do something else other than exiting the game? Generally if you’re using the key for anything else, it will override its default behavior of quitting the game.

Yes, it is mapped to switch the scene to the menu. I thought that since it isn’t mapped to anything in the menu scene that I could just use escape to exit the game from the menu, but the escape key does nothing in the menu scene. So I am locked in the game, is there a way to exit the game without using the escape key or closing blender?

In that case, have you tried using an object to map the esc key in the menu to close the game using a game actuator?

If the key isn’t doing anything by default, then you might need to use that simple bit of logic to map it manually instead.

AceDragon, he means the game is running NOW and he can’t escape NOW. This has happened once before, I’m not absolutely certain but I think there was a solution. Does anyone know about this?

Yes Raiderium, thank you for understanding. I hope someone knows the solution so I don’t have to redo my work.

Recover last session (quit.blend) seems to work from BGE.

I just made a test file, changed a few things (resized default cube etc.), didn’t save, wasn’t on long enough for auto-save, hit ‘p’, closed the window, restarted blender and recovered it. Not an extensive test of anything I don’t want to lose but it looks like it does the trick.

Sounds risky, I will try it if no one comes up with a better solution by the time I get back on my computer in the morning.

That quit.blend thing sounds like it ought to work. (Assuming you are using 2.5x- it does not work in 2.49b.) I doubt the game engine is ignorant of the window close event; it very likely goes through a graceful shutdown, thus generating the quit.blend file when the close button is clicked. I’d try it!

Cancelling the default exit without implementing another exit path is not a good idea.
Sorry, You learned that the hard way (I did it I think at least 2 times ;)).

At least until 2.49 you have to kill the process (closing the console window usually helped). With 2.5 you might need to kill the blender process manually.

As far as I remember the last blend file is stored in some temp folder. But I do not know where exactly.


Unfortunately, I think exiting and hoping for a good quit.blend is your only option. I seem to remember the end key working on some platforms before, so you could try that. But, as Monster said, don’t leave yourself without a way to exit the engine! I’ve been bitten by this too a few times. So, for things like a menu, I do all my dev work with something like the accent/grave/tilde key as my menu key. This way if something breaks (I use a lot of Python scripts), then I still have Esc. However, for a “release” build, I can switch to the esc key.

The Cucumber GSoC branch has a few semi-solutions for this problem. First off, you can change the exit key, so you could map it to some other key (end?) and still use the esc key for your menu. Also, in the Cucumber branch, you can launch the Blenderplayer from inside Blender. This means you get a window, etc. So, if the game can’t exit, just kill your process (blenderplayer) and Blender itself is fine.

I thought I had left a way to exit since esc wasn’t mapped to anything in the menu I thought it would work. Thanks for the help, I will see if it works later as I can’t get to my computer right now. I will have to take a look at the cucumber branch.

Thanks for pointing that out… Didn’t mean to spread false hope.

Yay, it worked! I have used quit.blend before to recover from crashes, but I had forgot about it completely. Thank you all for saving my work!