Starting the Blender Game Engine (BGE)

Objectives

a Programming games in Blender is possibel in two ways but starting the Game Engine, in short BGE or bge, works allways the same. Some pitfalls are discussed, therefore the fun factor is still at a hight level :-)

The bge module

The bge module contains nearly all you need to write a game in Python. But if you write

import bge

in the interactive interpreter or a script, which you start with »Run Script«, you’ll get the Error:

ImportError: No module named 'bge'
That’s because the bge module can only be imported, if the Blender Game Engine is running.

Start BGE the right way

  1. Change the Render Type from »Blender Render« to »Blender Game«

    ../../_images/change_render_type.png
  2. You can start the Blender Game Engine now by clicking »P« while the cursor is over the »3D-View« or by clicking »Start« in the Render Properties.

    ../../_images/start_bge.png