From BlenderWiki

Jump to: navigation, search

Blender 2.77: Game Engine

Screenshot Actuator

ScrennshotActuator.png

The new screenshot mode can be found in the game actuator. (see commit d1ee195260c3676eb822a0025167ea8a785ccfa5)


Adding a Max Jumps value to the character physics

BGE-max-jumps.png
  • The Max Jumps value (1 to 255) allows to set the maximum amount of jumps the character can make before it hits the ground.

(see commit 3dd83b533a032fe4e5e39a275e7f2fcff2beaf15 )


Saving screenshot done in different thread

Screenshots are now saved in a different thread. This means that the game engine keeps running, while performing things like PNG compression and disk I/O. As an example, to record the results of a crowd simulation system (including overlays drawn with the bgl module), a screenshot is saved for every frame. The simulation now takes up 13 msec per frame, which was 31 msec before this patch. Effectively, it allows the simulation to save every frame and still run at 60 FPS. See commit 31cc60e76bfa8.

Python API changes

Change KX_WolrdInfo mathutils vector to color

Please read the compatibility issues.

sce.world.backgroundColor.r = 1.0

Changed Character maxJumps to char and allow 0

  • Limit the maxJumps value from 0 to 255
  • If the maxJumps value is zero the character can't jump.

(see commit 83721682bb12a5b3c277e832241e0752fdb2df2e)

bge.constraints.getCharacter(obj).maxJumps = 0

Clock management improved

  • With this release we will be able to accelerate / slow the time, and also to finely synchronize clock with external engines. Several new python functions have been added and existence ones have been improved for that purpose:
bge.logic.getClockTime() 
# Get the current BGE render time, in seconds. The BGE render time is the simulation time corresponding to the next scene that will be rendered.
 
bge.logic.getFrameTime() 
# Get the current BGE frame time, in seconds. The BGE frame time is the simulation time corresponding to the current call of the logic system.
# Generally speaking,  it is what the user is interested in.
 
bge.logic.getRealTime() 
# Get the number of real (system-clock) seconds elapsed since the beginning of the simulation.
 
bge.logic.getTimeScale() 
# Get the time multiplier between real-time and simulation time. The default value is 1.0.
# A value greater than 1.0 means that the simulation is going faster than real-time, a value lower than 1.0 means that the simulation is going slower than real-time.
 
bge.logic.setTimeScale(time_scale) 
# Set the time multiplier between real-time and simulation time. 
# A value greater than 1.0 means that the simulation is going faster than real-time, a value lower than 1.0 means that the simulation is going slower than real-time.
# Note that a too large value may lead to some physics instabilities.
 
bge.logic.getUseExternalClock() 
# Get if the BGE use the inner BGE clock, or rely on an external clock. The default is to use the inner BGE clock.
 
bge.logic.setUseExternalClock(use_external_clock) 
# Set if the BGE use the inner BGE clock, or rely on an external clock.
# If the user selects the use of an external clock, he should call regularly the setClockTime method.
 
bge.logic.setClockTime(new_time) 
# Set the next value of the simulation clock. It is preferable to use this method from a custom main function in python,
# as calling it in the logic block can easily lead to a blocked system (if the time does not advance enough to run at least the next logic step).

New Python API for light shadow settings

  • With this release we can access light shadow settings (read only). This can be used to create custom GLSL materials with the shadows generated by the scene lights (see commit c4c2bd13)
light.shadowClipStart 
# The shadowmap clip start, below which objects will not generate shadows.
 
light.shadowClipEnd
# The shadowmap clip end, beyond which objects will not generate shadows.
 
light.shadowFrustumSize
# Size of the frustum used for creating the shadowmap.
 
light.shadowBindId
# The OpenGL shadow texture bind number/id.
 
light.shadowMapType
# The shadow shadow map type (0 -> Simple; 1 -> Variance)
 
light.shadowBias
# The shadow buffer sampling bias.
 
light.shadowBleedBias
# The bias for reducing light-bleed on variance shadow maps.
 
light.useShadow
# Returns True if the light has Shadow option activated, else returns False.
 
light.shadowColor
# The color of this light shadows. Black = (0.0, 0.0, 0.0), White = (1.0, 1.0, 1.0).
 
light.shadowMatrix
# Matrix that converts a vector in camera space to shadow buffer depth space.

Access Textures openGL bind number

  • We can now access textures openGL bind code/id/number/name with a new Python method. This can be used to play with texture in openGL, for example, remove mipmap on the texture or play with all wrapping or filtering options. And this can be used to learn openGL with Blender. (see commit 608ee3e)
bindcode = own.meshes[0].materials[0].getTextureBindcode(0) 
# getTextureBindcode(textureslot): textureslot is an integer that represent the texture slot in the texture tab.

Performance

  • The changes in IK library, using Eigen library now, and in Moto library using float as default instead of double, give a perfomance increase of 2-2.5x in complex .blends.

Raster Storage

  • The immediate mode option (glBegin/glEnd) has been removed. This mode is slower than vertex arrays, and, with Blender's minimum OpenGL version bump, this mode is no longer needed as a fallback.
  • Vertex buffer objects (VBOs) can now be selected as a storage option. These are usually slower than vertex arrays with display lists enabled, and they may cause compatibility issues. However, if Blender switches to an OpenGL 3+ core profile, the BGE will need to switch to VBOs since vertex arrays and display lists are not supported by OpenGL 3+ core profiles. This option is available for users to experiment and play with, but is not, yet, recommended for actual usage.

Compatibility Issues

### OLD ###
sce.world.backgroundColor.x = 1.0
 
### NEW ###
sce.world.backgroundColor.r = 1.0
  • KX_GameObject.mass attribute only modifies the object's mass now. Previously on old blender versions, KX_GameObject.mass attribute modified object's mass and own object's gravity (object gravity was divided by old mass each time the mass was modified).