Booty5 1.8.6b out now – audio fallback, templates, merged caches

With plenty of free time over the holidays the hammers and chisels have been working hard to bring you Booty5 1.8.6b. We have a fair number of changes to both engine and editor as well as two new demos as well as most of the other demos updated, including Leapo.

Engine Changes:

Added new property to Actor called merge_cache which when set to true will attempt to merge the actors rendering into a suitable parents cache. Note that once an actor has been merged into its parent its visual properties cannot be modified

Add new property to TheApp called focus_scene2 which sets a 2nd scene as focus, this scene will be used for touch events if the first main focus scene does not respond to them

Added support for fallback sound to Sound class via location2

Added new min_panning property to Scene. This will prevent panning being marked as true if the movement distance squared is below this value

Sound now supports looping via Sound.loop

All Xoml parse functions now return the created object

New Xoml.findResource() added which searched a Xoml resource collection for the named resource

Fixed issue where Actor.current_frame was going out of bounds

Fixed polygonActor gradient fill

Examples updated

New “Create Objects from Template” and “List Menu” demos added

Editor Changes:

Added new property to Icon / Label called merge_cache which when set to true will attempt to merge the actors rendering into the a suitable parents cache

Scene Current property has been renamed to the more appropriate “Has Focus”

Scene has new property called Secondary Focus which sets a 2nd scene as focus, this scene will be used for touch events if the first main focus scene does not respond to them

Added new “clone to all scenes” menu action which will clone an Icon / Label to all scenes

Added new “delete from all scenes” menu action which will remove all Icons / Labels from all scenes that share the same name as the selected item

Added new “copy to scene” menu action which will create a copy of the selected actor and copy it to the selected scene

Added new “bring to front” and “send to back” commands to resources tree view

Added new resource view text size change buttons which can be used to increase / decrease font size

Added new Disable Shadows property to project properties. Setting to true will disable export of all shadows for all actors

Added fall back audio file to sound properties, this file will be loaded if original one fails to load

Merged Caching

In the last update we added support for the caching of primitives such as rounded rects / gradients so that they only get drawn the once, this can provide a hue speed boost especially on mobile devices. Merged caching takes that one step further by allowing child elements to be merged (drawn) into the cache of a cached parent that is higher up in the hierarchy. This allows you to render lots of complex actors into a single cache. Remember however that once merged into a parent it cannot be rotated, scaled or modified in any way.

Secondary Focus

Whilst writing Leapo I came across an issue where I wanted to be able to activate a pause button that was in the HUD scene, whilst still having the game scene have touch focus. To fix this I added a secondary focus property to scenes which effectively allows two scenes and the objects within those scenes to all receive input.

Audio Fall back and Looping

Whilst deploying Leapo across a number of different browsers and mobile devices I became aware that there doesn’t appear to be any standards for audio format support, so I have added a fall back option that allows a second audio file to be loaded if the first fails. It seems that most browsers / devices can be covered by supporting OGG and MP3. I have also added looping support, sounds can now be marked as loop to force them to replay when the sound finishes playing, this is ideal for background music.

Objects Cloning

I’ve modified the Xoml system to enable object cloning. Object cloning is basically creating a new copy of a resource that exists within the Xoml data. The Xoml data is the arrays /. objects that are exported from Booty5 and loaded and parsed when the game boots. This enables you to create multiple copies of the same object, including any child objects. I’ve added a simple demo that shows how to do this. Below is the code:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

functioncreateNewBalls()

{

varapp=window.app;

// This scene will receive a copy of ball object

vargame_scene=app.findScene("gamescene");

// Search Xoml gamescene for ball icon actor resource

varball_template=Xoml.findResource(window.gamescene,"ball","icon");

// Create ball from the Xoml template and add it to game_scene

varxoml=newXoml(app);

xoml.current_scene=game_scene;// Xoml system needs to know current scene so it knows where to look for dependent resources

Ludei’s CocoonJS

I took the opportunity to give Ludei’s CocoonJS a whirl and was quite pleased with the result. CocoonJS packages your app with its own optimised WebView which (on Android at least) is 10x faster in my tests than the default Android browser. Leapo plays at a good 60 fps on iOS and 30fps on Android running under CocoonJS. I’ve included CocoonJS with Booty5, you can enable CocoonJS export in the project properties.