Slides360 Flex2010 Oz Michaeli

939 views

Published on

Flash to iPhone: Use What You Already Know About Flash to Make Kick Ass Objective-C and OpenGL Apps

Published in: Technology, Art & Photos
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
939
On SlideShare
0
From Embeds
0
Number of Embeds
93
Actions
Shares
0
Downloads
1
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
















































  • Slides360 Flex2010 Oz Michaeli

    1. 1. FLASH TO IPHONE Use what you already know about Flash to make kick-ass Objective-C and OpenGL apps Oz Michaeli Co-Founder, Spiralstorm Games
    2. 2. Oz Michaeli @oztune spiralstormgames.com Blog: spiralstormgames.com/blog New York City
    3. 3. •Started with Flash 5 •Made too many websites •Was fascinated by game development
    4. 4. THE FISIX ENGINE
    5. 5. Freedom Run Flyloop
    6. 6. ... BUT WHO ARE YOU?
    7. 7. GENERAL OVERVIEW • Overview of available technologies • Getting started with iPhone dev • Hands-on demo • Building a simple app • Extracting assets from Flash • Real life app demo
    8. 8. WHAT YOU CAN EXPECT TO LEARN • What it takes to make an iPhone app •A little Objective-C • How to get started with the Pixelwave framework • Ultimate goal: • Being able to make high-performance native iPhone apps with an API familiar to Flash developers
    9. 9. IPHONE FOR FLASH DEVELOPERS What are my options?
    10. 10. OPTION A The hard-core way
    11. 11. OPTION B The automatic way
    12. 12. OPTION C A hybrid way
    13. 13. PIXELWAVE •A mix between ActionScript 3.0 and Objective-C • Native iPhone development • Allows for high performance applications • Low-level optimizations possible
    14. 14. WHY MAKE PIXELWAVE? • Pixelwave started as a product of need • Needed a clean API, but fast performance • We love the Flash API • Been using Flash for prototyping • Decided to re-create core classes in Objective-C
    15. 15. WHY OBJECTIVE-C • It’s native to the iPhone • It has the lowest overhead • While being clean and Object-Oriented • Allows for low level control when needed • It’s really not as bad as it seems initially :)
    16. 16. DESIGN GOALS • Familiar interface • Small memory foot-print • OpenGL Performance • Extendibility
    17. 17. DESIGN GOALS • Familiar Interface • Small memory foot-print • OpenGL Performance • Extendibility
    18. 18. FAMILIAR INTERFACE • Based completely on the Flash API • Recreates the core functionality in Objective-C • Same class names, function names • Ex: (PXSprite, PXGraphics, PXEventDispatcher, etc...) • Adds specialized functionality for the iPhone
    19. 19. DESIGN GOALS • Clean Interface, based on the Flash API • Small memory foot-print • OpenGL Performance • Extendibility
    20. 20. SMALL MEMORY FOOTPRINT • Memory limited on the iPhone • Saved memory can be used to improve your app • More media • Bigger levels • More caching
    21. 21. DESIGN GOALS • Clean Interface, based on the Flash API • Small memory foot-print • OpenGL Performance • Extendibility
    22. 22. OPENGL PERFORMANCE • This is an important one • Lots of Invisible optimizations • User tweakable options •C core, Object Oriented Interface
    23. 23. DESIGN GOALS • Clean Interface, based on the Flash API • Small memory foot-print • OpenGL performance • Extendible design
    24. 24. EXTENDIBILITY • We can’t possibly think of everything • Sometimes you have to add custom behaviors • Custom C interface for interacting with OpenGL • Provides a layer of abstraction • More invisible optimizations
    25. 25. MAIN FEATURES • Super optimized OpenGL rendering. • Clean API, AS3 based • Simple event dispatching model • Handles native iPhone features • Native vector drawing. • TextFields with native or custom fonts. • One line texture loading, • Sound playback • Very easy to extend • Plays nice with Cocoa Touch
    26. 26. PXDisplayObject PXTexture PXInteractiveObject PXShape PXDisplayObjectContainer PXSprite PXStage PXGraphics PKAnimationClip
    27. 27. OBJECTIVE-C PRIMER
    28. 28. OBJECTIVE-C FOR FLASH DEVS • Shares many core concepts with ActionScript 3.0 • Object Oriented • No dynamic typing • Built on top of C • Some wacky syntax for method calls • No Garbage Collector
    29. 29. DECLARING VARIABLES ActionScript 3.0: var i:int; var button:Button; Objective-C: int i; Button* button;
    30. 30. INVOKING A METHOD ActionScript 3.0: mc.addChildAt(childMC, 3); Objective-C: [mc addChild:childMC at:3];
    31. 31. READS LIKE A SENTENCE Objective-C: [object gotoFrame:10 atTime:30.0 withAnimation:@”Jog”];
    32. 32. DECLARING METHODS ActionScript 3.0: public function reverseArray(arr:Array):Array{...} public static function whiteNoise():void{...} Objective-C: - (NSArray *)reverseArray: (NSArray *)arr{...} + (void) whiteNoise{...}
    33. 33. INSTANTIATING AN OBJECT ActionScript 3.0: person = new Person(“Jimbo”); Objective-C: person = [[Person alloc] initWithName: @”Jimbo”]];
    34. 34. MEMORY MANAGEMENT • Applies only to Heap allocation (ie the new command in AS) • If you made it, you delete it • Messages starting with alloc, and new, copy indicate ownership • Forevery owning method call, a [object release]; call must be made
    35. 35. MORE INFO • http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/ MemoryMgmt/Articles/mmRules.html#//apple_ref/doc/uid/20000994-BAJHFBGH • http://memo.tv/memory_management_with_objective_c_cocoa_iphone • http://www.johncmurphy.com/product.aspx?pid=349
    36. 36. GETTING STARTED What do I need?
    37. 37. HELLO WORLD
    38. 38. DEMO: AS3 VS OBJ-C
    39. 39. ? EXPORTING FLASH ASSETS
    40. 40. CONVERTING VECTOR ART Looks like another demo...
    41. 41. WORKING WITH ANIMATIONS •A great OpenGL optimization is to use the smallest amount of textures possible • Enter the Texture Atlas • New tool to convert MovieClips directly to a texture atlas
    42. 42. MOVIECLIP EXPORTER
    43. 43. MIXING IT UP • Best solution is probably a hybrid one • Automatic conversion can only go so far • Some manual input needed for optimization • We’re looking forward to seeing where the community can take these tools
    44. 44. PUTTING IT ALL TOGETHER How we’re using Pixelwave
    45. 45. DEMO TIME!
    46. 46. WHAT’S NEXT? • Pixelwave will enter beta phase soon • Will be open source, completely free to use • Other platforms • We can’t wait to find out
    47. 47. THANK YOU! • Coming to 360|iDev? See you there. • spiralstormgames.com/blog • @oztune

    ×