際際滷

際際滷Share a Scribd company logo
STARLING DEEP DIVE
Starling Deep Dive
LEE BRIMELOW




 Developer Evangelist
www.leebrimelow.com
    @leebrimelow
LEE BRIMELOW           THIBAULT IMBERT




 Developer Evangelist    Sr. Product Manager
www.leebrimelow.com      www.bytearray.org
    @leebrimelow          @thibault_imbert
Starling Deep Dive
Sparrow is a pure Objective-C library created by
Gamua that allows developers to build native iOS
games using an API similar to Flash.
Sparrow is a pure Objective-C library created by
Gamua that allows developers to build native iOS
games using an API similar to Flash.




Starling is based on Sparrow and is a pure AS3
library that mimics the conventional Flash display
list and all content is rendered by the GPU.
Starling Deep Dive
DANIEL SPERL




Creator of Sparrow and Starling
        www.gamua.com
Starling Deep Dive
OFFICIAL ADOBE SUPPORT
Starling Deep Dive
EXAMPLE STARLING CODE
EXAMPLE STARLING CODE
EXAMPLE STARLING CODE


import starling.display.Sprite;
EXAMPLE STARLING CODE


import starling.display.Sprite;

var hero:Sprite = new Sprite();
EXAMPLE STARLING CODE


import starling.display.Sprite;

var hero:Sprite = new Sprite();
hero.x = 200;
EXAMPLE STARLING CODE


import starling.display.Sprite;

var hero:Sprite = new Sprite();
hero.x = 200;
hero.y = 200;
EXAMPLE STARLING CODE


import starling.display.Sprite;

var hero:Sprite = new Sprite();
hero.x = 200;
hero.y = 200;
addChild(hero);
Starling Deep Dive
STARLING API
STARLING API
STARLING API
STARLING API
STARLING API
STARLING API
STARLING API
Starling Deep Dive
WORKING WITH ASSETS
Starling Deep Dive
FULL SUPPORT FOR SPRITE SHEETS
Starling Deep Dive
Starling Deep Dive
Starling Deep Dive
Starling Deep Dive
Starling Deep Dive
Starling Deep Dive
Starling Deep Dive
Starling Deep Dive
Starling Deep Dive
TEXTURE ATLAS
 Easily access di鍖erent textures and animations




myTextureAtlas.getTextures(fly);
Starling Deep Dive
ADOBE TEXTURE FORMAT
A new compressed texture format created specifically for Stage3D




   We will be releasing tooling soon for creating ATF textures
Starling Deep Dive
DYNAMIC TEXTURE ATLAS
Converts vector MovieClip to texture atlas at runtime




            https://github.com/emibap
Starling Deep Dive
PRO TIP
Pack as many of your graphics into texture atlases as possible to
limit the number textures that need to be uploaded to the GPU.
Starling Deep Dive
STARLING DISPLAY OBJECTS
STARLING DISPLAY OBJECTS




Quad
STARLING DISPLAY OBJECTS




Quad      Image
STARLING DISPLAY OBJECTS




Quad      Image        Sprite
                      (container)
STARLING DISPLAY OBJECTS




Quad      Image        Sprite       MovieClip
                      (container)   (container)
Starling Deep Dive
PRO TIP
Set the blend mode property to BlendMode.NONE on background
display objects that dont require alpha to speed up performance.
Starling Deep Dive
WORKING WITH TEXT
Displaying text in Starling is done using the TextField class
WORKING WITH TEXT
Displaying text in Starling is done using the TextField class




  True-type fonts
WORKING WITH TEXT
Displaying text in Starling is done using the TextField class




  True-type fonts                      Bitmap fonts
Starling Deep Dive
ANIMATION IN STARLING
The enter frame event behaves more like a real game timer
ANIMATION IN STARLING
The enter frame event behaves more like a real game timer
ANIMATION IN STARLING
 The enter frame event behaves more like a real game timer



this.addEventListener(EnterFrameEvent.ENTER_FRAME, loop);
ANIMATION IN STARLING
 The enter frame event behaves more like a real game timer



this.addEventListener(EnterFrameEvent.ENTER_FRAME, loop);

private function loop(event:EnterFrameEvent):void
ANIMATION IN STARLING
 The enter frame event behaves more like a real game timer



this.addEventListener(EnterFrameEvent.ENTER_FRAME, loop);

