Speaking at Multi-Mania 2012


It’s awfully long time since my previous post but I’ve been really busy with both the one megabyte “play on wall” version of Angry Birds Facebook and the recruitment of new Flash programmers. My team has now grown with couple of developers but we are still looking for new talented people. Related to this I will be speaking at Multi-Mania 2012 in Kortrijk Belgium 22nd of May. If you happen to be there feel free to come talk with me after my presentation about possible work opportunities at Rovio. The 45 minute presentation itself will be about bringing Angry Birds to Facebook. Topics covered will include reasons for picking Flash 11 and Starling framework for building the game, optimizing the performance and user experience with different kinds of hardware and getting and maintaining the service quality with millions of users. I believe the session should offer something interesting for both developers and designers.

See you at Multi-Mania!

Tuning Starling based games


All the optimizations on your rendering library won’t help your game’s performance unless you use the library properly. I’ll now go through few basic ideas we used with Angry Birds Facebook version to get the most out of the Starling framework.

Texture usage

Now when Starling automatically generates the QuadBatches when rendering images it is important that display objects share the same base texture when ever possible. To achieve this use big base texture and then use subtextures from the main texture for the images. When all your graphics won’t fit one 2048×2048 texture group them smartly so that for example background graphics use the same base texture, game objects use another shared texture etc. Consider writing your own logic for combining smaller bitmaps into a big one for the texture generation so that you can modify these textures for example when moving from one game level into another one. Also note that even if Flash 11 should guarantee 128MB of texture memory it means only 8 of these 2048×2048 textures. On some setups even this might be too much so don’t create textures unless you really need them and when you don’t need some texture any more dispose it.

Display object usage

No matter how active your game’s visuals are all the graphics are probably not moving or changing. If you have these kinds of elements, for example background that contains several sprites and images, place the element’s display objects within one sprite and then flatten the sprite after it’s content is set. You will still be able to move, scale and rotate the background but it will render a lot faster than without flattening. If possible add also some quick checks if the parent display object is within the visible display area or not. Set the visibility of the objects accordingly to speed up the rendering.

Background coloring

The whole Stage3D rendering context needs to be cleared on every frame update no matter how much you render on it. By default Starling uses the initial stage color for the clearing but if your game happens to have a solid color sky, ground or what ever that is drawn behind all the other graphics add a setter for the clearing color and set it to this color you would be using. This way painting the whole canvas with the color is basically a free operation since the clearing has to be done anyway. If you have several of these single color areas use Quads for the smaller ones since they are a lot faster than Images with single color textures.

Detail adjustments

Computers that use software rendering will most likely have problems running your game as smoothly as those that use hardware rendering. Detect if the game is running using software rendering and then drop some details that are not necessary for the game. Consider using lower rendering quality for the graphics and limit the amount of particles if you are using the particle emitter extension.

Overlay graphics

It’s possible to have conventional Flash display objects on top of the Starling’s Stage3D graphics. Using them for example for UI elements might make sense but remember here not to touch the attributes of the display objects if they have not changed. If these sprites are not updated on every frame they should not have too big effect on the frame rate.

That’s all this time. With these simple tricks you should get your Starling based game running smoothly on most of the computers.

Angry Birds Facebook released


It has finally happened. The Facebook version of Angry Birds was released on 14th of February right on the promised schedule. We came a long way from the demo shown in Adobe Max last year on all the fronts. The graphics engine is now starting to be in a shape and performance level I’m happy with and even the special effects promised in Adobe Max are coming really soon. The social features were designed and implemented and the problems related to Facebook dialogs and Flash 11 requiring direct wmode were also solved on most of the browsers.

Everyone in the team worked really hard to get the game out but I want to separetely thank here Stefan Hauk, our Lead Server programmer, for the amazing work in getting the server side of the game done and also Ari Arnbjörnsson, our Senior Flash Programmer, for his contribution on the Flash side and in solving the browser specific problems. Big thanks to the whole team for working long days to get the game out! There are still things to do but the game is already in pretty good shape.

Naming conventions and obfuscation


Just fixed a nasty bug that was caused by the fact that we had added a new XML element and an ActionScript class that had exactly same names. This ifself wouldn’t cause any problems but when the code was run through an obfuscation software the problems started. The part of the code where we were actually referencing to this child element in the XML, not the class with the same name, got also obfuscated and naturally it then didn’t match the XML files read in.

The solution for the problem was as easy as to simply follow common naming conventions – start the names of the classes with upper case letters and the names of XML elements with lower case letters. After converting the names of the new XML elements to start with lower case also the obfuscated code started to work fine again.

Angry Birds coming to Facebook


It’s now official – the Flash 11 version of Angry Birds is coming to Facebook on 14th of February. We’ve been pretty busy with this project and we still are so that’s why I haven’t been writing in my blog but after the launch I’ll try to find time to write a post about the journey.

In the mean time you can join the Facebook event at http://www.facebook.com/angrybirds#!/events/174654275973227/

Happy new year 2012


Happy new year to all the readers of this blog! I’ll try to find time to write a new post at least once a month also this year. The this years topics should also vary a bit more and not always be about Starling framework. You can expect to read more about Angry Birds development, ActionScript and programming in general.