Skip to main content
Inspiring
October 31, 2011
Question

Air for Android performance

  • October 31, 2011
  • 5 replies
  • 6494 views

Hi everyone,

I'm currently working on a game for iOS devices and I've decided to test it on android as well to see the performance difference.

My game works at 50-60 fps on iphone 3GS, almost constant 60 fps on iphone 4 and constant 60 fps on iPad2.

I own a Nexus 1 and from reading in different forums it seems like it should perform almost the same as iphone 3GS.

When I deploy my game to my Nexus using the same code and optimization techniques I used for the iphone (and of course using GPU mode) I get 17 fps at the most. Now I've done some testing and it seems that the game runs on 60 fps when nothing is moving around but when I start to blit one bitmap object it drops to 30fps right away.

Is 30fps the max you can get on devices like the Nexus 1 using Air or is it Air's limit for all android devices?

Thanks,

Oz

This topic has been closed for replies.

5 replies

November 2, 2011

I'm on Android version 2.3.3, it was also working just fine with the version before that.

I just can't believe that stretching one bitmap to fit the stage, even if it's all black, would have such disasterous results on high quality.  The only thing I can think was that the bitmap is kind of big, 800x400.  But even when I turned off the stage scale, it was still horrible.

I hope you can find a solution to this problem soon! 

Inspiring
November 2, 2011

Can you please enter the bug I filed and test the file I've uploaded on your device? it's a very simple test and I'm curious to find out if someone will get a different result.

I've tried to run my game on a Nexus S that runs OS 2.3.4. I was aspecting it to run faster than my Nexus One with OS 2.2 but the result was way way better. I managed to get 56fps when moving one object. Nexus S is newer and faster than Nexus One but it shouldn't be that much faster So I'm really starting to think it's something with the OS version or my device.

If I'll get any new results I'll let you know.

Inspiring
November 2, 2011

Ok more test results:

Testing again Chrisitian Cantrell GPU test, now on a Nexus S device - 60fps when nothing on screen, 56 fps after adding one rotating/scaling box. after abut 25 objects it started to go under 56fps. But that's not my point.. this test is using a red box created using the graphics API and then being cached as a bitmap and also as a bitmap matrix and you think that this shouldd really work best. I decided remove the bitmap and bitmap matrix caching and I actually got a better result, still 56fps after one object but it only started to drop under that after 60-70 objects on stage. And that's not my code. What is going on here?

I tried doing the same thing on my Nexus one and without the bitmap caching it also performed better. perhapes because it's a simple shape it works the other way around?

November 2, 2011

I figured out all of my problems with 1 line of code!  I can't believe this.  I was reading that AIR supports higher stage qualities now (at least that's what I was gathering).

Stage.quality = StageQuality.LOW;

Fixed ALL of the problems!  So unless you need your stuff to be smoothed, try that out!!!

Touch sensitivity is back!  Framerate is back over 30 where it belongs!!!

I did make a bug about stretching a bitmap with high stage quality on.  Even when that's all that was happening on the stage (not rendering the game, just having one stretched Bitmap) it seems to lag the touch stuff horribly.

Inspiring
November 2, 2011

Hey,

I'm glad you managed to solve your problems  but I guess they were different then mine. I've already tried many times playing with the stage quality and I don't see any big difference between the 3 options. About touch sensetivity, I actually didn't have a problem with that, it's just that the whole application is slowing down after adding one instance to stage and moving it.

What OS version are you testing on? I'm starting to think that altough Air is supported with Froyo 2.2 it just can keep up on it, although still other games I've tried to run that uses Air work well.

November 1, 2011

Yeah, I found that colorDepth thing, too, seemingly no improvement at all

And it definitely happened on the update to AIR 3.  I was playing the game right before my phone told me of the new update, naturally I was all excited about it, updated, then it was just terrible!

I get slightly better perforance when I use GPU, goes to 25fps... sometimes.  But it seems to lag easily when you get into the fray, which is beyond disappointing since it had 0 problems right before the update.

Basically I'm using my own framework for drawing, but it was working just fine until AIR updated.  I was getting many many hours of battery life (ran many tests where I just left the game running).

I also tried reverting back to targeting 2.7, still bad.

Inspiring
November 1, 2011

It does sound like a problem with the Air app itself, but then again it's weird that since it's release we're the first to come up with this issue (at least from how it looks like, I also can't find other posts about it).

