If you’ve overlaid the latest AIR SDK onto Flash Professional CS5.5 then you may have noticed that it’s no longer possible to set your app’s Home screen name from the AIR for iOS Settings panel. Previously the value of the App name field was used to set the application’s screen name.

For example, setting the App name field to My Test App should guarantee that an icon with the same name is shown on the device. You can see this in the screenshot below:

Pre AIR 3.1, the value of the App name field would dictate the app's screen name.

However, after overlaying the latest version of the AIR SDK, the application’s screen name is now incorrectly set to the name of the SWF published from your FLA. The screenshot below highlights this:

The app's screen name is now set to the published SWF's name.

Unfortunately this has been caused by changes in AIR 3.1, meaning you’ll need to manually edit your FLA’s application descriptor file in order to correctly set the app’s screen name.

The application descriptor file is an XML file that shares the same name as your FLA appended with -app.xml. For example, an FLA named test-app.fla will have an application descriptor file named test-app-app.xml sitting in the same folder. You can edit an application descriptor file from Flash Professional or from a text editor such as Notepad.

There are two possible changes you can make to the descriptor file to set your app’s screen name.

The first is possibly the most straightforward and involves changing the value of the <filename> tag:

<filename>My Test App</filename>

The second approach is to localise the <name> tag for multiple languages. For example, change its value from:

<name>My Test App</name>

to:

<name>
   <text xml:lang="en">My Test App</text>
</name>

More detail regarding localisation of application names can be found in this Adobe AIR article.

Also, remember to save the changes to your application descriptor file before opening the AIR for iOS Settings panel again.

24
Jan

O’Reilly recently released three new Flash related e-books, and the brilliant news is that they’re all available for free. First up there’s What’s New in Adobe AIR 3 and What’s New in Flash Player 11, both of which are by Joseph Labrecque, who is also the author of the excellent Flash Development for Android Cookbook. The third book, Introducing Starling by Thimbault Imbert, is for all those interested in taking advantage of Flash’s Stage3D APIs to create hardware accelerated 2D graphics.

Joseph Labrecque’s titles do an excellent job of detailing the new features present in Flash Player 11 and AIR 3. Both books cover the recent graphics and video additions, including the API improvements, new external image capabilities and, of course, a discussion of hardware accelerated graphics rendering using Stage3D. Although Stage3D is clearly not the focus of either book, some time is spent providing code examples of it being used in conjunction with the high-level Away3D and Starling third-party libraries.

Two other extremely welcome additions to the Flash platform are H.264 video and native JSON support, both of which are also covered. There’s also plenty for mobile developers, with native text, hardware accelerated video, camera, speaker and encrypted local storage all featuring. Considering it’s not always easy to discover what’s new with each new major release, both “What’s New” titles should be considered essential reading.

As for Introducing Starling; given it’s depth, it’s ridiculous to think that Thibault Imbert’s offering is actually free of charge. A port of the popular iOS Sparrow library, Starling is an ActionScript 3 2D framework that has been developed on top of Adobe’s Stage3D APIs in order to provide lightning fast GPU-accelerated games and applications. The book covers everything you need to know in order to get up and running, gently introducing the reader to the many important concepts, the distinctions between Starling and Flash’s traditional display list, and also the similarities between the two.

By the end of the book you’ll be comfortable working with sprite sheets, be able to programatically create bitmap-based animations, and have a firm grasp of Starling’s event model. There’s also an introduction to particles, and some space dedicated to the integration of Box2D, and Robotlegs. I managed to spend some considerable time with this book when learning the Starling framework and it really was an invaluable resource. If you’re developing for iOS and Android then this will be vital reading when Stage3D rolls out across these platforms.

So there you have it. Three excellent books and all available free of charge! I’m not entirely sure where Thibault Imbert and Joseph Labrecque find the time and energy, but I’m grateful they do. There’s really no excuse for not popping over to the O’Reilly site and downloading these three gems.

