Tom Krcha's FlashRealtime

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


Circ – 60 fps gravity based game for iOS, Android and PlayBook

July 11th, 2011

Circ is a nice example of an AIR game that runs very smoothly at 60 fps on most devices including iPhone 4, iPad 1, iPad 2, Galaxy Tab 10.1, HTC Desire HD, BlackBerry PlayBook and so on.



I did a quick performance test on various devices thanks to special builds provided by the authors, check it out:



Official game trailer:

Get the game:
- Circ at Apple App Store
- Circ at Android Market
- Circ at BlackBerry App World


The game was built by several guys in Prague, but mainly Vojtěch Havlíček (lead developer) and Anh Vu Hoang (lead designer). The guys told me that by launching the Circ they wanted to celebrate the recent Atlantis space shuttle launch, so I’ve asked them a couple more questions:


Me: What is Circ?

Vojtěch: Circ is a casual game for mobile platforms. We tried to create a dead simple game,
extremely easy to play, but still exciting.

The simplified main concept of the game is that you (rocket) circle around the planets, that constantly scroll down. By taping the screen, you can leave the planet and land on another. The trajectory of rocket is influenced by ‘force’ interaction of planets on you. You must avoid leaving the game area from top or bottom and score the best.

The whole game can be controled only by a thumb (on reasonably sized devices, of course) so this allows you to explore the game concept deeper and work on mastering the game even on your way to work, or school.

Me: Where does the original idea come from?

Vojtěch: The main idea behind the scene was to create a physical simulation of system of interacting particles just for fun. The simulation itself ended as so good eyecandy that I decided to combine it with game concept of one of my older games.

How did the design of the game evolve?

Vojtěch: At first, the game was very simple – as for the features, we tried to focus mainly on ‘force’ interaction between planets and player, which appeared to make the game very relaxing, without any need for extra bonuses, etc.

However, some of these features were also added later, as the game became more a ‘game’ than just a simulation. The very original ‘swipe-to-save-yourself’ feature has also been added at this stage. We had a bunch of ideas how to improve the feature base, but rather decided to freeze them at that point and have focused on publishing.

Me: Do you use DisplayList (Sprites) or Blitting and which rendering mode?

Vojtěch: We use DisplayList rather then Blitting in this case, rendering on gpu.

Me: How did you solve the challenge of multiple resolutions?

Vojtěch: The game package includes 4 variations of graphics of sprites and more than 10 various scales of background.

The device type is set in the begining and the whole game is created on basis of this. So in fact we have 13 scale and graphics settings for 13 different devices in one. By setting stage.scaleMode to NO_SCALE and stage.stageAlign to TOP_LEFT, we can decide during the runtime, which device settings to choose and rescale the application.

Me: What optimizations have you done to get 60 fps and what do you recommend?

Vojtěch: My advice is to be ecological – recycle and reuse.
I used pooling optimizations together with reference based data structures like linked lists instead of arrays/vectors.
This allowed me to gain from extremely fast splice operations, which are really common in game loop procedure.

It is also very important to avoid unexpected garbage-collecting during the loop phase of the application.
So try to keep the amount of created objects constant during the loop.

Me: Do you have any plans for the future development of the game?

Vojtěch: Yes, we do. As we mainly focused on optimizations for the devices, we intent to improve the gameplay a with a lot of new game features in upcoming update;

Compiling big Flash/AIR projects with lot of SWFs for iOS

June 13th, 2011

This is a nice little trick that can solve you lot of issues.

When you are building a game for Android or Blackberry Tablet OS in Adobe AIR, you are allowed to load the SWF files on the fly – that’s because the code is interpreted from ActionScript bytecode. With AIR for iOS, there is no such option, all code must compiled into single IPA file (from ActionScript bytecode to native bytecode), which you can make out of one SWF only.

Now – what if I have a project with 30 or 40 levels, where every single level is a single SWF? How do I compile this to iOS?

Well, for testing purposes, you can just use ipa-test-interpreter switch in compiler settings and it will run the same way like on the Android or the BlackBerry Tablet OS. But this method is not allowed by Apple, so you won’t be able to submit the app to the App Store.

Solution = SWC

The proper solution is to compile all levels to SWC libraries, which you link to final SWF file. That way you can make single SWF file with all the necessary levels compiled in it.

In Flash Builder, you have to transform your project from ActionScript project (output SWF) to Flex Library Project (output SWC).
Flex Library Projects creates SWC

In Flash Pro CS5.5, there is this option in Publish settings

Publish settings SWC library instead of SWF

And also last few notes:
- you can use AS3-only projects for AIR, you can’t get AS2 game to iOS with AIR for iOS
- you can load SWF files even on iOS, but the code inside them won’t be interpreted – so it’s useful for graphical assets like animations or vector graphics – you can have a library full of symbols and just pick a symbol that you want

