Skip to main content
Participant
February 26, 2014
Question

Air - poor performance on Android. is Starling a solution?

  • February 26, 2014
  • 3 replies
  • 1623 views

Hi,

I develop an endless running game for android with flash pro cs6 and AIR 3.2 for Android. Since the game is very simple, I cannot run at 60fps.

The game has a static background(180x240px), a scrolling floor and 4(max 6) obstacles 32x32px at a time on stage.

The stage objects are scaled up by an integer factor to full fill the screen resolution like that:

bitmap.cacheAsBitmap = true;

bitmap.cacheAsBitmapMatrix = new Matrix(multiplier, 0, 0, multiplier);

bitmap.scaleX = multiplier;

bitmap.scaleY = multiplier;

The app is set to work in gpu mode. Any framerate under 60 looks unsmooth.

Is there something else to do in order to gain few more fps? Can I get a better performance using Starling?

Thank you

PS. When is have no animations on screen, the fps hits 60.

This topic has been closed for replies.

3 replies

Inspiring
February 28, 2014

using gpu mode, do not cache as bitmap or w/ matrix on your bitmaps, they are already bitmaps.

if use bitmaps, ur good as is. if not, drawWithquality() your items to bitmaps. do  not cache

set stage quality to low

use 16 bit color depth in app descriptor (android only)

update air sdk

sounds like u should hit 60fps on  most modern devices with your description. on older devices id target 30fps

Inspiring
February 28, 2014

AFIK, CABM allows for bitmaps stored onto the GPU to be smaller in resolution than the source bitmaps.

This makes displaying the texture by the GPU faster ( albeit at a lower res ), because in many cases, the texture cache ( current pixel and surrounding pixels ) can be reused several times, rather than re-caching a new area on the texture.

The lower res can still be visually acceptable depending on the original bitmap resolution, thank's in large part to the bilinear filtering aforded by GPU mode.

This can allieviate some of the performance issues, particularly on devices with low-fill rates.

Bad fill-rate is one of the reasons some older Android devices won't be able to reach 60fps, even with optimum code.

Inspiring
February 28, 2014

Some tips here:

http://forums.adobe.com/message/6104854#6104854

The magnitude of your multiplier may be the issue.

Based on your code sample, I suggest trying this:

var cacheMul:Number = multiplier * 0.5;

bitmap.cacheAsBitmap = true;
bitmap.cacheAsBitmapMatrix = new Matrix(cacheMul, 0, 0, cacheMul);
bitmap.scaleX = multiplier;bitmap.scaleY = multiplier;

User Unknow
Legend
February 27, 2014

Firstly you need to update Adobe Air SDK. Your 3.2 is outdated. It's like dinos Curently version 13 is actual. Go to labs.adobe.com and download beta. Setup it and try to render using GPU render mode. Not CPU. There is switcher between CPU / GPU / Direct.

Sure Starling may fix all issues. But looks like you don't have and background in GPU knowledges so Starling just will apply a lot of limitation to your idea. Begin from Air SDK + GPU render mode... And try to read translation of this article http://translate.google.com.ua/translate?hl=ru&sl=ru&tl=en&u=http://gamespoweredby.com/blog/2013/12/recommendations-for-adobe-air-mobile-developers