22
Jan
stored in: General and tagged: , , , ,

In my last post I recapped what I’d been up to last year, so I guess it’s only fair to go over my plans for the next twelve months. After all, the reason I started this blog was to force myself to learn new things and to share my findings. Hopefully by posting this it’ll force me to commit to at least some of them. I don’t think I’ll realistically find the time to do them all and my plans may change as the year unfolds but here goes anyway.

My Reading List

I really didn’t have that much time last year and ended up with a pile of books that I’m now looking forward to reading. I won’t list them all but hopefully I’ll find the time for the following three:

Adobe Flash 11 Stage3D (Molehill) Game Programming
HTML5 Canvas Cookbook
Learning HTML5 Game Programming

I also have Canvas Pocket Reference and jQuery Pocket Reference, which I’ll dip in and out of rather than reading from cover to cover.

Two books I did manage to get through were JavaScript: The Good Parts by Douglas Crockford, and Joseph Labrecque’s Flash Development for Android Cookbook. Both of which I highly recommend. I’m also partly through Unreal Development Kit 3 Beginner’s Guide, which I’m looking forward to finishing, but first I need to get through The Han Solo Adventures for Dave T at work – he gave me a loan of it like two years ago.

There are also a few other Flash books from O’Reilly, which I’m going to talk about in another post. That way I’ll be able to give them the attention they deserve.

HTML5

I know what you’re thinking, there sure is a lot of HTML5 reading on that list. Well for some time now I’ve been wanting to spend more time with JavaScript and all those other fancy gubbins that go with it. As I said in my previous post, I’ve already ported my Android Speedometer app to HTML5 and I think I’ll do the same with a few other things I’ve written over the years. I might take a look at PhoneGap too, and I also ran through a few Adobe Edge tutorials and will probably keep an eye on its progress.

3D or Not 3D

You’ve no doubt noticed that Stage 3D is top of my list (excluding ‘The Han Solo Adventures’). I’ve been threatening to get into 3D games programming for years but never seem to find the time. Fingers crossed this will be my year. I’m not restricting myself to Flash either. I’ve spent some time with Unreal Development Kit and hope to carry on with that too, as well as taking a look at WegGL – there’s a really great community building up around three.js and some of the demos I’ve seen have been really fantastic.

AIR for iOS

I’m looking forward to seeing how things unfold with AIR for iOS this year. Fingers crossed that Stage 3D and Starling do the business on mobile. Both have amazing potential but Adobe really need to get these things right first time. And while I’m on the subject, it would be nice to see some more iOS and Android specific APIs from Adobe.

Hopefully I’ll find the time to look more at Stage 3D, and AIR for iOS in general, and write some more tutorials. I’ll also be supporting my book throughout the year with tutorials and links to relevant URLs.

Phew! That’s a Lot!

Yeah, reading all this back has made me realise how ambitious this all sounds :-) Well let’s see what I manage to get through. Maybe I’ll make it a two year plan rather than one.

19
Jan
stored in: Flash and tagged: , , , , ,

I’ve probably worked harder over the last 12 months than I’ve ever done before, and that’s including my two year stint in the games industry. In fact, I’m not entirely sure where I’ve managed to find the time to update this blog at all, but I’m glad I have. And although some amazing opportunities have come my way, I can’t help but feel a tad deflated by many of the things that have happened to the Flash platform in that time. I’m not gonna dwell too much on the negatives though. On the whole it’s been a fantastic year for me personally, and I’ve got many exciting projects I’d like to undertake this year.

I’ll talk about my plans for 2012 in another post, but for now here’s a recap of what I managed in 2011:

Flash iOS Apps Cookbook

I’m excited to say that my book, Flash iOS Apps Cookbook, went off to the printers last week and will soon be available. It’s been quite an amazing experience and an opportunity I never thought I’d be given. The book’s been 13 months in the making and focuses on iOS development using Flash Professional CS5 & CS5.5.

