Starling Framework Released
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?
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
I've posted some new tests using the updated Starling 0.9.1