Tom Krcha's FlashRealtime

Hey amigo!
I am Tom Krcha, Gaming Evangelist at Adobe. These are my notes

Exclusive Interview with Ville Koskela the Lead Flash Programmer of Angry Birds for Facebook

March 12th, 2012

Do you wonder who is the lead Flash programmer behind the Angry Birds for Facebook? Meet Ville Koskela from Rovio, Finland. In this exclusive interview I did with him, he reveals some of the backstage tricks the team at Rovio used.

Me: Hi Ville, that’s pretty amazing to see Angry Birds on Facebook with all the new great social features.

Ville: Yes it is! The last few weeks were pretty busy since with a brand as popular as Angry Birds we really had to have the very first version rock solid.

Me: The game is using the new Stage3D APIs in Flash Player 11, which 2D framework did you use for the game?

Ville: We are using Starling framework which provides both Flash display object like interface and pretty good performance.

Me: Did you just use Starling out of the box, or are there certain things that you have adjusted for your use case?

Ville: The performance of the initial version of Starling we started with wasn’t quite as good as we expected but since it’s distributed under simplified BSD license and all the source files are available we were able to optimize it quite a lot. I have been writing about these optimizations in my blog and now most of them are included in the current version of Starling. Daniel has also added few extra tweaks here and there.

Me: What about software rendering? Any tips for developers to get the most out of it?

Ville: Performance data collected from our game shows that with software rendering you can expect tops 1/3 of the frame rate of the hardware rendering. This means that if your game requires high frame rate you probably should drop some graphical details when using software rendering. With the Facebook version of Angry Birds we are now dropping the backmost background layer and adjusting also the rendering quality if the game is running with software rendering.

Me: Do you use separate images for each element or spritesheets? Why?

Ville: We are using our own implementation of sprite sheets and we combine as many sprites on the same sheet as the 2048×2048 pixel texture size limitation allows. This speeds up the Stage3D rendering since then the Starling sprites sharing the same base texture can be rendered as batches.

Ari (Senior Flash Programmer at Rovio) and me at Rovio HQ

Ari (Senior Flash Programmer at Rovio) and me at Rovio HQ

Me: Do you overlay DisplayList elements over the Stage3D or is the whole game just Stage3D? If so, what do you overlay?

Ville: Only the game world itself uses Stage3D graphics. We decided to do all the UI elements with conventional Flash display objects since animating them is really easy using the Flash IDE our graphic designers are familiar with. Flash 11 also handles the display object overlays pretty well and they don’t really affect the frame rate.

Me: How do you handle the device loss (with Stage3D)? That means if someone plays the game and goes for a lunch and the PC locks the screen?

Ville: We implemented our own handler for this event since Starling didn’t support it out of the box. When the rendering device is lost Context3D’s driverInfo string will change into “Disposed” so on every frame update we check that. If the device is lost we simply return from the rendering immediately. When Flash is able to create a new rendering context an Event.CONTEXT3D_CREATE event will be dispatched. We simply register to listening to that event and then reinitialize all the current textures and their vertex and index buffers on the next render call. Luckily the upcoming Starling version will also handle the device loss so developers won’t need to implement this check themselves anymore.

Me: Can you tell us something about the particle engine you use with Starling?

Ville: We are using a tuned up version of the Starling particle engine extension. At the moment it’s used for the wave animations in the “Suft and Turf” episode. The particle engine itself is a combination of actionscript code and GPU based Stage3D rendering.

Me: Which physics engine do you use? Are you using default setup or any some special settings?

Ville: Like with all the other versions of Angry Birds the Facebook version also uses Box2D with some minor adjustments.

Angry Birds on Facebook

Me: Do you secure the final SWF with any sort of obfuscation software?

Ville: Yes we do. :)

Me: Was there something specific to Facebook that you had to take into account when developing the game?

Ville: Well first of all with Flash 11 and Stage3D you have to use wmode “direct” which means that on some browsers the html overlays will get rendered under the Flash content. To handle this Facebook provides javascript API with which we replace the Flash content with a screen capture of it on the web page. We also wanted to make the initial game download as fast as possible to make sure that users won’t close the game before it’s running. This we achieved by downloading additional game assets on the fly for the levels only when needed.

Me: What’s your overall feeling about Angry Birds Facebook? Are there any plans for new features in the game?

Ville: I think the project was a great success and the support we got both from Adobe and Facebook helped us achieve this. Even the initial release didn’t have too many bugs visible to the end users and even those are now mostly fixed. About the future I can’t really say anything else than keep returning to the game at least once or twice a week to check if there’s something new. :)

Facebook comments:


  1. The game is really great !

    “[...]To handle this Facebook provides javascript API with which we replace the Flash content with a screen capture of it on the web page.”


    Comment by YopSolo — March 12, 2012 @ 11:38 pm

  2. really great ! Love it.

    Comment by activetofocus — March 13, 2012 @ 6:49 am

  3. Thanks for interesting interview with many technical details

    Comment by Hyzhak — March 14, 2012 @ 1:02 pm

  4. How are you getting Box2D, which uses Alchemy, to work on Flash Player 11.2 if you’re also using Stage3D? It’s not supposed to support Alchemy opcodes if you target Flash Player 11.

    Comment by BoxMan — March 15, 2012 @ 8:43 pm

  5. @BoxMan: Using Box2D with Starling is easy. It doesn’t use Alchemy…

    Comment by Andrew — March 21, 2012 @ 1:59 am

  6. I am starting a new gaming startup and I need to know Flash or HTML 5. With Internet Explorer supporting HTML 5 in the future, is it still worth my time?…

    A few good points I capture from your reply and let me try to advance this a bit: HTML5 vs monetizing. I don’t see these two connected at all. Rovio’s choice of implementation, has had more complex reasoning behind, IMO. The Chrome version was target…

    Trackback by Quora — April 18, 2012 @ 7:50 pm

  7. Right. The standard Box2D implementation used in Flash is pure AS3, ported from the original.

    Comment by Ben — April 18, 2012 @ 11:51 pm

RSS feed for comments on this post. / TrackBack URL

Leave a comment

Comment moderation is enabled. Your comment may take some time to appear.