In an attempt to make it as accessible to as many newcomers as possible I spent considerable time covering Apple’s dreaded provisioning process and explaining the fundamental steps for setting-up Flash to publish native iOS applications. By the end of the third chapter you’ll have made your first app and have it running on your iPhone. For those already familiar with these steps, there’s plenty on offer, including hardware accelerated rendering, utilizing native iOS text controls, and working with H.264 video. There’s also a whole chapter dedicated to tips and tricks for optimizing and converting desktop projects to mobile.

I’ll cover my book in more detail soon and plan to post frequently to support it over the coming twelve months.

WeeWorld

I’ve enjoyed a very good year at work too. I was lucky enough to work on some exciting things, including a complete re-write of our WeeMee Avatar Builder, which is something I’ve been itching to do for almost five years now. The old version was bursting at the seams as it had to pre-load every single asset, which given our growing catalogue, was causing some pretty bad load times. That’s all resolved now, and thanks to the new architecture, everything loads in a jiffy. Yay!

Although we have a dedicated department of Objective-C programmers beavering away on cool iPhone games, we took the opportunity to try porting one of our web games to iPad using Flash. To be honest, so many negative things have been said about Flash’s performance on mobile that I don’t think anyone actually expected me to pull it off. However, after chipping away at it over the space of a fortnight, Doppelganger for iPad was born. Flash’s vector renderer really did prove to be invaluable for this project and the outcome was a game that ran silky smooth on both iPad 1 and 2.

I also documented many of the performance optimizations for those who are interested.

Starling

Bitmap graphics and sprite sheets are in. While it might seem like a backwards step for many used to Flash’s traditional display list and vector tools, there’s no denying that pushing textures to the GPU can produce some terrific results. Although writing my book left me with almost no spare time, I did manage to spend a week or so experimenting with the Starling framework. It was a lot of fun, particularly messing around with particles, and is something I hope to return to this year. I’m praying that Adobe’s Stage 3D support for iOS hits the mark and that Starling gets to a position where it’s optimized for mobile. In fact, Adobe really need to make sure this happens.

HTML5

I’ve been desperate to spend some time with HTML5 but again, finding the time has been difficult. I did manage to conjure up five days near the end of November to write my first mobile app using JavaScript and was decently impressed with the results. It was a port of a speedometer application I wrote for Android a while back. It still needs some tweaks in places before I blog some more about it. Also I’m not sure if this blog is the appropriate place for it. Let me know your thoughts and if there’s enough demand I’ll keep you guys updated on its progress.

My X-wing Targeting Computer App

I swear this one could have made me rich. After years of trying, I finally come up with a good idea for a mobile app, only for George bloody Lucas of all people to put a stop to it. Typical. Well to be honest, it wasn’t George himself, but his licensing department.

Anyway, after trying to get permission to release my X-wing Targeting Computer app, I finally had to admit defeat and shelve the project. I’d originally tried some games companies with little luck before being given contact details for Lucas Licensing. Unfortunately they weren’t interested, leaving me with no option but to finish pursuing it. It was all a bit of a shame because the response regarding the app was so overwhelmingly positive that I was convinced I’d have no trouble getting it released.

Nevertheless, it was a great little project to work on and being famous on the web for 5 minutes was a lot of fun.

Adobe Dropping Flash Player for Mobile

If Adobe’s intentions were to drive as many people away from the Flash platform as possible then their decision to drop Flash player for mobile was a raging success. In fact, they’ve probably done a better job of it than Apple ever managed to do. To be honest, with Flash player indefinitely banned from iOS, it’s hard to argue against their decision. However, the way they communicated things was simply disastrous and has left a bitter taste with many Flash developers (or should that be ex-Flash developers).

While Flash player’s use on mobile phones was limited, I always thought it had promise on tablets. Some of the more recent tablets were managing some good playback performance and I felt things were heading in the right direction. Unfortunately, while the hardware will definitely be there in a year or two, HTML5′s rise to domination has meant that Adobe (and Flash mobile Player) have simply run out of time.

