Highlighted

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

New Here ,
Feb 26, 2014

Copy link to clipboard

Copied

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.

TOPICS
Development

Views

1.3K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

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

New Here ,
Feb 26, 2014

Copy link to clipboard

Copied

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.

TOPICS
Development

Views

1.3K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 26, 2014 0
Advocate ,
Feb 27, 2014

Copy link to clipboard

Copied

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/...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 27, 2014 0
Participant ,
Feb 27, 2014

Copy link to clipboard

Copied

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;

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 27, 2014 0
Engaged ,
Feb 27, 2014

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 27, 2014 0
Participant ,
Feb 27, 2014

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 27, 2014 0
Participant ,
Feb 27, 2014

Copy link to clipboard

Copied

Boat5,

I am not entirely sure about this, but doesn't CABM tell the GPU to store the bitmap in GPU memory, so that it can be scaled, rotated, etc, rapidly on the GPU ?

I believe that not setting CABM, even for a bitmap, means that the bitmap will be kept in regular memory ( not GPU memory ), and used by the GPU only for rendering the final frame ( e.g. 'compositing step' ).

IOW, just because it is a bitmap, doesn't mean that it is going to reside in GPU memory, simply because the render mode is GPU.  One needs to use CABM for that, no?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 27, 2014 0