Skip to main content
August 8, 2011
Question

Low framerate issues in AiR for Android

  • August 8, 2011
  • 3 replies
  • 4560 views

Hi Adobe Forums,

This is my first post so I'd like to thank anyone in advance who helps me out. I'm a developed for a mobile games company in Canada and recently we've started using AiR for Android as I'm actually far more comfortable in AS3 than anything else.

So the problem is, the game runs very smoothly in flash CS5.5, but extremely poorly on Android, and even moreso on iOS. It's framerate is a constant 60fps in Flash and never moves, but drops to <10 on both of these devices.

I've followed the Adobe guidelines highlighted in a blog post I found online (whose location I can't seem to find now...) in order to optimize for iOS, assuming these applied to android as well. No dice. The kicker is it's an EXTREMELY simple game - there is a skipping rope, and an animated character (who both him and the skipping rope are cached as bitmaps), who you tap to make jump. Furthermore, there is music that alternates speed with the speed of the rope using dynamic audio. I'm using TweenLite for all animation and the game actually has massive issues whether or not I use this (this was my first intuition and I immediately ran a version without TweenLite, or any animation for that matter, still had issues)

Has anyone else had a similar issue, and can offer some insight as to how to solve it? The TL;DR version is simply that I'm experiencing abnormally low framerate, as well as very high RAM usage (60MB + , but no leakage)

Thanks in advance for the help.

Ryan

This topic has been closed for replies.

3 replies

August 10, 2011

thanks for the help everyone! I've solved it and I'd like to share how I did so.

While cache as bitmap and matrix were useful, and probably would've solved the issue just the same, I had way too many contingencies on when images and animations occur because it's a music based game where the beat of the song is calculated and animations appear as such. It became very difficult to cache all the images at the right time, so I got my illustrator to simply every export every animation in the game in PNG, and I stored these as bitmaps within movie clips, and attached classes to them.

The game is now working smoothly, and we're now back on track with the project!

thanks so much for your help everyone!

Macdonald_lethe
Participating Frequently
August 10, 2011

I have not used cacheAsBitmap at all for Necrorun.

Edit: not even cacheasbitmapmatrix

I can't think of anything else that could be causing your low frame rate..

Have you tried placing all animations on the screen and run the game without any code? Just to see if the animations by itself are causing the problem.

If so, try removing them bit by bit until you can pinpoint the cause. Not the best method, but could provide the answer

Macdonald_lethe
Participating Frequently
August 9, 2011

  I have this game http://www.newgrounds.com/portal/view/576062 on both Android and iPhone.

I gotta say the performance is better on them as opposed to when I run the game on a browser.

I can't give you a straight answer, but I have noticed that you must remove all tweens (select and convert them to keyframes), and don't use any font filters, like glowfilter for example.

Filters don't show up on iPhone - but they will severely slow down frames per second depending on how you setup them. I don't remember exaclty now how I caused the performance issues on my game by using filters though, so I can't be more precise. On the Android they will not show up as well, but if you hit the home button and then go back to the app, you will see black squares where the fonts were supposed to be.

Also, Necrorun was originally at 60 frames, which ran ok but had slowdowns on the iPhone, we converted it to 30 frames.

Hope something helps.

August 9, 2011

Hey Macdonald,

Thanks so much for your help! I have a lot of filters to remove in order to try this, but I'm fairly certain you are right because I was having the black box issue on Android. I'm in the process of removing Tweens and Filters, but I have a good feeling about it. Thanks again, and I'll update you when it's done.

Inspiring
August 9, 2011

What Rendermode do you use? Did you set it to use the GPU?

Do you follow those guidelines?

http://blogs.adobe.com/cantrell/archives/2010/10/gpu-rendering-in-adobe-air-for-android.html