• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Moving from PFI to Air 2.6 for iOS development

Explorer ,
Mar 23, 2011 Mar 23, 2011

Copy link to clipboard

Copied

Hi,

I have spent the past several weeks using the Packager for iPhone to develop a game on the iPad, I had put a lot of work into optimising the game to work on the GPU correctly and got it working at a very good frame rate.

I should say at this point that my game use only bitmaps (no vectors anywhere), and uses no filters, and just the additive blending mode sometimes.

I understand that air 2.6 uses the GPU differently than packager for iphone, I believe it uses GPU Vector mode instead of GPU blend so that all the rasterization is now done on the GPU instead of the CPU. So I compiled my game using adt, but it ran very slowly... I then spent a lot of time trying to get it to run at a better frame rate, but could not get it up to the same speed as I saw in packager for iphone...

1) I am still a bit confused as to when to use bitmap caching in air 2.6 - if I have a game which only uses bitmaps and they are never rotated - just moved about in x/y space - do I even need to enabled any kind of cacheAsBitmap or cacheAsBitmapMatrix?

2) What about if I want to change the alpha of a bitmap to fade them in/out? In PFI I dont think I needed to enable cacheAsBitmapMatrix for that - is that still the case?

3) I know that when using PFI if you apply cacheAsBitmapMatrix to too many things it can make the app freeze or slow it right down (especially if other apps are using memory) - is this still the case as it seemed like a bit of a bug...

4) When using PFI, whenever you loaded an image into GPU memory (by caching it and adding it to the display list), it would make the app stall for a period of time (I guess because it has to rasterize it on the CPU and upload it to GPU), do it still do this as the GPU vector mode rasterizes in GPU now?

5) Do I need to do anything special to make Flash CS5 work with AIR 2.6? at the moment I am just taking the SWF file I had and running it through adt. Just seems like I am getting worse performance, I didn't know if there was something special I had to do.

Any help would be very much appreciated, I have heard so many good things about Air 2.6 and I would love to get to grips with it ASAP.

Thanks,

Greg

TOPICS
Development

Views

2.4K

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
community guidelines
Explorer ,
Mar 24, 2011 Mar 24, 2011

Copy link to clipboard

Copied

hi greg, istarted a thread in another forum about how to get 2.6 working with Flash CS5, it might be helpful: http://forums.adobe.com/thread/826939?tstart=0

Votes

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
community guidelines
Explorer ,
Mar 25, 2011 Mar 25, 2011

Copy link to clipboard

Copied

Hi,

I'm kind of replying to my own post here. I have been doing some further development with iOS on AIR 2.6 and I think that unfortunately the new GPU rendering IS actually just a lot slower than it was on the Packager for iPhone.

I know that a lot of people say that Air 2.6 has made their app run 2x faster and a lot of people say the opposite - that moving to 2.6 has made it run 2x slower- I think the difference there is probably that if you had your code properly optimized for GPU under PFI (which took a lot of work) then you will notice a big slowdown.

For example, under PFI, on the iPad at 1024x768 I could have at least 50 large moving sprites on the screen at once running at full 60fps - I dont think that Air 2.6 could even manage that at 30fps (I have taken to lowering my fps to 30 in Air 2.6).

Saying that Air 2.6 does make it a lot easier to port, especially if you are just using bitmaps as dont really have to do anything (unless they scale/rotate), it's more likely to "just work". Also, PFI had a lot of little bugs in it, like certain blending modes only working half the time, and sometimes the framerate would just bomb if you used too much memory.

So I guess bottom line is that Air 2.6 feels a lot more stable and is easier to use, however if you are just purely using the GPU it will be less than half the speed of the old PFI, which is a massive shame.

However I could be missing something here?

Votes

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
community guidelines
Explorer ,
Mar 28, 2011 Mar 28, 2011

Copy link to clipboard

Copied

hey there greg,

just keeping this discussion going. i am curious how you got such good performance under PFI? i dont have a lot of stuff happening in my app, but noticed that with the ability to toggle screen qaulity to low, i can get 60fps without big elements moving. i dont cache anything using cacheAsBitmapMatrix, but have to cacheAsBitmap (even on bitmaps) to get the performance i want.

what i'm struggling with is not necessarily getting the performance i want (although i would love to get 60fps) bit keeping it consistent. it seems background running apps on iOS really affect performance in a huge way.

