Starling Deep Dive

Download Starling Deep Dive

Post on 09-May-2015

37.376 views

Category:

Technology

3 download

Embed Size (px)

TRANSCRIPT

  • 1.STARLING DEEP DIVE

2. LEE BRIMELOW Developer Evangelistwww.leebrimelow.com@leebrimelow 3. LEE BRIMELOW THIBAULT IMBERT Developer EvangelistSr. Product Managerwww.leebrimelow.comwww.bytearray.org@leebrimelow@thibault_imbert 4. Sparrow is a pure Objective-C library created byGamua that allows developers to build native iOSgames using an API similar to Flash. 5. Sparrow is a pure Objective-C library created byGamua that allows developers to build native iOSgames using an API similar to Flash.Starling is based on Sparrow and is a pure AS3library that mimics the conventional Flash displaylist and all content is rendered by the GPU. 6. DANIEL SPERLCreator of Sparrow and Starlingwww.gamua.com 7. OFFICIAL ADOBE SUPPORT 8. EXAMPLE STARLING CODE 9. EXAMPLE STARLING CODE 10. EXAMPLE STARLING CODEimport starling.display.Sprite; 11. EXAMPLE STARLING CODEimport starling.display.Sprite;var hero:Sprite = new Sprite(); 12. EXAMPLE STARLING CODEimport starling.display.Sprite;var hero:Sprite = new Sprite();hero.x = 200; 13. EXAMPLE STARLING CODEimport starling.display.Sprite;var hero:Sprite = new Sprite();hero.x = 200;hero.y = 200; 14. EXAMPLE STARLING CODEimport starling.display.Sprite;var hero:Sprite = new Sprite();hero.x = 200;hero.y = 200;addChild(hero); 15. STARLING API 16. STARLING API 17. STARLING API 18. STARLING API 19. STARLING API 20. STARLING API 21. STARLING API 22. WORKING WITH ASSETS 23. FULL SUPPORT FOR SPRITE SHEETS 24. TEXTURE ATLAS Easily access dierent textures and animationsmyTextureAtlas.getTextures(fly); 25. ADOBE TEXTURE FORMATA new compressed texture format created specifically for Stage3D We will be releasing tooling soon for creating ATF textures 26. DYNAMIC TEXTURE ATLASConverts vector MovieClip to texture atlas at runtimehttps://github.com/emibap 27. PRO TIPPack as many of your graphics into texture atlases as possible tolimit the number textures that need to be uploaded to the GPU. 28. STARLING DISPLAY OBJECTS 29. STARLING DISPLAY OBJECTSQuad 30. STARLING DISPLAY OBJECTSQuadImage 31. STARLING DISPLAY OBJECTSQuadImageSprite(container) 32. STARLING DISPLAY OBJECTSQuadImageSprite MovieClip(container) (container) 33. PRO TIPSet the blend mode property to BlendMode.NONE on backgrounddisplay objects that dont require alpha to speed up performance. 34. WORKING WITH TEXTDisplaying text in Starling is done using the TextField class 35. WORKING WITH TEXTDisplaying text in Starling is done using the TextField classTrue-type fonts 36. WORKING WITH TEXTDisplaying text in Starling is done using the TextField classTrue-type fontsBitmap fonts 37. ANIMATION IN STARLINGThe enter frame event behaves more like a real game timer 38. ANIMATION IN STARLINGThe enter frame event behaves more like a real game timer 39. ANIMATION IN STARLING The enter frame event behaves more like a real game timerthis.addEventListener(EnterFrameEvent.ENTER_FRAME, loop); 40. ANIMATION IN STARLING The enter frame event behaves more like a real game timerthis.addEventListener(EnterFrameEvent.ENTER_FRAME, loop);private function loop(event:EnterFrameEvent):void 41. ANIMATION IN STARLING The enter frame event behaves more like a real game timerthis.addEventListener(EnterFrameEvent.ENTER_FRAME, loop);private function loop(event:EnterFrameEvent):void{ 42. ANIMATION IN STARLING The enter frame event behaves more like a real game timerthis.addEventListener(EnterFrameEvent.ENTER_FRAME, loop);private function loop(event:EnterFrameEvent):void{trace("Time since last frame: " + event.passedTime); 43. ANIMATION IN STARLING The enter frame event behaves more like a real game timerthis.addEventListener(EnterFrameEvent.ENTER_FRAME, loop);private function loop(event:EnterFrameEvent):void{trace("Time since last frame: " + event.passedTime);enemy.moveBy(event.passedTime * enemy.velocity); 44. ANIMATION IN STARLING The enter frame event behaves more like a real game timerthis.addEventListener(EnterFrameEvent.ENTER_FRAME, loop);private function loop(event:EnterFrameEvent):void{trace("Time since last frame: " + event.passedTime);enemy.moveBy(event.passedTime * enemy.velocity);} 45. STARLING OPTIMIZATION TIPS 46. EXPORT A RELEASE BUILDThe speed dierence between the debug and release builds inStarling are huge. Dont make any assumptions on performanceuntil you export a release build. 47. FLATTEN NON-CHANGING SPRITESCalling flatten on a sprite is similar to cacheAsBitmap in the regulardisplay list. It reduces the number of draw calls dramatically.mySprite.flatten(); 48. MAKE CONTAINERS UNTOUCHABLE If a container and its children do not need to be interactive with touch set its touchable property to false. container.touchable = false; 49. USE OBJECT POOLSpool.getSprite(); pool.returnSprite(s); 50. MINIMIZE STATE CHANGES 51. MINIMIZE STATE CHANGESStarling batches draw calls whenever possible. Changing the stateof a display object will force a new draw call to the GPU. Propertiesthat change the state include: 52. MINIMIZE STATE CHANGESStarling batches draw calls whenever possible. Changing the stateof a display object will force a new draw call to the GPU. Propertiesthat change the state include: The texture (textures from the same atlas are fine) 53. MINIMIZE STATE CHANGESStarling batches draw calls whenever possible. Changing the stateof a display object will force a new draw call to the GPU. Propertiesthat change the state include: The texture (textures from the same atlas are fine) The blendMode of display objects 54. MINIMIZE STATE CHANGESStarling batches draw calls whenever possible. Changing the stateof a display object will force a new draw call to the GPU. Propertiesthat change the state include: The texture (textures from the same atlas are fine) The blendMode of display objects The smoothing value of images 55. MINIMIZE STATE CHANGESStarling batches draw calls whenever possible. Changing the stateof a display object will force a new draw call to the GPU. Propertiesthat change the state include: The texture (textures from the same atlas are fine) The blendMode of display objects The smoothing value of images The repeat mode of textures 56. MINIMIZE STATE CHANGESStarling batches draw calls whenever possible. Changing the stateof a display object will force a new draw call to the GPU. Propertiesthat change the state include: The texture (textures from the same atlas are fine) The blendMode of display objects The smoothing value of images The repeat mode of textures The tinted property of quads 57. THE QUADBATCH CLASS 58. THE QUADBATCH CLASSQuadBatch is a low-level class that Starling uses to batch drawcalls. It is lighter weight than a flattened Sprite. 59. THE QUADBATCH CLASSQuadBatch is a low-level class that Starling uses to batch drawcalls. It is lighter weight than a flattened Sprite. All the objects you add must have the same state (i.e. usetextures from the same atlas). 60. THE QUADBATCH CLASSQuadBatch is a low-level class that Starling uses to batch drawcalls. It is lighter weight than a flattened Sprite. All the objects you add must have the same state (i.e. usetextures from the same atlas). You can only add instances of the Image, Quad, orQuadBatch class. 61. THE QUADBATCH CLASSQuadBatch is a low-level class that Starling uses to batch drawcalls. It is lighter weight than a flattened Sprite. All the objects you add must have the same state (i.e. usetextures from the same atlas). You can only add instances of the Image, Quad, orQuadBatch class. Its a one-way road: you can only add objects. 62. MULTI-SCREEN DEVELOPMENT 63. USE SEPARATE SET OF HD TEXTURES 64. USE SEPARATE SET OF HD TEXTURESSD textureiPhone 3G 65. USE SEPARATE SET OF HD TEXTURESSD textureiPhone 3GHD textureiPhone 4S 66. CONTENT SCALE FACTORUse this value to scale textures appropriatelyvar scale:Number = starling.contentScaleFactor;var texture:Texture = Texture.fromBitmap(bmp,true, false, scale); 67. STARLING EXTENSIONSwiki.starling-framework.org/extensions/start 68. PARTICLE SYSTEMEasily add particle eects to your games 69. FOXHOLEUI component set particularly suited for mobile 70. FRAMEWORKS USING STARLING 71. CITRUS ENGINEPlatformer game engine built on top of Starling 72. STARLING PUNKFramework based on the popular Flash Punk engine 73. ADOBE NOW SUPPORTS AWAY3D 74. COMBINING AWAY3D AND STARLING 75. STARLING MOBILE DEMOS 76. QUESTIONS?