![Page 1: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/1.jpg)
Building Social Games for Windows 8 with Windows Azure NameTitleMicrosoft Corporation
![Page 2: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/2.jpg)
AgendaWho Will Benefit From This TalkDevelopersInterested in HTML5 GamesInterested in Windows AzureInterested in Game Development
TopicsGames on Multiple DevicesArchitecture of GamesDataCommunicationHandling ScaleWindows 8 Games
What You’ll Leave WithUnderstanding of Cloud-based Casual Gaming architectures
![Page 3: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/3.jpg)
ContextBuilding for a Rich EcosystemNot locked into a particular deviceBest Experience for targeted deviceHigh Resolution for Windows 8Scaled down for mobile
![Page 4: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/4.jpg)
Features of Connected GamesAuthenticationUser SettingsState StorageReal-Time CommunicationGame Services: i.e. Leaderboard & Achievements
![Page 5: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/5.jpg)
Casual Gaming Ecosystem
![Page 6: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/6.jpg)
Tankster
demo
![Page 7: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/7.jpg)
Architecture
![Page 8: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/8.jpg)
Three Versions of Tankster
![Page 9: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/9.jpg)
Start A Game
![Page 10: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/10.jpg)
Invite to Play
![Page 11: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/11.jpg)
Accept a Game Invite
![Page 12: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/12.jpg)
Begin Playing a Game
![Page 13: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/13.jpg)
Connect to the Socket Server
![Page 14: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/14.jpg)
Connect to the Socket Server
![Page 15: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/15.jpg)
PatternsCommand – Query SeparationReliance on Windows Azure StorageQueuesBlobsRest ServicesSockets + Web Sockets
![Page 16: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/16.jpg)
Scale
![Page 17: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/17.jpg)
Decoupled SystemsMany Independent SystemsScale parts not the entire applicationRely on cloud services
![Page 18: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/18.jpg)
Command – Query SeparationSend a command to the web serverWeb server enqueues the command’s messageWorker role reads message from queue and acts on message
![Page 19: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/19.jpg)
Architectural Diagram
![Page 20: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/20.jpg)
JavaScript Start GameGameService.prototype.startGame = function (queueId, success, error) {
this.serverInterface.sendAjaxPost(this.apiURL + "game/start/" + queueId, { gameType: "invitation" }, success, error);
};
ServerInterface.prototype.sendAjaxJsonCommand = function (type, url, data, success, error) {
$.ajax({type: type,url: url,dataType: "json",data: data,success: success,error: (error != null ? error : this.onAjaxPostError)
});};
![Page 21: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/21.jpg)
Send Game Commandpublic HttpResponseMessage SendCommand(GameCommand gameCommand){
var queueClient = account.CreateCloudQueueClient();var queue = queueClient.GetQueueReference("gameCommands");var serializer = new JavaScriptSerializer();var json = serializer.Serialize(gameCommand);try{
queue.AddMessage(new CloudQueueMessage(json));}catch{return new HttpResponseMessage(HttpStatusCode.InternalServerError,
"error sending game command. try again.");}return new HttpResponseMessage(HttpStatusCode.OK, null);
}
![Page 22: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/22.jpg)
Process Game Commandpublic void ProcessCommands(){
var queueClient = account.CreateCloudQueueClient();var queue = queueClient.GetQueueReference("gameCommands");while (true) {
var message = queue.GetMessage();if (message != null){
var serializer = new JavaScriptSerializer();var gameCommand = serializer.Deserialize<GameCommand>(message.AsString);gameCommandService.DoSomething(gameCommand);
} }
}
![Page 23: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/23.jpg)
Communication
![Page 24: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/24.jpg)
Two Communication Methods
![Page 25: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/25.jpg)
Push CommunicationReal-TimeRequires More Compute InstancesMore Cost Effective for fast paced games
![Page 26: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/26.jpg)
Push TechnologyWebSocketsSignalRSocket.IOSomewhat limited compatibility on browsers/devices/platforms
![Page 27: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/27.jpg)
Push Communication Architecture
![Page 28: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/28.jpg)
Pull CommunicationSlight delay in game commandsLess compute instancesIncreased storage costsMore cost effective for slow paced games
![Page 29: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/29.jpg)
Pull TechnologyBlob StorageHttp RequestsCompatible on every browser/device/platform
![Page 30: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/30.jpg)
Push Communication Architecture
![Page 31: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/31.jpg)
Push or Pull?
![Page 32: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/32.jpg)
Toolkit
![Page 33: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/33.jpg)
What is the Toolkit for Social Games?
![Page 34: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/34.jpg)
Server APIsGame InvitationsLeaderboardsGame FriendsUser ProfileGame Commands
![Page 35: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/35.jpg)
Generic Server APIs
HTML
Web
Mobile
PCWindows PhoneiOSAndroid
WindowsMac OS X
![Page 36: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/36.jpg)
Additional ResourcesWindows Azure Toolkit for Social Games – watgames.codeplex.com Nathan Totten’s Blog – ntotten.com
![Page 37: Building Social Games for Windows 8 with Windows Azure](https://reader036.vdocuments.site/reader036/viewer/2022062410/5681637e550346895dd45f03/html5/thumbnails/37.jpg)
© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to
be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.