Unreal Engine

Finally, I took my first steps into the world of 3D graphics. I had been planning on spending some time with one of the many 3D engines built on top of Stage 3D, but my brother recommended I look at Unreal Development Kit (UDK) instead. I thought it was an odd suggestion at first but it has helped me to get to grips with many 3D concepts without getting bogged down in code – you can quite easily build 3D worlds entirely with drag and drop. Plus my brother has two years professional experience with Unreal Engine, making him a great help when I get stuck.

It’s early days for me, and I had to stop sooner than I’d like due to my book commitments, but I’m looking forward to picking up where I left off. I’m also quite excited about the Flash export options that will be making their way into UDK at some point.

Native iOS and Android Apps

We saw some nice apps released on mobile. A few of the stand-out ones included
Age of Defenders, Machinarium, Red Bull Illume HD, Rossignol Experience, and Tweet Hunt. It’ll be interesting to see what’s possible when Stage 3D eventually makes it to AIR for iOS and Android.

It’s Been a Good Year

So all in all, I’m happy with my achievements and feel that I’ve had a very successful and enjoyable year. Hopefully the next twelve months will be just as busy, and I promise I’ll try and update my blog more frequently.

20
Dec
stored in: General and tagged:

This little trinket has been in my family for as long as I have. As a kid I used to love winding it up and listening to it playing Silent Night as I sat by the Christmas tree. It always felt like a magical time.

As you can tell, the years haven’t been kind to it. The little angels look like they’ve been to hell and back, and the candles that used to sit on either side of the hymn sheet have long gone. Now it has caught my one year-old nephew’s eye and I fear it won’t survive much longer – another angel lost an arm yesterday.

So I decided to make this post. Not just in an attempt to digitally preserve it but also in hope that you too will feel its Christmas magic.

Have a great Christmas and New Year everyone!

I finally got round to updating my AIR Overlay tutorial for those who would like to take advantage of the AIR 3.1 SDK from Flash Professional CS5.5.

Check it out and let me know if you find it useful: Overlaying AIR 3.1 SDK for Flash Professional CS5.5.

With all the excitement over Unreal Engine 3′s upcoming support for Flash Player 11, I thought I’d spend some time looking at the Unreal Development Kit (UDK). After all, it would be pretty sweet to be able to bash out an Unreal-powered game that could be delivered via the browser.

Believe it or not, but this was done by myself and not a team from Epic Games.

Given its depth, UDK is surprisingly easy to work with. After only a week of tinkering I’ve already managed to create my first 3D level complete with crazed bots hell-bent on killing me. Take a look at the screen shots if you don’t believe me!

That's right, I can do underwater too! I know, I rock!

I’ll keep you dudes posted on my progress. Anyway, I guess I better get back to work on Gears of War 4. It’s not gonna code itself you know.

One of the perks of writing a book is that my publisher is always happy to send along titles that they think might interest me. So I was delighted when these three books landed on my doorstep recently.

The good news is that you don’t actually need to be writing a book or be a member of some secret cult to get your hands on some free stuff. The kind folk at Packt Publishing are always on the lookout for individuals who’d like to read some of their latest publications and give their honest opinion via their blog, Amazon, Slashdot etc.

They just recently released the following three titles:

So if you think you’re up to the task and can turn-around a review within a week or so, then send me an email or catch me on Twitter and I’ll put you in touch with one of my secret contacts at Packt.

05
Dec

I thought I’d follow-up my original post about Doppelgänger, and take some time to detail its implementation from a rendering perspective. There’s a lot that can be done to ensure your AIR for iOS apps hit their target frame rate, but these optimizations aren’t always obvious. I’ll also mention a few common pitfalls that leave many Flash developers scratching their head.

I hope you find the following useful for your own projects.

Test on the lowest common denominator