To bad there isn't a way to go back to the previews version of Air on the device. I would really want to see if it also makes a difference in my case.

Participating Frequently
November 1, 2011

oz,

Please file a bug at http://bugbase.adobe.com. This will enable our QE team to take a look.

Also, you can get an older version of the Runtime.apk file from the corresponding version of the AIR SDK. (http://kb2.adobe.com/cps/853/cpsid_85304.html). Use ADT in the SDK to uninstall and install AIR on the device:

yourairsdk/bin/adt -uninstallRuntime -platform android

yourairsdk/bin/adt -installRuntime -platform android

(http://help.adobe.com/en_US/air/build/WS901d38e593cd1bac1e63e3d128fc240122-7ff6.html)

November 1, 2011

I have to say, this is the first post about this I've found!  It's been a frustrating couple weeks!

My friend and I are making a game using AIR for Android.  Before AIR 3 came out it ran at about 35 fps regularly, no lag, touch sensitivity was perfect! (a ton of stuff happening as well, probably drawing 100'ish objects)  Once we updated AIR to 3.0 on both of our phones (I have a Droid X, he has an X2) all hell broke loose!  Now if we're lucky it will get up to 20fps.  And it seems that no matter what I do there's a 300-500 millisecond delay before the TOUCH_BEGIN event fires.

We're using a framework that I wrote that pretty much uses copyPixels to draw everything, not sure if that somehow got destroyed when they updated it!

edit:

The worst part is, if I render out to a regular swf and load it in my phone's browser it works perfectly!  35+ fps, no touch lag!

Inspiring
November 1, 2011

Hey,

You say that the frma erate droped once you updated to Air 3 on your devices but I just want to make sure, Did it happen once you've downloaded the Air app update and installed it on your device or once you republished your game with the new Air SDK?

I only use copyPixels when I first load my game, I never use it in the middle of the game.

edit: I did try to download a few games that run on Air and they work great, I tried the physTest app and it works very smoooth as well with almost constant 30fps. It's the first time I try to publish to android so I didn't have a chance to see how it would work before Air 3 was released.

Inspiring
November 1, 2011

Ok, here is the code of a small test I did:

var bitmap:Bitmap = new Bitmap(new Square());

addChild(bitmap);

addEventListener(Event.ENTER_FRAME, function() {  bitmap.y += 0.2; });

addChild(new FPSTimer()); // a class that shows the frame rate, I tried removing it to see if the speed of the square movement changes but it doesn't make a difference.

That's all the code I have on the first frame of the project. The Square is a 10x10 pixels bitmap with a blue solid color and no transparency at allt that I have in my library.

When I only add the bitmap to the stage without running the update event I get 60fps, once I start to run the update to move the Square it drops immediately to 30fps, for moving only this small bitmap.

deploying the same file using cpu I get arounf 55fps.

edit: I also tried changing the color depth back to 16-bit like it was in older versions of Air. It's now working on 19fps instead of 17 :/

edit 2: I decided to try and replace my sdk back to 2.7. doing that I also managed to increase the fps to 19-20 but not above that. I also tried to run the test I did and now it runs with 40fps on gpu and 57 fps on cpu. but it shouldn't even change the fps because I'm moving on small bitmap, I really don't get it.

Inspiring
October 31, 2011

after doing some more tests I've noticed something really strange.

Blitting 1 object drops my fps from 60 to 30 (no matter what size the object is BTW) when I test it on a clean project. When I test it inside my game with all the graphics in the background but not moving or changing at all, blitting the same object makes my game drop to 17 fps, but if that's how bad performance is I figured that once I start my game and 80+ objects start to move around, scale, rotate, blit and physics stuff happen It should be much worse, but I was surprised to see that it almost doesn't change - it's stays around 17fps, maybe drops 1-2 frame more here and there.

It just doesn't make any sense to me. Maybe I'm doing something wrong. I tried running other games on my device and they all work fine.

Inspiring
October 31, 2011

Is 30fps the max you can get on devices like the Nexus 1 using Air or is it Air's limit for all android devices?

Nope, a buddy of mine has one of those Galaxy Android devices (1ghz), my ios app that runs in 60fps (made for 3gs) runs at 55fps on his Android.

Inspiring
October 31, 2011

Hi,

Thanks for your reply. Any thoughts on what could be my problem?

BTW, does your app has a lot going on? apps usually don't need 60fps as long as the app is static most of the time. They can easily perform well enough using even 12fps and you can save some memory and battery life for the user.