Votes

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
community guidelines
Explorer ,
Mar 30, 2011 Mar 30, 2011

Copy link to clipboard

Copied

Hi,

You can quite easily get 60fps with PFI with the correct caching. But yes, I think there is a bug in PFI where if you have games running in the bakground it will very much vary the performance of your app, it can even make it stop working altogether. This was a massive problem with PFI for me, I think it might be related to how much video memory you are trying it use, it seems that if you go over a limit it will stop working correctly and be very unpredictable.

Air 2.6 doesnt seem to have that problem, you can run other stuff in the background and it doesnt really affect it, which is great.

I actually retract everything I said in the posts above about Air2.6 being slow, once you understand it you can get similar performance in a lot of cases. I now have a lot of my game running at 60fps using Air2.6.

It also requires a lot less work to port code over as you dont really have to optimize it nearly as much as PFI. Also, Air 2.6 supports a lot more features in hardware - masks, color tints, blend modes can all work at full speed in hardware now. The only thing which doesnt work are filter effects, which is a bummer.

So I've gone from being very disappointed with Air2.6 to really loving it

Votes

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
community guidelines
Explorer ,
May 21, 2011 May 21, 2011

Copy link to clipboard

Copied

Hi gregdenness,

Is it possible for you to answer your own questions about cacheAsBitMap en cacheAsBitmapMatrix in air 2.6?

I have a problem with scrolling a large bitmap graphic smoothly (1530x2500 pixels).

Problem was there in air 2.5 and in air 2.6 it's even worse...

Can anyone give some advice about how to get a smooth scrolling bitmap-background?

Thanx!

Votes

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
community guidelines
LEGEND ,
May 21, 2011 May 21, 2011

Copy link to clipboard

Copied

iPhone 3GS has a texture size limit of 1024 pixels. iPhone 4 and iPad are limited to 2048. So, no matter what device you're trying on, 2500 pixel bitmaps are going to be constantly re-caching.

You might get further if you cut up the bitmap into smaller chunks, and cache each of the chunks. Don't cache the movielclip that the chunks are inside of, cacheasbitmapmatrix each of the chunks.

Alternately, you could wait in hope of AIR 2.7 coming out, once that's available you should get good performance using CPU.

Votes

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
community guidelines
Explorer ,
May 21, 2011 May 21, 2011

Copy link to clipboard

Copied

Thanx, i'll try that.

So do I need to put each little bitmap into a separate movieclip and cache that clip? Or can I cache the bitmap itself?

And do I need to use CPU or gpu with that solution?

Op 22 mei 2011 om 01:35 heeft Colin Holgate <forums@adobe.com> het volgende geschreven:

iPhone 3GS has a texture size limit of 1024 pixels. iPhone 4 and iPad are limited to 2048. So, no matter what device you're trying on, 2500 pixel bitmaps are going to be constantly re-caching.

You might get further if you cut up the bitmap into smaller chunks, and cache each of the chunks. Don't cache the movielclip that the chunks are inside of, cacheasbitmapmatrix each of the chunks.

Alternately, you could wait in hope of AIR 2.7 coming out, once that's available you should get good performance using CPU.

>

Votes

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
community guidelines
LEGEND ,
May 21, 2011 May 21, 2011

Copy link to clipboard

Copied

It's a displayobject property, so should work on a bitmap. cacheasbitmap might help performance with CPU, but cacheasbitmapmatrix only makes sense for use with GPU.

Votes

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
community guidelines
Explorer ,
Jun 15, 2011 Jun 15, 2011

Copy link to clipboard

Copied

LATEST

Thanx for all the advice!

I did lot's of tests, all of which didn't get me the performance-boost I was hoping for.

Until I tried one last thing (why is it always the last thing you try?)

The whole time I had a bitmap at 200%-scale inside a 100%-scaled MovieClip. Performance was terrible. CacheAsBitmap was on the movieclip.

But when I used the same bitmap at 100%-scale inside a 200%-scaled MovieClip, suddenly performance was great!!!

I now have my app running at 32 fps at my old iPod Touch 2nd Generation!

I anyone wants to check it out, here's the link: http://itunes.apple.com/us/app/topo-nederland/id433607404?mt=8&affId=1955393

I really want to thank you all for all your help and answers and hopefully someone finds my scaling-tip usefull...

Votes

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
community guidelines