Test frequently on a physical device and use the lowest common denominator. For example, if you’re targeting both iPad’s then get your hands on an iPad 1. Don’t exclusively test on the iPad 2 and assume everything will be fine and dandy for those using previous generation hardware. You’ll be asking for trouble if you do.

Profile your app using Instruments

I know Flash Professional and ADT allow you to develop iOS apps using a PC, but if you’re at all serious then you really should get yourself a Mac. Why? Well you’ll be able to install the Instruments application, which allows you to analyse the performance of your app as it runs on a device.

Profiling tools are essential. Profile and optimize as you go.

Instruments was invaluable during the development of Doppelgänger. It allowed me to examine the app’s memory consumption, CPU usage and frame rate, making it very easy to spot areas in my code that were causing CPU spikes very early in the development process. My personal goal was to keep CPU usage at around 20%. It was easy to spot any spikes above this and quickly address these by optimizing either my code or graphics.

Don’t ignore spikes in CPU usage. Endeavour to fix all bottlenecks as early as possible.

Focus on rendering bottlenecks from the outset

Graphics rendering is often the single biggest bottleneck when porting Flash apps to iOS. Be prepared to flatten your display lists, simplify complex vector shapes, reduce the number of layers, and use bitmaps where appropriate. Also, perform incremental tests of your graphics assets and use Instruments to measure performance.

The original FLA for Doppelgänger was quite bloated. There was an insane amount of vector detail in many of the assets and an unnecessarily deep display list. I converted much of what was there to bitmaps to maximize render performance. I also tested many of the graphics assets in isolation by simply publishing individual test apps and profiling with Instruments. Once happy with the performance I’d layer more animations together and test again. This allowed me to quickly find any graphical assets that were going to hurt performance.

GPU rendering

AIR for iOS provides two choices of rendering engine – CPU mode and GPU mode. The CPU renderer is the same software renderer used by the desktop Flash Player. However, on iOS devices we can instruct Flash to offload much of this work to the GPU, which when used correctly, can accelerate rendering. Doppelgänger took advantage of GPU rendering to help maximise its frame rate.

Bitmap caching is your friend

When a display object changes in any way, or intersects the bounding area of some other display object that has changed, then it will need to be redrawn. Unfortunately redrawing complex vector shapes, text, or clips containing deeply nested display lists can be expensive.

Thankfully help is at hand in the form of bitmap caching. Put simply, bitmap caching stores a bitmap representation of a display object and uses the bitmap version whenever the object needs to be re-drawn. In many situations, drawing the bitmap representation to the screen is typically much faster than redrawing the original. Bitmap caching is particularly useful for objects that have translation (movement along the x- or y-axis) or transformation (scaling or rotation) applied to them.

Doppelgänger makes heavy use of bitmap caching to minimise the render time of each frame.

Bitmap caching is your enemy

Hold on! Didn’t I just say that Bitmap Caching was good? Yes I did. But only if it’s used correctly.

Many developers seem to think that activating GPU rendering and bitmap caching everything, will somehow guarantee a blindingly fast frame rate. This couldn’t be further from the truth. Misuse of bitmap caching will cripple your application. Even if you fully understand the ins-and-outs of bitmap caching, it’s all too easy to make a simple mistake that can undo much of your previous optimizations.

To benefit from bitmap caching you need to ensure that the cached bitmap does not frequently become invalidated. If invalid, the bitmap will need to be recreated by rendering its source display object and copying a bitmap representation to an off-screen buffer. To prevent this, don’t cache movie clips that contain timeline animations or container clips that have children that move relative to it.

I must admit that I slipped up here. Some of my initial tests on Doppelgänger performed poorly on iPad 1. I eventually tracked it down to the shutters that open and close between levels. I’d accidentally cached the container, which held both halves of the shutter. Essentially, as they opened and closed, every frame of animation was invalidating the cached version and forcing a re-cache. With the shutters consuming almost twice the height of the screen when fully open, re-caching was killing performance. This was fixed by simply caching each of the shutters’ child clips rather than the container.

