Download - Building Multi-platform Video Games for the Cloud

Transcript
Page 1: Building Multi-platform Video Games for the Cloud
Page 2: Building Multi-platform Video Games for the Cloud

Construyendo video juegos multi plataforma para la nubeChris SchalkDeveloper Advocate

Page 3: Building Multi-platform Video Games for the Cloud

Let's start with a Demo!

Page 4: Building Multi-platform Video Games for the Cloud

Introducing ForPlay!A GWT abstraction layer for games

● A small API for building fast cross-platform games● Core game code can be platform agnostic● Develop games in Java

○ Familiar language/toolset● Is compatible with GWT

○ Compiles to JS/HTML5, (among other platforms)● Free and Open Source (alpha)

○ http://code.google.com/p/forplay

Page 5: Building Multi-platform Video Games for the Cloud

Introducing ForPlay!A GWT abstraction layer for games

Implementations for Java, HTML5(GWT/JS), Android, Flash

Page 6: Building Multi-platform Video Games for the Cloud

Components of ForPlay!

Fully generic gaming components. Core game logic is fully platform independent!

Page 7: Building Multi-platform Video Games for the Cloud

Components of ForPlay!

Just implement ForPlay.core.Game

Page 8: Building Multi-platform Video Games for the Cloud

Components of ForPlay!

Easy to write code to handle common input devices

Page 9: Building Multi-platform Video Games for the Cloud

Components of ForPlay!

Images are handled via the ForPlay Layering system

Page 10: Building Multi-platform Video Games for the Cloud

Components of ForPlay!

Game resources are preloaded using the assetManager

Page 11: Building Multi-platform Video Games for the Cloud

Time for some more demos!

Page 12: Building Multi-platform Video Games for the Cloud

ForPlay Cross Platform Magic

● Game uses core ForPlay abstractions, is unaware of which platform is running

● The only platform-specific code is in the entry point for each platform:

Page 13: Building Multi-platform Video Games for the Cloud

Other ForPlay Benefits

● Built-in physics engine based on proven OpenSource technologies

● Box2D○ C++ 2D Physics engine by Erin Catto

● JBox2D○ A port of Box2D from C++ to Java

● GWTBox2D○ A port of JBox2D from Java to JavaScript

Page 14: Building Multi-platform Video Games for the Cloud

Benefits of GWT Abstraction

● GWT Compiler optimizes code for size○ Removes unused code○ Evaluates when possible at compile time○ Inlines functions○ Heavily obfuscated result code

● Smaller compiled code - faster load time● Optimized caching, avoids unnecessary network IO

Page 15: Building Multi-platform Video Games for the Cloud

Benefits of HTML5 for Games

● New HTML elements○ 2D canvas○ Audio, Video

● Application Cache● 3D Canvas (WebGL)

○ Open GL ES 2.0 made JavaScript friendly○

● CSS3○ Supports hardware accelerated transforms

Page 16: Building Multi-platform Video Games for the Cloud

More demos● Building your own games

○ Introducing "App Engine: Cloud Warrior"

Page 17: Building Multi-platform Video Games for the Cloud

App Engine Cloud Warrior Architecture

Google Storage

Game Assets(images/sounds)

Game ScoresProfile Data

App EngineDatastore

Game Play (Forplay)

Page 18: Building Multi-platform Video Games for the Cloud

ForPlay Summary

● Open source, cross-platform game abstraction layer○ Core game logic is platform agnostic

● ForPlay abstracts away the core components of a game○ The game loop, I/O system, and asset management

● Write in familiar Java, get performance on multiple platforms

○ Superior Java development/debug○ GWT allows compilation to fast JavaScript/HTML5

● Your assignment:○ Download ForPlay and build a game! ○ http://code.google.com/p/forplay/

Page 19: Building Multi-platform Video Games for the Cloud

Q&A@cschalk

Page 20: Building Multi-platform Video Games for the Cloud

Muchas Gracias!@cschalk