Running Game Engine from Command Line


I apologize if another newbie has asked this already, but I was wondering if it’s possible to run the Game Engine from the command line using bge.logic.startGame()

I attempted to do ./blender -P,

where is as follows:

import bge

Of course, this does not work as bge is only available whilst the game engine is running.

Any suggestions?


If you want to start a BGE game from the command line, use the BlenderPlayer. If you want to start a BGE game as soon as you open the blend file via Blender, the only real way is to set it to Auto-start from the game menu. Note, though, that doing this causes the blend to immediately start the game engine, so your game will be in a lock if you save it after turning Auto-start on.

Actually, You could call the operator to launch the game engine using a script.
Import the bpy module and somewhere there will be an operator.

Yes, it seems you cannot call that operator from the commandline, as there is no context to work from. Your best bet would be enabling autostart, or using BlenderPlayer