To see the shutters in action, take a look at the gameplay video of Doppelgänger.

Bitmaps Vs. Vectors

Use bitmaps or vectors based on their strengths. It’s easy to get into the mindset of using bitmaps for everything because they tend to render faster. However bitmaps can consume significantly more memory and can quickly exhaust GPU memory when GPU Rendering is being used.


Content with a large bounding box and/or many animation frames might be better as vectors.

Doppelgänger uses a combination of both vector and bitmap assets. The timer’s ticking clock, for example, is a vector timeline animation. With a bounding area of 173×161 pixels and running for 90 frames, a series of bitmaps would simply have been too expensive (almost 10Mb of uncompressed data). The same was also true of the tick and cross animations, which both cover a fairly large area of the screen come the end of their animation cycles. And of course the WeeMee’s themselves are constructed from vector shapes, helping to reduce the app’s footprint and ensuring the WeeMee’s maintain their image fidelity when scaled.

Swap render quality where appropriate

Consider using a lower render quality setting. Bitmaps are relatively unaffected by this and it really can be hard to spot any differences for vector content that moves.

Doppelgänger constantly switches between low and high rendering quality during the lifetime of each game. This gives a massive performance boost, especially on the iPad 1. The drop in render quality is noticeable on the timer’s clock but I felt it was worth doing in order to maximize the frame rate. Each of the WeeMees are rendered into pixel buffers using the highest render quality setting just before each level begins. The bitmap representations of each WeeMee is then used during the level, which by this point has switched to the lowest render setting.

Conclusion

It can very much feel like smoke and mirrors some times, but it’s the final result that counts. These challenges aren’t specific to Flash and ActionScript either. Targeting mobile requires a little more effort than developing for the desktop. However, with some careful planning and an understanding of the constraints you’re working within, you should be able to make the necessary compromises to ensure a fun and engaging experience.

28
Nov
stored in: Competition and tagged:

It’s always good to learn new things, and to help you do just that, I’m putting three really great books by Packt Publishing up for grabs in my latest competition: Unreal Development Kit 3 Beginner’s Guide by Richard J Moore, Xcode 4 iOS Development Beginner’s Guide by Steven F Daniel, and Android 3.0 Animations Beginner’s Guide by Alex Shaw.

Here’s a little more information about each book.

Xcode 4 iOS Development Beginner’s Guide

  • Learn how to use Xcode 4 to build simple, yet powerful applications with ease.
  • Each chapter builds on what you have learned already.
  • Learn to add audio and video playback to your applications.
  • Plentiful step-by-step examples, images, and diagrams to get you up to speed in no time.
  • A practical guide to building your own fun and exciting iOS applications rapidly using Xcode 4.

Android 3.0 Animations Beginner’s Guide

  • The first and only book dedicated to creating animations for Android apps.
  • Covers all of the commonly used animation techniques for Android 3.0 and lower versions.
  • Create stunning animations to give your Android apps a fun and intuitive user experience.
  • A step-by-step guide for learning animation by building fun example applications and games.

Unreal Development Kit 3 Beginner’s Guide

  • Full of illustrations, diagrams, and tips for creating your first level and game environment.
  • Clear step-by-step instructions and fun practical examples.
  • Master the essentials of level design and environment creation.

So how do you go about winning one of these books? Well the rules are simple:

  1. First, decide which book you’d like then head over to its official page (links are at the top of this post) on the Packt Publishing website.
  2. Read over the book’s details then pop back here and add a comment to this page stating the book you’d like and one feature of it that makes you want to own a copy.
  3. Tweet a link to this page on Twitter. To make your life easier, here’s a tweet I made earlier.

Each winner will receive an eBook version of their chosen title. Feel free to submit an entry for more than one book.

The contest will close on December 4th at 11.59pm GMT. Winners will be contacted by email, so please remember to use your real email address when you add your comment.

Good luck!

The competition is now closed and comments have been disabled. The winners will be contacted.