Booty5 v1.8.5b out now – Cached rendering and Marmalade SDK Audio Support

Well the proof is in the eating and not the making. I’ve spent some time putting together a small game using Booty5 called Leapo that I will eventually distribute as an example of how to use Booty5. Whilst developing this game I have come across various issues or missing features, hence this update.

Booty5 game engine changes:

Added new Actor setPositionPhysics() and setRotationPhysics() to set associated physics body position and rotation directly

Added new utils class that contains utility functions

Fixed actor and scene sorting using new sorting method in Utils called sortLayers()

Added new property to TheApp called use_marm which should be set to true if deploying to mobile using the Marmalade SDK

Added new property to Sound constructor called reuse which can be used to force the sound effect to be reused (only useful for short sound effects at may not play if one is already playing)

Sound class will now use the powerful Marmalade audio system instead of standard, if its available

Added new method TheApp.parseAndSetFocus(scene_name) which parses xoml JSON and sets the named scene as the current scene

TimelineManager.add() now returns the timeline that was added

Scene.addActor() now returns the added actor

Actor.addActor() now returns the added actor

TheApp.addScene() now returns the added scene

ParticleActor.addParticle() now returns the added particle

Main loop timer replaced with requestAnimationFrame for smoother rendering

TheApp now measures average frame rate via avg_fps property

TheApp has new property called adaptive_physics which will run physics update multiple times within a single frame if frame rate falls considerably outside target frame rate

Actors can now all be cached by setting cache property to true. When cached the actor will be rendered only once to an off screen canvas, subsequent rendering will be of the cached version. note that the Size of the actor as specified by its properties will determine the size of the cached canvas area. In the case of unfilled actors, the allocated size will be slightly larger to allow for stroke thickness. Note that shadows and composite operations are not cached

Booty5 game editor changes:

ExportName Scene property is now saved and restored correctly

Load scene property now cloned correctly

Target frame rate now exported

Fixed main.js for Marmalade SDK export, also now copy wb.js over from SDK into build folder

Marmalade native audio will be used in place of standard audio if available

Added new property to Sound resource called reuse

Added new project property called Adaptive Physics which can be used to run physics multiple times per game update

Unfilled rounded rects with corner radius now render properly

Actors can now be marked as cached which causes them to be rendered once to an off screen canvas

Added new measure button next to size property in properties panel, this will set the actors size to the extents of any attached geometry

Exported main.js will now wait until resources are loaded before starting TheApp

Whilst all of the above changes are a positive, one of the more important changes includes caching of actors for rendering. HTML5 is not particularly fast (especially on mobile) at rendering things like gradients and shapes. Actors can now be marked as cached which will force them to be rendered once to an off-screen surface, subsequent renders will render the cached version. When deployed via Marmalade Web I am seeing a good 30-60 fps frame rate for Leapo on an iPhone 5C.