Starling 1.1
Daniel Sperl on May 7, 2012During the weeks after the “1.0” release, our Starling didn’t think about slowing down or relaxing; on the contrary, he made some excessive flight-training and has learned several cool new tricks! Thus, without further ado: we present to you, the Starling Framework: version 1.1!
Multi-Resolution Development
With AIR 3.2 out in the wild, and the next version already around the corner, mobile devices are becoming more and more important for the Flash platform.
Creating a game for different platforms always means creating it for different screen resolutions. Optimizing a game for all those resolutions can be a tedious experience. Except when you’re using the new Starling version!
Developers coming from native iOS development will be familiar with this strategy: you create your game in one resolution (e.g. that of the original iPhone), but provide two (or more) sets of textures. At runtime, the optimal set of textures is chosen depending on the screen resolution, and the game looks crisp and sharp.
This is achieved with the help of Starling’s new “contentScaleFactor”, as well as a “scale” property on textures. The Starling Wiki already contains an extensive tutorial that shows you how this works in detail. Find it here!
If you want to see the feature in action, I recommend you try out the new mobile version of Starling’s demo project. If you’re on a Mac, you can use the transporter chief to deploy the app to your iOS device; the chief is now part of the Starling download.
That’s not all: Starling now contains a “Scaffold” project you can use as the basis for your mobile games. It contains all the boiler-plate code you need and will get you started in no time.
Blend Modes
One of the most frequently requested features in the Starling Forum has been the inclusion of Flash’s blending modes. What should I say: we heard you! You can now choose between six default blend modes or even create your own. They can be applied to any display object.
A nice side effect of this feature: you can now dynamically erase content from a Render Texture. Just set the shape you want to clear to BlendMode “ERASE” and draw it on the texture. (The updated demo shows you how this works.)
iPad Performance Boost
Another topic that popped up regularly in the forum is that the performance on the first iPad generation was, well … quite disappointing, to say the least (not only with Starling, but with Stage3D in general).
Adobe heard those complaints, too, and analyzed what was happening on that hardware. And indeed, they were able to pin down the reason for the performance problems! It turned out to be a limitation of the way the iPad’s GPU processes fragment shaders. With that knowledge, we could change the Starling code to work around this issue – which brought a massive performance improvement (the Starling benchmark jumped from mere 120 to over 600 objects)! It turned out that this limitation is shared by several Android phones, as well, which means that many devices profit from that implementation change.
What do you have to do to activate this performance upgrade? Well, nothing, except updating to Starling 1.1!
Statistics Display
There’s another small addition that is worth being mentioned. Starling now contains a built-in statistics display, currently showing FPS and memory consumption. You can activate it with the following code:
To see it live, just hit the space bar in the Starling demo.
A side effect of this addition is that Starling now contains a built-in Bitmap Font, perfect for debug output or prototyping. It is based on the Miniml font “Uni05” by Craig Kroeger and fits into an amazing 128x64 pixel texture. It doesn’t get any smaller than that! To use it, just set any TextField font to “BitmapFont.MINI”.
More stuff inside!
This is just the tip of the iceberg, of course. As always, you can find the complete changelog on GitHub. The update contains many small optimizations and fixes several bugs that were reported in the forum.
Have fun with the latest Starling, and don’t forget to tell us about your experiences by adding a comment below!