Videotutorial: Controlling the desktop with your mobile device via P2P

June 1st, 2011

Last year I wrote two tutorials connected with local network connections via P2P:
MAX Racer Remote Device Controller in AIR for Android
and
Local Flash Peer-to-Peer Communication over LAN (without Cirrus/Stratus)

Right now you can watch the video tutorial showing how to do this:

Note that such application can run on iOS, BlackBerry Tablet OS and Android.

3D car with a camera that follows it

May 16th, 2011

Ever wondered how to build a simple 3D car movement with camera that follows the car?
Let’s have a look at this tutorial, which uses Alternativa 3D 8 (Molehill).

Download Alternativa 3D 8.

This tutorial consist of these parts:
- move the car with keyboard controls
- follow the car with the camera

The final app will look like this:

(*requires Flash Player with Molehill)

Read the rest of this entry »

Videotutorial: Beginning with Alternativa 3D

May 10th, 2011

If you are beginning with 3D in Flash, this videotutorial might come handy. Enjoy!

Alternativa 3D is one the popular 3D engines for Flash.

Alternativa 3D Platform Engine and Flash

Also if you are looking for the text version of this tutorial – check First steps with 3D in Flash article.

What Creative Suite 5.5 brings to game developers

April 13th, 2011

Building games for mobile devices with various operating systems is one of the biggest challenges for developers. Creative Suite 5.5 makes it easier and allows you to deploy games that run across Android, BlackBerry Tablet OS, and iOS. You can also test your game with different resolutions and DPIs using device profiles in Flash Builder. In Flash Pro, you can rescale content to any screen-size just by ticking one checkbox and so on…

As a game developer CS5.5 brings to you are not only new export options, but also tooling that is tied to mobile publishing and helps you to do things faster.

Let’s have a look at what CS5.5 brings you and how it makes your life easier.

Deploy to web, desktop and mobile
Mobile porting has never been easier. Choose among iOS, Android and BlackBerry Tablet OS or all of them.

Export as Bitmap for better performance
Next to Cache as Bitmap is an option to convert your vector artwork directly to bitmap format right in Flash CS5.5 IDE during export. The good thing is, that you still work with the artwork as with vector, but once you export the SWF, it’s converted to bitmap. Tweening bitmaps is less CPU demanding than vectors and your app will perform better. Unlike Cache as Bitmap, you can rotate and scale the artwork during runtime without having it re-cached – so that’s why Export as Bitmap might work better you. Cache as Bitmap is good choice, but only if you change positions – if you start rotating and scaling – it will re-cache every change. Although this can be solved with cacheAsBitmapMatrix on mobile platforms, Export as Bitmap is another very useful option to consider.

Sharing assets across FLA files
Once you create a new Flash project, you can share Library assets between different FLA files. This makes life easier, especially when you are porting your game to different screen-sizes and devices. While you link libraries together, you can change a symbol in one of the libraries and it will automatically update it in other FLA files.

In the image below I have edited the star in only one of the libraries and it’s been automatically updated in the second one.

Scale content with stage
While porting your game to different screen-sizes, this feature might come very handy. When changing the stage width and height, you can tick “Scale content with stage”, which will resize the content to fit the different stage size.

Copy/paste assets from Illustrator to Flash
I like this one, it makes my workflow faster. Although it’s a feature from CS5, it’s still good to be reminded of it. As you can see, shapes and gradients done in Illustrator are represented natively in Flash.

On-device USB debugging
Helps you to test and debug your app right on the real device. Access multitouch, accelerometer and other device specific features you are implementing in your app.

Device profiles
There are many device profiles ready for you. If there is a new device on the market, just add it by yourself or update the list.

There are many more features you’ll find useful and I hope you will enjoy building games with CS5.5.

Have a look at Lee Brimelow’s video tutorial showing new Flash CS5.5 features.

Check these links for further information about the tooling:
Flash Professional CS 5.5
Flash Builder 4.5

Visit Adobe Game Technology Center for tutorials.

Finally, look at this mobile and tablet game running on iPad, XOOM, iPhone, HTC and more built with Creative Suite 5.5 and AIR 2.6:

Stream live to iPad and HTML5 with Flash Media Server

April 12th, 2011

Adobe has just previewed at NAB in Las Vegas a streaming technology that allows HTTP Live Streaming (HLS) via MPEG2 in addition to Flash streaming.

Reach next to Flash enabled devices also iPad and other HTML5 browsers (with HLS support, such as Safari) with Flash Media Server.

Have a look at this sneak peek video, where Kevin Towes shows these features

More details are available here

FITC Amsterdam Interview About Gaming

April 11th, 2011

Mr. Chris Allen and me featured in this video interview from FITC Amsterdam 2011.