Starling Framework Released
Wednesday, September 21, 2011 at 9:19PM Today Starling was released. It's a new open source Flash framework for running 2D content on the GPU. It's Adobe supported and tries to mimic Flash's native display list. It's great news for game developers for whom it is obviously geared towards.
I've recently being doing some work with ND2D which is a similar framework so I decided to write a few tests to compare performance. They all run an animation on 2000 sprites. You will need Flash Player 11 installed to run these.
- Native Flash - CPU - Bitmap Blitting - 60 fps
- ND2D framework - GPU - Batch Sprite Cloud - 60 fps
- Starling framework - GPU - MovieClip - 15 fps
On my computer I get the above framerates which suprised me a bit. Starlight seems to be quite a bit slower. I tried everything to speed it up including disabling error checking, anti aliasing and image smoothing. Here is the source.
The interesting thing about Starling is that it tries to mimic the native display list as much as possible. It contains its own version of native classes such as Sprite, DisplayObject, Stage, TextField, and even Event and EventDispatcher, all with the same name. This makes working with it slightly difficult as you always have to be sure that you're importing the right class and it gets even harder when dealing with the custom event bubbling infrastructure that doesn't support native events.
Looking at this, a reasonable question to ask is why doesn't Adobe work into building this right into the runtime where all native display objects are running on the GPU instead of making people use an external framework that uses the same API anyway. It could be the case that Adobe is already working on this. They see all these 2D frameworks based off Stage3D popping up with varying API's and decide that they'll release one that behaves very much like the display list - one that developers will get behind so that when the functionality arrives in the native run time the effort required for developers to transition will be minimal. Adobe has already made advances to leveraging the GPU in Flash Player 10 with wmode=gpu that composits on the GPU and rendermode=gpu for mobile that renders vectors on the GPU. Doing this automatically across the whole display list though is very difficult.
I think a less interesting but much more likely reason for the similar architecture is simply that that is how Sparrow is architected, which Starling is a port of. Sparrow was inspired by Flash so when it gets ported back to Flash the similarities become obvious. In Sparrow however class names are prepended with SP, why is it different here?
Yonas
The developer says that similar objects do not currently share geometry which would speed things up a lot in this use case but that that feature is possibly coming in a new release
flash
Reader Comments (6)
Hi Yonas,
Thanks for putting together these tests! Yes there is a known issue with Starling right now where similar clips don't share the same geometry. That's at least the way I understand it. Stay tuned!
Lee
Hi there,
Yes, that is an expected question. The reason is the following : http://blog.kaourantin.net/?p=138
Concerning the performance for this use case, this is funny cause this the exact use case we discussed with Daniel, Starling could reuse the same vertex/index buffer instead of creating multiple ones if objects are the same and improve the performance.
This is something that could be added, you can put a request on the Starling forum : http://forum.starling-framework.org/
Thibault
Hi Yonas,
thanks for taking the time to write those tests! It's good to see that the little bird is tested extensively - even if I don't like the results, of course! ;-)
As Thibault has mentioned, this is a known issue. When you've got a lot of identical geometry, it's possible to speed things up immensely by re-using the same index- and vertex-buffers. Starling does not do this currently, because I considered it more important to optimize more common (non-artificial) scenarios first - but I'll look into this in upcoming releases, of course!
Daniel
Hey Yonas,
thanks for setting up the tests. Quite interesting. Of course I like the result a lot more ;)
But I'm sure that Daniel will get Starling easiliy to the same speed soon!
Cheers,
Lars
The funny thing is that the while the starling tests says that it has lower fps, on my comp the animations runs faster and smoother than the nd2d.
Richard you're right, it seems Starling runs the animations at a slightly faster rate than what it's told to. In all 3 tests the framerate of the soldier's idle animation is set to 12, but Starling seems to display it a bit faster than this and that is what is making it look 'smoother' even though the framerate of the swf is lower