Starling 1.6Daniel Sperl on December 12, 2014
It's just a few days before this year's festive season is beginning, so chances are that you're currently looking for gifts and presents for your friends and family. It's the same here at Gamua — and what better gift could we give you than a brand-new version of Starling? That's right: version 1.6 has finally arrived!
This is a very special release for me. While the last few versions contained mainly polishing and optimizations, this one comes with a major new feature that makes entirely new games possible, and it makes full use of some of Adobe's very latest Stage3D improvements. Let's check it out, shall we?
If you're following this blog, you probably saw this one coming: finally, you can transform your Starling objects in a 3D space! That allows some really cool effects, like 3D transitions between your Feathers screens or peeking at the backside of playing cards.
It's really easy to use, too. Simply create an instance of the new Sprite3D class and add children as usual. Then modify some of the 3D properties, especially "rotationX/Y" and "z". Before you know it, you'll end up with a game like the one you can find here.
In addition to what I showed you in the above-mentioned post, I recently added the ability to modify all details of the 3D perspective via properties on the Starling stage, namely
projectionOffset. Furthermore, there are a few new methods and properties on the
DisplayObject class (e.g.
Going into too much detail here would be beyond the scope of this blog, but you'll find all you need to know in the new Sprite3D chapter of the Starling manual.
I'm looking forward to seeing the first games that make use of this feature! Be sure to let me know when you've got something to show me.
Enhanced Asset Management
You know the problem: the player launches your game and you want to let her start as quickly as possible. Alas, you first have to load all the textures and sounds — a task that's equally time consuming as it's boring!
If you're using Starling's AssetManager, this release will reduce that burden significantly. The AssetManager now loads multiple assets in parallel, and this makes the process much faster than before (no matter if you're loading them from disk or from the network). Expect at least twice the previous performance!
Another small improvement: it's now simpler to load textures with varying settings. Just follow this example:
var appDir:File = File.applicationDirectory; var assets:AssetManager = new AssetManager(); assets.textureFormat = Context3DTextureFormat.BGRA; assets.enqueue(appDir.resolvePath("textures/32bit")); assets.textureFormat = Context3DTextureFormat.BGRA_PACKED; assets.enqueue(appDir.resolvePath("textures/16bit")); assets.loadQueue(...);
In other words, the "enqueue" method now remembers the settings you had on the AssetManager at the time you enqueued the asset and creates the textures accordingly in the "loadQueue" method.
Furthermore, it now dispatches "IO_ERROR", "PARSE_ERROR" and "SECURITY_ERROR" events if it runs into problems while processing the queue. That should allow you to handle those problems gracefully.
Nested Filters & Improved RenderTextures
In the past, Stage3D enforced a limitation that made it hard for me to make RenderTextures and filters as flexible as I wanted them to be. With Flash/AIR 15, this limitation is finally gone, which allowed me to implement several changes:
- You can now add a filter to a container that already contains filtered objects.
- It's now possible to draw a filtered object to a RenderTexture.
- Persistent RenderTextures may now work with just a single buffer — cutting the required memory by 50%! (Enable
RenderTexture.optimizePersistentBuffersto make this happen.)
It must be mentioned, though, that this feature requires a little extra care on your side. On iOS and Desktop, you're safe, but not on all Android hardware. Some old devices might show degraded performance or produce visual glitches when you rely on these features.
Unfortunately, I don't have any hard data yet about the number of affected devices. In fact, I only received one report of a problem so far, so it might not be a big issue. Still: if you want to avoid any risks, only use those features on somewhat modern hardware, e.g. only beginning with Android 4.3 or when "Standard" profile is supported.
The complete list of changes is quite extensive! As always, you can find it on GitHub. If you're in a hurry, here's a summary of the most notable other changes:
- The TextField now supports HTML text for TrueType fonts.
- The Button class supports textures for 'over' and 'disabled' states.
- The new 'stopWithFatalError' method will display a panic message to the user.
- Added 'soundTransform' property to MovieClip class.
- Added 'ignoreChildOrder' parameter to 'Sprite.flatten()' (yielding great performance).
- Added modules and a project for IntelliJ IDEA (project found in 'starling/build/idea').
- Added build scripts for Gradle & integrated with TravisCI.
- BitmapFont composition now pools all internally used objects.
- The TextureAtlas now caches all SubTextures.
- The TextureAtlas now caches the list of available texture names.
- 'AssetManager.loadQueue' now processes font and atlas XMLs in separate steps, providing a smoother loading experience.
It goes without saying that this release contains a huge number of bug fixes, as well.
Where to get it
Finally, I want to thank all of you for your support and help over the last months! Many of the new features originated in pull requests from amazing developers; others were inspired by comments or constructive criticism in the forum. Thanks a lot for that, guys!
Now be sure to get started with Starling 1.6, and don't forget to write a comment below — I'm looking forward to any feedback!
Oh, now I almost forgot: a merry Christmas to everyone who celebrates it, and my best wishes to everyone else! :-)