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

Mobile performance decrease! - Severe problems switching from PFI to AIR 2.6

New Here ,
May 12, 2011 May 12, 2011

Copy link to clipboard

Copied

Hello all,

I am currently developing a rather popular title for the iPhone . It is my first ever attempt at creating something for the Mobile Market.

I started using Flash CS5 and the packager that comes with it. I optimized my game so that it ran perfectly well on 30FPS in every aspect on the iPhone 4 and iPhone 3GS.

I was really excited when I read about the new features and supports in Flash CS5.5 so I purchased Flash CS5.5 to move all my production to it.

However I noticed a severe decrease in performance as I tested publishing my game in Flash CS5.5 (Air for iOS). I understand that the new "packager" does things differently and so I have also been doing things accordingly but it still acts very instable. For instance, I have a scene with a background cached as bitmap and two short animated MC's that loops (these MC's are not cached or using filters or blending) . So I have three elements but still the FPS drops to around 3-5 FPS even though it is set to 30. On the next scene I have four elements, a background cached as bitmap and three of the same short animated MC's that loops and this works flawlessly. The backgrounds themselves is equal when it comes to what it contains. I practically have nothing on the screen and it will drop FPS!

I have discovered that when MC's containing FBF animation (like blood splatter or water splash) plays on the scene it dramaticly decreases performance. I tried Modify -> shape -> optimize... and optimized those FBF animations with 83 % but no improvement in performance were seen. When I made every frame of the blood splatter animation into an MC and exported them all as bitmaps it worked without problems but this cannot be done through the whole game and especially not in the cutscenes.

I have read and researched my eyes out and pulling my hair til baldness so now I turn to the forums for help.

If anyone out there would be willing to help I would be extremely gratefull!

Thank you,

Daani

TOPICS
Development

Views

898

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 12, 2011 May 12, 2011

Copy link to clipboard

Copied

The general case is that whatever area you disturb has to be resent to the graphics card. If a backdrop is cacheashbitmap that may speed up the transfer, but it still requires a transfer. If you also cacheasbitmapmatirx=new Matrix() the background, even though you are not planning to scale or rotate it, then it doesn't need to transfer, it's already on the graphics card at the time.

I'm not sure how you managed to get good performance on a looped movieclip, unless it was sat on a cacheasbitmapmatrix background, and didn't disturb too big an area. Usually you have to do one of a few different tricks to make it be that the frames of the animation are already cached before you use them. One trick for example is to do the animation by having all the states of the cycle on the same frame, and using code to cycle the visibility of the items.

Start off though by just doing the cacheasbitmapmatrix = new Matrix() on the background of the scene that is currently slow.

Something else for you to consider. Look at this chart that Adobe used at a conference:

http://sonnati.files.wordpress.com/2011/04/senza-nome.jpg

That implies that your same app, without any of these optimizations, will perform perfectly well just using CPU under AIR 2.7. You might think about concentrating on general production for the next few weeks, and then publish using 2.7, if it's available by then. If it's not, then just take a second pass to do all the caching things correctly.

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
New Here ,
May 13, 2011 May 13, 2011

Copy link to clipboard

Copied

Hello Colin!

Thank you for such a great and fast response! I needed some basic knowledge about how rendering in Flash actually works. Thanks!

I will definetly try cacheasbitmapmatrix = new Matrix()  immediately even though I actually found a wierd solution for my FPS problem that I have described below.

I discovered that most of the time the drop in FPS would only occur when textfields would be on the stage. I saw that they didn't embed anything (which means that they embedded all) and perhaps this was the problem that caused the whole doc to drop in FPS. Since I have no need to edit the text any longer I simply broke them appart until no text field existed, only vector graphics. As soon as I tested this new version on my iPhone everything is top performance. Why would something that feels so small as a text field cause the whole app to malfunction?

Another problem in my game is that I have some quite intense animation sequences where blood splatter occurs within an MC. This scene is very laggy when beeing played. I tried a lot of different things and I discovered that if I put that sequence (which exist within an MC) hidden on screen (with a loading image above) before the actual sequence is going to be played it's as if Flash stored that sequence and when it's actually going to be played for the viewer it plays without any drop in FPS at all. I'm no optimizing expert as I have never worked with really limited performance devices. How would you "load" these sequences before they appear on the screen?

And wow! That Air 2.7 seems like something groundbreaking! Can't wait for it to hit the market!

Again, thanks for your support Colin. Massive appreciation from this side!:)

Peace,

Dan

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 13, 2011 May 13, 2011

Copy link to clipboard

Copied

Innocent text fields can be a worse case of what I was talking about, in that they have to be sent over to the graphics card, and so does anything behind them that gets disturbed. From what you've said maybe it's even worse if it's using device fonts.

My other advice, about the matrix, was with the blood splatters in mind, but it looks too like the images being preloaded helps.

For things to get cached they have to be within the stage area for at least one frame of time. That would be distracting of course, and you can't get away with having them hidden behind something, and then in front, when they're in front they would be recached. So, if you're using CS5.5 you could use the new visibility feature. Have your demanding bits all on stage at the start of the scene, but set them be invisible (just select the first frame of the span of the instance, and uncheck the Visible box in the property inspector). Then when you need them, either make another span in the same layer of the timeline, that starts with them being visible, or use code to make them visible.

They do get cached if they are invisible, and it's a lot let demanding than having an alpha of zero. Also, the two spans, the first invisible one, and the second visible one, get combined into being one instance when the swf is published. Make sure the two initial instances have the same name.

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
New Here ,
May 15, 2011 May 15, 2011

Copy link to clipboard

Copied

Colin,

The cacheasbitmapmatrix = new matrix() method has definetly helped me, I am now getting top performance on the scene that was unacceptable earlier.

I'll definetly test the visible option as soon as I get to the office on monday! I am pumped!:)

This might not be relevant for this thread but when adobe Air 2.7 comes out, will CS5.5 update to that version automaticly or will I have to do it manually? If I need to do it manually, will I simply run the setup or will I replace any folders? How would I be able to package the .swf through CS5.5 if the option "Air for iOS" is selected? Would it use the latest Air once installed?

I appreciate you taking time to answer these novice questions. But we all have to start somewhere, right?:)

Thanks,

Dan

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 15, 2011 May 15, 2011

Copy link to clipboard

Copied

LATEST

I can't answer your question! If I could, I think you would like the answer.

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