Friday, December 17, 2010

Introduction to the Blender Game Engine


Source::http://solarlune.wordpress.com/2010/12/17/introduction-to-the-blender-game-engine/

The ninja of the night, SolarLuneHi, there. As you may or may not already know, this is a blog about game design, and I’m going to help you, the reader, to create your very own PC game. The tool I will be using is the Blender Game Engine, to which I will refer as the ‘BGE’ from now on. Now, because this is a very basic tutorial and it’s not really meant to delve into the more complex topics of the BGE, but rather is meant to just give a basic understanding of how the BGE works. The game logic executed in the BGE is made up of Logic Bricks. What is a Logic Brick?

This is a logic brick: A Logic Brick for use in the Blender Game Engine

In the Blender Game Engine, a Logic Brick is a portion of code (shaped like a rectangle) that the developer can customize to fit his needs and perform some sort of action. In the example to the right, this Keyboard logic brick is capable of reading information from the specified key – the Left Arrow. Logic Bricks are split into three types:

Sensors – Sensors sense physical data in the game engine or test data equalitiesActuators – Actuators perform actions on data or game objects – examples are motion, sound playing, and object creationControllers – Controllers test to see if the attached sensors equate as true, and if so, then they trigger the attached actuators. A controller could be And, Or, Nor, or other types of testing values.

As the example above shows, sensor logic bricks in particular have true and false pulse modes, which are the two buttons to the left of the ‘Freq:’ number box. The True and False pulse modes control how the sensor reads the input data specified.

The basic idea of using the BGE would be to use sensors to read the data about the state of the game and to activate the actuators. For example, if you attach an “Always” sensor, through an “And” controller, and attach it to a Motion actuator, then the “Always” sensor will drive the Motion actuator – because there is no other sensor attached to the “And” controller, just the “Always” sensor will actuate it. (For more info, look up Blender explanation)

For those who are more adept with programming, a Python controller is also present, which allows for using a Python script file to read the sensors and control the actuators. Python is a very powerful and useful programming language that allows for much more precision in the BGE than using logic bricks alone. With Python, most anything is possible to do with the BGE. Here’s a link to a page featuring basic tutorials for using the BGE. Now, with a normal understanding of how the BGE works, making a game isn’t going to be difficult at all. So, let’s create a new game using the BGE. Since there are already tutorials for making basic games using the BGE, I was going to try making more complex ones. Let’s try… A 2D Platformer.


View the original article here

0 comments:

Post a Comment