private function loop(event:EnterFrameEvent):void
{
ANIMATION IN STARLING
 The enter frame event behaves more like a real game timer



this.addEventListener(EnterFrameEvent.ENTER_FRAME, loop);

private function loop(event:EnterFrameEvent):void
{
    trace("Time since last frame: " + event.passedTime);
ANIMATION IN STARLING
 The enter frame event behaves more like a real game timer



this.addEventListener(EnterFrameEvent.ENTER_FRAME, loop);

private function loop(event:EnterFrameEvent):void
{
    trace("Time since last frame: " + event.passedTime);
    enemy.moveBy(event.passedTime * enemy.velocity);
ANIMATION IN STARLING
 The enter frame event behaves more like a real game timer



this.addEventListener(EnterFrameEvent.ENTER_FRAME, loop);

private function loop(event:EnterFrameEvent):void
{
    trace("Time since last frame: " + event.passedTime);
    enemy.moveBy(event.passedTime * enemy.velocity);
}
Starling Deep Dive
STARLING OPTIMIZATION TIPS
Starling Deep Dive
EXPORT A RELEASE BUILD

The speed di鍖erence between the debug and release builds in
Starling are huge. Dont make any assumptions on performance
until you export a release build.
Starling Deep Dive
FLATTEN NON-CHANGING SPRITES

Calling flatten on a sprite is similar to cacheAsBitmap in the regular
display list. It reduces the number of draw calls dramatically.


                    mySprite.flatten();
Starling Deep Dive
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;
Starling Deep Dive
USE OBJECT POOLS




pool.getSprite();   pool.returnSprite(s);
Starling Deep Dive
MINIMIZE STATE CHANGES
MINIMIZE STATE CHANGES

Starling batches draw calls whenever possible. Changing the state
of a display object will force a new draw call to the GPU. Properties
that change the state include:
MINIMIZE STATE CHANGES

Starling batches draw calls whenever possible. Changing the state
of a display object will force a new draw call to the GPU. Properties
that change the state include:

  The texture (textures from the same atlas are fine)
MINIMIZE STATE CHANGES

Starling batches draw calls whenever possible. Changing the state
of a display object will force a new draw call to the GPU. Properties
that change the state include:

  The texture (textures from the same atlas are fine)
  The blendMode of display objects
MINIMIZE STATE CHANGES

Starling batches draw calls whenever possible. Changing the state
of a display object will force a new draw call to the GPU. Properties
that change the state include:

  The texture (textures from the same atlas are fine)
  The blendMode of display objects
  The smoothing value of images
MINIMIZE STATE CHANGES

Starling batches draw calls whenever possible. Changing the state
of a display object will force a new draw call to the GPU. Properties
that 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
MINIMIZE STATE CHANGES

Starling batches draw calls whenever possible. Changing the state
of a display object will force a new draw call to the GPU. Properties
that 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
Starling Deep Dive
THE QUADBATCH CLASS
THE QUADBATCH CLASS

QuadBatch is a low-level class that Starling uses to batch draw
calls. It is lighter weight than a flattened Sprite.
THE QUADBATCH CLASS

QuadBatch is a low-level class that Starling uses to batch draw
calls. 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).
THE QUADBATCH CLASS

QuadBatch is a low-level class that Starling uses to batch draw
calls. 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.
THE QUADBATCH CLASS

QuadBatch is a low-level class that Starling uses to batch draw
calls. 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.

   It's a one-way road: you can only add objects.
Starling Deep Dive
MULTI-SCREEN DEVELOPMENT
Starling Deep Dive
USE SEPARATE SET OF HD TEXTURES
USE SEPARATE SET OF HD TEXTURES




SD texture
iPhone 3G
USE SEPARATE SET OF HD TEXTURES




SD texture
iPhone 3G
                    HD texture
                    iPhone 4S
Starling Deep Dive
CONTENT SCALE FACTOR

    Use this value to scale textures appropriately


var scale:Number = starling.contentScaleFactor;

var texture:Texture = Texture.fromBitmap(bmp,
true, false, scale);
Starling Deep Dive
STARLING EXTENSIONS
wiki.starling-framework.org/extensions/start
Starling Deep Dive
PARTICLE SYSTEM
Easily add particle e鍖ects to your games
Starling Deep Dive
FOXHOLE
UI component set particularly suited for mobile
Starling Deep Dive
FRAMEWORKS USING STARLING
Starling Deep Dive
CITRUS ENGINE
Platformer game engine built on top of Starling
Starling Deep Dive
STARLING PUNK
Framework based on the popular Flash Punk engine
Starling Deep Dive
ADOBE NOW SUPPORTS AWAY3D
Starling Deep Dive
COMBINING AWAY3D AND STARLING
Starling Deep Dive
STARLING MOBILE DEMOS
Starling Deep Dive
QUESTIONS?

More Related Content

Starling Deep Dive