cross platform mobile game development

21
Cross Platform Mobile Game Development Saturday, August 24, 13

Upload: allan-davis

Post on 08-May-2015

601 views

Category:

Technology


0 download

DESCRIPTION

Developing games with Cocos2d-x

TRANSCRIPT

Page 1: Cross Platform Mobile Game Development

Cross Platform Mobile Game Development

Saturday, August 24, 13

Page 2: Cross Platform Mobile Game Development

About Me• Allan Davis

• http://www.cajuncode.com

• Email: [email protected]

• Twitter: @cajun_code

Saturday, August 24, 13

Page 3: Cross Platform Mobile Game Development

Agenda

Saturday, August 24, 13

Page 4: Cross Platform Mobile Game Development

Tools• Graphics

• Bitmap: Gimp, Photoshop, Pixelmator

• Vector: Inkscape, iDraw

• 3D: Blender, 3D Studio Max

• Other: TexturePacker

• Audio

• Audacity: http://audacity.sourceforge.net/

• Musescore: http://musescore.org

• Frameworks

Saturday, August 24, 13

Page 5: Cross Platform Mobile Game Development

Mobile Game Frameworks Landscape

• Corona

• Unity

• Cocos2d-X

• Many others ...

Saturday, August 24, 13

Page 6: Cross Platform Mobile Game Development

Corona

• 2d Game Framework

• iOS, Android

• Lua

• Closed Source

• Free to use Starter version

• Does allow publishing

• http://coronalabs.com

Saturday, August 24, 13

Page 7: Cross Platform Mobile Game Development

Unity 3d

• 3d Environment for creating games

• Desktop, iOS, Android Blackberry

• C#, Javascript or Boo Script

• Closed Source

• Free to develop and publish

• http://unity3d.com/

Saturday, August 24, 13

Page 8: Cross Platform Mobile Game Development

Cocos2d-x

• 2D Game Framework

• iOS, Android, Windows Phone, Desktop

• Open Sourced

• C++ 11 (3.0 alpha)

• www.cocos2d-x.org

Saturday, August 24, 13

Page 9: Cross Platform Mobile Game Development

Demo: Getting Started

Saturday, August 24, 13

Page 10: Cross Platform Mobile Game Development

Game loop

Setup Game

Get User Input

Update Game

Objects

Update Display

Done?Shut

DownYes

No

Saturday, August 24, 13

Page 11: Cross Platform Mobile Game Development

Director

Class that creates and handle the main Window and manages how and when to execute the Scenes.

The Director is also responsible for:• initializing the OpenGL context• setting the OpenGL pixel format (default on is RGB565)• setting the OpenGL buffer depth (default one is 0-bit)• setting the projection (default one is 3D)• setting the orientation (default one is Portrait)

Saturday, August 24, 13

Page 12: Cross Platform Mobile Game Development

NodeAnything that gets drawn or contains things that get drawn is a Node. The most popular Nodes are: Scene, Layer, Sprite, Menu.

The main features of a Node are:• They can contain other Node nodes (addChild,

getChildByTag, removeChild, etc)• They can schedule periodic callback (schedule,

unschedule, etc)• They can execute actions (runAction, stopAction,

etc)

Saturday, August 24, 13

Page 15: Cross Platform Mobile Game Development

Sprite

Saturday, August 24, 13

Page 16: Cross Platform Mobile Game Development

SpriteSprite is a 2d image ( http://en.wikipedia.org/wiki/Sprite_(computer_graphics) )Sprite can be created with an image, or with a sub-rectangle of an image.If the parent or any of its ancestors is a SpriteBatchNode then the following features/limitations are valid• Features when the parent is a BatchNode:◦ MUCH faster rendering, specially if the SpriteBatchNode has many children.

All the children will be drawn in a single batch.• Limitations◦ Camera is not supported yet (eg: OrbitCamera action doesn't work)◦ GridBase actions are not supported (eg: Lens, Ripple, Twirl)◦ The Alias/Antialias property belongs to SpriteBatchNode, so you can't

individually set the aliased property.◦ The Blending function property belongs to SpriteBatchNode, so you can't

individually set the blending function property.◦ Parallax scroller is not supported, but can be simulated with a "proxy" sprite.

Saturday, August 24, 13

Page 17: Cross Platform Mobile Game Development

Sprite Batch NodeSpriteBatchNode is like a batch node: if it contains children, it will draw them in 1 single OpenGL call (often known as "batch draw").A SpriteBatchNode can reference one and only one texture (one image file, one texture atlas). Only the Sprites that are contained in that texture can be added to the SpriteBatchNode. All Sprites added to a SpriteBatchNode are drawn in one OpenGL ES draw call. If the Sprites are not added to a SpriteBatchNode then an OpenGL ES draw call will be needed for each one, which is less efficient.Limitations:• The only object that is accepted as child (or grandchild, grand-grandchild, etc...) is Sprite or

any subclass of Sprite. eg: particles, labels and layer can't be added to a SpriteBatchNode.• Either all its children are Aliased or Antialiased. It can't be a mix. This is because "alias" is a

property of the texture, and all the sprites share the same texture.

Saturday, August 24, 13

Page 18: Cross Platform Mobile Game Development

Action

Saturday, August 24, 13

Page 19: Cross Platform Mobile Game Development

Demo:FTL Effect: Invasion

Saturday, August 24, 13

Page 20: Cross Platform Mobile Game Development

Resources

• Webiste:

• http://www.cocos2d-x.org/

• Tutorials:

• http://www.raywenderlich.com/tutorials

• Book:

• http://www.packtpub.com/cocos2d-x-by-

Saturday, August 24, 13

Page 21: Cross Platform Mobile Game Development

Questions?

Saturday, August 24, 13