7. Unique GCE Capabilities
Industry-leading IO performance
Per-minute billing & Sustained Use Discounts
Super-fast startup times: 1000 VMs in < 5 minutes
High throughput to storage at no extra cost
NEW: Resize disks with no downtime
12. 12
Typical requirements for a compelling mobile game include:
1. Game features :
● Dynamic game content
● Game data stored outside of devices
● Leaderboard
● Multiplayer mode
● Player matching
● Board generation
● Server site bots
2. Platform features :
● Support for Android and iOS devices through native client applications
● Push notifications to Android and IOS devices
● User authentication
● High scalability
3. Business features :
● In-game purchases
● Game analytics
13. 13
Many popular mobile games use mobile backends to:
● Deliver dynamic game content
● Facilitate multiplayer games, including matching players
● Store data outside of the mobile device, e.g., the last completed level, or the scores
achieved in the previous plays
● Manage the leaderboard
● Orchestrate push notifications
● Facilitate in-game purchases
● Provide game analytics
14. 14
Your Mobile Game Backend in the Cloud
● Automatic scalability
● Automatic load balancing across instances of your mobile backend
● Static content serving and caching
● Reliability, performance, and security features
● Monitoring and management
● Configurable DoS protection
● Integration with Google Accounts for OAuth2 authentication (for both Android
and iOS clients)
16. Mobile Backend
running on Google
App Engine Instances
iOS
CloudEndPointClients
Cloud Endpoints
● Create APIs for Mobile Apps to
communicate with Mobile Backends
● Add annotations to client interface
application code or generate Endpoint
classes from Models.
● Discoverable, Restful APIs
implemented on top of Google’s API
Infrastructure
● Tools available for generating Client
Libraries for Android, iOS and
JavaScript
● Built-In Authentication Support
APIs for Mobile Backends Made Easy
Storage Services
Web APIs
Cloud
Endpoints
17. Java - App Engine
@ApiMethod(httpMethod = "PUT", path = "game/{id}/answers")
public void submitAnswers(
@Named("id") long gameId, GamePlayStatus answers,
User player)
throws UnauthorizedException, NotFoundException {
if (user == null) {
throw new UnauthorizedException("The user is not authorized.");
gameService.submitAnswers(gameId, player, answers);
}
Java - Android Apppublic class SubmitAnswersTask extends ServiceTask<Void> {
protected void executeEndpointCall() {
service.gameEndpoint().submitAnswers(gameId, answers).execute();
}
Cloud Endpoints - Custom API
Submit Answers
Cloud Endpoints - Custom API
18. Java - App Engine
Mobile Game-AppEngine $ endpoints.sh get-client-lib org.arw.examples.appengine.mobilegame.GameInviteEndpoint
Jul 17, 2013 3:05:32 PM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
INFO: Successfully processed ./war/WEB-INF/appengine-web.xml
API configuration written to ./gameinviteendpoint-v1.api
API Discovery Document written to ./gameinviteendpoint-v1-rpc.discovery
API Discovery Document written to ./gameinviteendpoint-v1-rest.discovery
API client library written to ./gameinviteendpoint-v1-java.zip
Eclipse
Cloud Endpoints Development
Generate Client Library
Cloud Endpoints Development
19. 19
A Globally Distributed Player Base
US users
EU users
Australia users
Communication
MySQL
Redis
API
US
EU
AUS
Websocket
Geo
Load Balancer
21. 21
Profile and Session Management
MySQL
Signed URL
Profile pictures
Bucket
Edge
Cache
Public pictures
Bucket
Session
information
Redis
User registration
and login
User frontend
PD
SSD
Image metadata
22. 22
Smart client Smart backend
Push to Phone
Web sockets
In-game real time
notifications Push notifications
OR
27. 27
Responsibilities of the mobile game backend include :
● Serving board definitions to the clients
● Managing the list of players and their statistics (for example, how many games a player
played across different devices, how many multiplayer games she won)
● Managing the list of devices used by players in order to be able to send push notifications
to these devices
● Sending game invitations for multiplayer games
● Relaying invitation acceptance, declines and cancellations
28. 28
Key components of mobile gaming solutions
● The mobile game client applications
● The mobile game backend
○ Griddler API includes methods for:
■ Game Management, for example startNewSinglePlayerGame and gameFinished
■ Player Invitations, for example sendInvitation, acceptInvitation etc.
■ Notifications, for example registerDeviceForPushNotification
31. 31
Optimizing data access with Memcache
A backend running on Google App Engine can
use a distributed in-memory, data cache service
called Memcache to store and retrieve
frequently accessed data
32. 32
● Make a game more engaging and social
● Task Queues
○ Push Queue : Sending the enqueued tasks (push model) to your code running on
Google App Engine as HTTP requests to a chosen URL
○ Pull Queue : Mobile backend code can pull the tasks from the queue / Process the
tasks outside of App Engine
Asynchronous processing with Task Queues
45. // Create a Firebase database reference
var ref = new Firebase("https://googleformobile.firebaseio.com");
// Write data from Firebase
ref.set("Hi GCP WorkShop!");
// Read data from Firebase
ref.on("value", function(snapshot) {
var data = snapshot.val();
console.log(snapshot.val());
});
46. "rules": {
"foo": {
// /foo/ is readable by the world
".read": true,
// /foo/ is writable by the world
".write": true,
// data written to /foo/ must be a string less than 100 characters
".validate": "newData.isString() && newData.val().length < 100"
}
}