FlashApplications

J.Sontag
  • Home
  • Site Notice
  • About Me
  • Write Me
Home > ActionScript3, Games, News > How to Optimize Flash Sprite Animations for Mobile

How to Optimize Flash Sprite Animations for Mobile

24. Januar 2011 Jörg Sontag

Here are some good Links to Optimize your API:

Flash to Mobile: Sprite Animation Techniques

Single Bitmap Display Object with Blitting – 8BitRocket offers some excellent tutorials on how to achieve pixel blitting within Flash. I followed these tutorials and found that their technique results in phenomenal performance within the web browser when working with simple and numerously repeated bitmap sprites. However, even with their optimized game timer loop, their technique struggles with high-resolution mobile devices like the iPad. As a simple test, I compiled their optimized game timer loop for Asteroids as an iPad app after changing the canvas size to 1024×768. The iPad’s processor struggled to redraw the game-state (running anywhere from 5-13 fps) and resulting in a very choppy asteroid game.
8Bit’s example/code: http://www.8bitrocket.com/2008/4/8/Tutorial-Creating-an-Optimized-AS3-Game-Timer-Loop/

Multiple Display Objects that Contain Bitmaps Instead of Vectors– Since I was getting the worst performance on iPad for all of my tests, I did a search for iPhone/iPad games created with Flash. There aren’t a lot out there; in fact, I found only one that included source code: Mike Chambers “Pew Pew” game, which can be found at: http://www.mikechambers.com/blog/2010/07/14/source-code-for-pewpew-released/

For optimal sprite animation performance on mobile devices, you need two things:

1) Implement the GPU vs CPU renderer for the mobile device within the publish settings. This results in the fastest bitmap manipulation, and, on the Android, also achieves a smooth, vector-like appearance on bitmaps that have been rotated.

2) Store Sprite Animations in RAM memory as BitmapData. There are two ways in Flash to manipulate bitmap data – the draw method and the copyPixels method. The draw method can convert vector data to bitmap data, but is much slower than copyPixels method (it actually runs faster in CPU render mode). The copyPixels method is the fastest and highest performing way to manipulate sprite animations, but it only works on images stored as BitmapData.

Team Color: Any turn-based or RTS game developer will undoubtedly recognize the problem of assigning unique team colors to each player’s unit. In my PC/web-based Flash version of Hero Mages, team colors are movie clip objects within the vector animations that I simply tint the color of to match the player’s color. However, bitmap data obviously does not contain any separate structures that can be manipulated this way- so how can you assign unique team colors to the optimized sprite renders? Check out Mario Klingemann’s Selective Color Replace component at http://www.quasimondo.com/archives/000614.php

Adobe’s Developer Connection for Mobile Development:
http://www.adobe.com/devnet/devices/fpmobile.html

Android AIR Optimization Techniques:
http://www.unitedmindset.com/jonbcampos/2010/09/08/optimization-techniques-for-air-for-android-apps/

http://blog.newmovieclip.com/2010/11/13/adobe-air-mobile-application-performance-optimization-on-android/

Found that in this Forum:

http://www.kirupa.com/forum/showthread.php?p=2594452#post2594452

KategorienActionScript3, Games, News Tags: ActionScript 3.0, Applikation, AS3, Game, Technik, usefull
Kommentare (3)
  1. Steve Fulton
    24. Januar 2011, 18:32 | #1
    Antwort | Zitat

    Thanks for the link. We are in the process of evaluating how to best build mobile apps with flash and other technologies. Ir is true that many of our old stand-by techniques simply do not work on the iPhone. We hope to have some good stuff to talk about very soon.

  2. Ross Burke
    30. Januar 2011, 15:26 | #2
    Antwort | Zitat

    I’m trying desperately to get a flash game functioning on an Android Galaxy Tab before the flash gaming summit and Game Dev Conf in San Francisco. My game is quite complex and the performance is terrible on the mobile device. I am experimenting with cacheAsBitmapMatrix but the gains are either negligible or performance actually suffers. I am going to try porting the game as a native android app and hopefully I will see huge performance gains.

  3. Bart
    31. Mai 2011, 18:49 | #3
    Antwort | Zitat

    We use a system which renders every frame of an animation to separate BitmapData (NOT an all-in-one sheet but each frame a seperate render), stores it in a centralized manager, and then pass references to those frame-data’s to one or more Bitmap’s for display (offset per frame).

    This is optimal in memory (the frames have no padding like in spritesheets, thanks to getBounds()), and there’s no heavy-duty pixel block memory operations involved like with blitting, just updating some references and let Flash take care of the rest. You can layer in loads of cool stuff once you have the basic system running.

Kommentare sind geschlossen
FLARManager: Augmented Reality in Flash as3Kinect.org
RSS
  • Google
  • Youdao
  • Xian Guo
  • Zhua Xia
  • My Yahoo!
  • newsgator
  • Bloglines
  • iNezha
Twitter

Tag Cloud

3D 3DText ActionScript2.0 ActionScript3 ActionScript 3.0 Air Android Applikation AS3 Autorennen Begeisterung Corona DesignPattern E-Paper Experiment Five3D Flash Framework Fun Game HTML5 iOS iPad iPhone Javascript jQuery Kinect Leidenschaft Light Lua Mixer Molehill MySQL online PHP Portal Rechner Schieberegler Snippets Sound Technik Typo3 usefull Wordpress XML

WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.

Categories

  • Air (1)
  • Android (1)
  • Art (1)
  • BookLists (1)
  • Desktop (2)
  • FlashLab (35)
    • ActionScript3 (30)
    • AS3 Snippets (3)
  • Games (8)
  • iPhone/iPad (7)
  • JavaScript (6)
  • News (53)
  • References (13)

Flash-Blogs:

  • actionscript microcosmos
  • AlecMcE.com
  • Beautify Code
  • blog.joa-ebert.com
  • ByteArray
  • FlashRealTime
  • gBlog
  • Hawaii Flash User Group
  • John Lindquist
  • Mario Klingemann
  • NIKLAS KNAACK
  • Seb Lee-Delisle Blog
  • The Way of Flex
  • theFlashBlog
  • unitzeroone

Flash-Links:

  • Beautifl-Flash Gallery
  • Creative Applications
  • FIVe3D
  • Flash & Math
  • Flashforum
  • gotoandlearm.com
  • Papervision3D
  • Powerflasher FDT 3
  • RobotLegs AS3
  • wonderfl

Flash-Talks

  • 101 Particles
  • FFK Talks
  • Grant Skinner Talks
Oben WordPress
Theme by NeoEase. Valid XHTML 1.1 and CSS 3.