AIR for a 2D mobile
startup
James Wrightson

Flash Online Conference #11

www.introvertstudios.com
30fps > 60fps
• Always provide the best experience you can
offer! 60fps feels better even in puzzle games :)
Who am I?
• James Wrightson, Developer and Technical
Director of Introvert Studios
• Using AIR professionally for ~1 year
• Released multiple web & mobile games (Zombie
Showdown, Lambi, Invaders…)
Why AIR?
• Spoilt for choice
• Stage3D
• Supports the two major platforms I target (Android and iOS)
• AS3 is a good language, not too high, not too low…
• …yet native interfacing via ANE’s!
• Great community and tools
• Rapid release iterations due to the ADB debugger and rapid
device deployment
Lambi
whosthatjumpysheep.com
Problems to solve…
CPU/Memory
• The AVM2 (that thing that runs your code) has slow memory read/write
• Intrusive Linked lists > Vector.<T> for frame iterative solutions
• Stay away from Math.random(), cache instead (be careful of distribution)
• Inline math operations (such as Vector2D.Normalise)
• Use optimised Sin/Cos functions (2x faster)
• Stay away from virtual calls AT ALL COST
• Pool everything that can be instantiated in game
• [Inline] functions and properties can make it nearly as fast as local
access!
GPU
• Texture Atlases for everything and plan your
layering ahead of time
• Bake alpha changes into textures and reduce
alpha changes (reduces filtrate etc)
• Be aware of over-draw and how to reduce it
• Blend modes…
• Be aware that low draw calls != good performance
Resolution Independence
• Use a Virtual AND Screen viewport
• It is all about the aspect ratio
• Use anchoring to take advantage of wider/
narrower screens
Assets
• Make asset importing effortless
• Write system scripts to send your assets into the
correct folder, clean things you don’t need, zip things
up automagically…
• Although ATF’s reduce memory usage (and possibly
gain performance), I still choose PNG files due to
problems on some Android devices
• MP3 tracks have silence at the start and prevent
seamless loops. I use MP3Loop to remove it.
Scene/Levels
• Flash CC as a scene editor
A JSFL script to convert all bitmaps into
MovieClip linked instances (very important for
workflow)
An AS3 script to export the scene into JSON or
whatever you like
Code on the client side to parse the scene data

and turn it into Stage3D rendered bliss
Conclusion
• AIR is powerful for 2D mobile games
• We need a 2D editor to test changes rapidly
• We need more CPU performance as it’s lagging
behind
• Our community is strong and flash is certainly
NOT DEAD
• Also please play my game Lambi!

http://whosthatjumpysheep.com/





Thank you for listening!

Adobe AIR for mobile games

  • 1.
    AIR for a2D mobile startup James Wrightson
 Flash Online Conference #11
 www.introvertstudios.com
  • 2.
    30fps > 60fps •Always provide the best experience you can offer! 60fps feels better even in puzzle games :)
  • 3.
    Who am I? •James Wrightson, Developer and Technical Director of Introvert Studios • Using AIR professionally for ~1 year • Released multiple web & mobile games (Zombie Showdown, Lambi, Invaders…)
  • 4.
    Why AIR? • Spoiltfor choice • Stage3D • Supports the two major platforms I target (Android and iOS) • AS3 is a good language, not too high, not too low… • …yet native interfacing via ANE’s! • Great community and tools • Rapid release iterations due to the ADB debugger and rapid device deployment
  • 5.
  • 6.
  • 7.
  • 8.
    CPU/Memory • The AVM2(that thing that runs your code) has slow memory read/write • Intrusive Linked lists > Vector.<T> for frame iterative solutions • Stay away from Math.random(), cache instead (be careful of distribution) • Inline math operations (such as Vector2D.Normalise) • Use optimised Sin/Cos functions (2x faster) • Stay away from virtual calls AT ALL COST • Pool everything that can be instantiated in game • [Inline] functions and properties can make it nearly as fast as local access!
  • 9.
    GPU • Texture Atlasesfor everything and plan your layering ahead of time • Bake alpha changes into textures and reduce alpha changes (reduces filtrate etc) • Be aware of over-draw and how to reduce it • Blend modes… • Be aware that low draw calls != good performance
  • 10.
    Resolution Independence • Usea Virtual AND Screen viewport • It is all about the aspect ratio • Use anchoring to take advantage of wider/ narrower screens
  • 11.
    Assets • Make assetimporting effortless • Write system scripts to send your assets into the correct folder, clean things you don’t need, zip things up automagically… • Although ATF’s reduce memory usage (and possibly gain performance), I still choose PNG files due to problems on some Android devices • MP3 tracks have silence at the start and prevent seamless loops. I use MP3Loop to remove it.
  • 12.
    Scene/Levels • Flash CCas a scene editor A JSFL script to convert all bitmaps into MovieClip linked instances (very important for workflow) An AS3 script to export the scene into JSON or whatever you like Code on the client side to parse the scene data
 and turn it into Stage3D rendered bliss
  • 13.
    Conclusion • AIR ispowerful for 2D mobile games • We need a 2D editor to test changes rapidly • We need more CPU performance as it’s lagging behind • Our community is strong and flash is certainly NOT DEAD
  • 14.
    • Also pleaseplay my game Lambi!
 http://whosthatjumpysheep.com/
 
 
 Thank you for listening!