Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Starling Deep Dive

38,657 views

Published on

Published in: Technology, Art & Photos

Starling Deep Dive

  1. 1. STARLING DEEP DIVE
  2. 2. LEE BRIMELOW Developer Evangelistwww.leebrimelow.com @leebrimelow
  3. 3. LEE BRIMELOW THIBAULT IMBERT Developer Evangelist Sr. Product Managerwww.leebrimelow.com www.bytearray.org @leebrimelow @thibault_imbert
  4. 4. Sparrow is a pure Objective-C library created byGamua that allows developers to build native iOSgames using an API similar to Flash.
  5. 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. 6. DANIEL SPERLCreator of Sparrow and Starling www.gamua.com
  7. 7. OFFICIAL ADOBE SUPPORT
  8. 8. EXAMPLE STARLING CODE
  9. 9. EXAMPLE STARLING CODE
  10. 10. EXAMPLE STARLING CODEimport starling.display.Sprite;
  11. 11. EXAMPLE STARLING CODEimport starling.display.Sprite;var hero:Sprite = new Sprite();
  12. 12. EXAMPLE STARLING CODEimport starling.display.Sprite;var hero:Sprite = new Sprite();hero.x = 200;
  13. 13. EXAMPLE STARLING CODEimport starling.display.Sprite;var hero:Sprite = new Sprite();hero.x = 200;hero.y = 200;
  14. 14. EXAMPLE STARLING CODEimport starling.display.Sprite;var hero:Sprite = new Sprite();hero.x = 200;hero.y = 200;addChild(hero);
  15. 15. STARLING API
  16. 16. STARLING API
  17. 17. STARLING API
  18. 18. STARLING API
  19. 19. STARLING API
  20. 20. STARLING API
  21. 21. STARLING API
  22. 22. WORKING WITH ASSETS
  23. 23. FULL SUPPORT FOR SPRITE SHEETS
  24. 24. TEXTURE ATLAS Easily access different textures and animationsmyTextureAtlas.getTextures(“fly”);
  25. 25. ADOBE TEXTURE FORMATA new compressed texture format created specifically for Stage3D We will be releasing tooling soon for creating ATF textures
  26. 26. DYNAMIC TEXTURE ATLASConverts vector MovieClip to texture atlas at runtime https://github.com/emibap
  27. 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. 28. STARLING DISPLAY OBJECTS
  29. 29. STARLING DISPLAY OBJECTSQuad
  30. 30. STARLING DISPLAY OBJECTSQuad Image
  31. 31. STARLING DISPLAY OBJECTSQuad Image Sprite (container)
  32. 32. STARLING DISPLAY OBJECTSQuad Image Sprite MovieClip (container) (container)
  33. 33. PRO TIPSet the blend mode property to BlendMode.NONE on backgrounddisplay objects that don’t require alpha to speed up performance.
  34. 34. WORKING WITH TEXTDisplaying text in Starling is done using the TextField class
  35. 35. WORKING WITH TEXTDisplaying text in Starling is done using the TextField class True-type fonts
  36. 36. WORKING WITH TEXTDisplaying text in Starling is done using the TextField class True-type fonts Bitmap fonts
  37. 37. ANIMATION IN STARLINGThe enter frame event behaves more like a real game timer
  38. 38. ANIMATION IN STARLINGThe enter frame event behaves more like a real game timer
  39. 39. ANIMATION IN STARLING The enter frame event behaves more like a real game timerthis.addEventListener(EnterFrameEvent.ENTER_FRAME, loop);
  40. 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. 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. 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. 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. 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. 45. STARLING OPTIMIZATION TIPS
  46. 46. EXPORT A RELEASE BUILDThe speed difference between the debug and release builds inStarling are huge. Don’t make any assumptions on performanceuntil you export a release build.
  47. 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. 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. 49. USE OBJECT POOLSpool.getSprite(); pool.returnSprite(s);
  50. 50. MINIMIZE STATE CHANGES
  51. 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. 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. 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. 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. 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. 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. 57. THE QUADBATCH CLASS
  58. 58. THE QUADBATCH CLASSQuadBatch is a low-level class that Starling uses to batch drawcalls. It is lighter weight than a flattened Sprite.
  59. 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. use textures from the same atlas).
  60. 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. use textures from the same atlas). • You can only add instances of the Image, Quad, or QuadBatch class.
  61. 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. use textures from the same atlas). • You can only add instances of the Image, Quad, or QuadBatch class. • Its a one-way road: you can only add objects.
  62. 62. MULTI-SCREEN DEVELOPMENT
  63. 63. USE SEPARATE SET OF HD TEXTURES
  64. 64. USE SEPARATE SET OF HD TEXTURESSD textureiPhone 3G
  65. 65. USE SEPARATE SET OF HD TEXTURESSD textureiPhone 3G HD texture iPhone 4S
  66. 66. CONTENT SCALE FACTOR Use this value to scale textures appropriatelyvar scale:Number = starling.contentScaleFactor;var texture:Texture = Texture.fromBitmap(bmp,true, false, scale);
  67. 67. STARLING EXTENSIONSwiki.starling-framework.org/extensions/start
  68. 68. PARTICLE SYSTEMEasily add particle effects to your games
  69. 69. FOXHOLEUI component set particularly suited for mobile
  70. 70. FRAMEWORKS USING STARLING
  71. 71. CITRUS ENGINEPlatformer game engine built on top of Starling
  72. 72. STARLING PUNKFramework based on the popular Flash Punk engine
  73. 73. ADOBE NOW SUPPORTS AWAY3D
  74. 74. COMBINING AWAY3D AND STARLING
  75. 75. STARLING MOBILE DEMOS
  76. 76. QUESTIONS?

×