Python in Blender

Is it possible to make 3D games in blender with python scripts alone?

Python will be an important part of any game, but it won’t be the only thing that’s used. The logic-bricks mechanism still needs to do as much of the work as it is capable of doing, because it’s so much faster.

Logic-bricks will be what causes your Python game-handling code to be executed. The brick will call your code as a subroutine, the brick having determined that a call needs to be made.

If you code it well, Python is quite fast. You simply want each routine to be “sweet, simple, and to-the-point.” Then you want to make sure that each one gets called, to the maximum extent practical, when and only when it probably needs to be. The start-to-finish execution time of the Python routine will probably never be an issue; what you’ll need to be mindful of is avoiding extraneous calls.

Hi Cloud7, and welcome to Elysiun!

I am presuming that you are new to programming and that sundialsvc4’s excellent answer went mostly over your head.

The best place to post these kinds of questions and find answers is the Game Engine Forum. At the top there are stickys with tutorials and example game code and useful tools to help when making your games.

In simple terms, games work by defining actions (your code) which occur in response to: user input, time, and/or other actions. The infrastructure to handle this is the game engine. All you need to do is define what your actions are and how they relate.

Logic-bricks are really the pieces. They define how they relate to each other and you attach little pieces of code (in python) to them that gets executed when appropriate.

The trick, like sundialsvc4 said, is to only execute code when absolutely necessary…

Hope this helps. Read up, try something simple, modify examples, and you’ll get it fairly quickly.

Good luck!