Air - poor performance on Android. is Starling a solution?
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.
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/...
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;
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
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.
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?
