From BlenderWiki

Jump to: navigation, search

Blender 2.66: Game Engine

Character Physics

  • Added a maxJumps to the character controller to adjust how many jumps a character can perform before having to touch the ground. By default this is set to 1, which means a character can only jump once before having to touch the ground again. Setting this to 2 allows for double jumping.
  • Added a jumpCount to KX_CharacterWrapper. This can be used to have different logic for a single jump versus a double jump. For example, a different animation for the second jump.
  • The game engine now uses a less "float" default for the character controller's gravity.
  • Added a Character Motion type for the Motion Actuator with specific controls for characters. This includes moving, rotating and jumping.
Screenshot of the Character Motion Actuator new to 2.66.
  • Added a KX_CharacterWrapper.walkDirection to set the character's direction and speed. KX_GameObject.applyMovement() was changed back to its old 2.64 behavior for character controllers. In 2.65, applyMovement() was using walkDirection behind the scenes and causing some problems.

Profiler

The profile and debug properties display has been cleaned up and visual bars have been added to make bottlenecks more obvious.

Screenshot of the changes to the game engine profile in 2.66

Alpha Shadows

Added preliminary alpha shadow support for Simple shadow maps. They do not work in the viewport nor do they work for Variance shadow maps.

Alpha shadows using simple shadow maps in Blender 2.66

Asynchronous LibLoad

LibLoad can now be done asynchronous. This means the lib loading is done in a separate thread to keep the game engine from freezing. Here is an example from the docs:

# Print a message when an async LibLoad is done
import bge

def finished_cb(status):
    print("Library (%s) loaded in %.2fms." % (status.libraryName, status.timeTaken))

bge.logic.LibLoad('myblend.blend', 'Scene', async=True).onFinish = finished_cb

LibLoad() now returns a KX_LibLoadStatus object for information on the library loading. LibNew() and LibFree() are unaffected by this. In other words, the async option only works for LibLoad(). Furthermore it only works for Scenes, not Actions or Meshes.

NOTE: This feature is still experimental and may be unstable with certain scenes.

Python Joysticks

A Python interface was added for handling joysticks without needing logic bricks. These new SCA_PythonJoystick objects can be accessed using bge.logic.joysticks, which is a list of joysticks. The length of the list is the number of maximum supported joysticks, and indexes that do not have a joystick available are set to None. This means joysticks can be checked for using something like:

if bge.logic.joysticks[0]:
    activate_player_one()

if bge.logic.joysticks[1]:
    activate_player_two()

# etc..

The interface exposed by SCA_PythonJoystick is very similar to the joystick logic brick except for one key difference: axis values are normalized to a -1.0 to 1.0 range instead of -32767 to 32767, which is what the logic brick exposed.