Building Social Games for Windows 8 with Windows Azure Name Title Microsoft Corporation

  • Published on

  • View

  • Download

Embed Size (px)


Building Social Games with Windows Azure

Building Social Games for Windows 8 with Windows Azure NameTitleMicrosoft CorporationAgendaWho Will Benefit From This TalkDevelopersInterested in HTML5 GamesInterested in Windows AzureInterested in Game DevelopmentTopicsGames on Multiple DevicesArchitecture of GamesDataCommunicationHandling ScaleWindows 8 GamesWhat Youll Leave WithUnderstanding of Cloud-based Casual Gaming architectures


ContextBuilding for a Rich EcosystemNot locked into a particular deviceBest Experience for targeted deviceHigh Resolution for Windows 8Scaled down for mobile3

Features of Connected GamesAuthenticationUser SettingsState StorageReal-Time CommunicationGame Services: i.e. Leaderboard & Achievements4

Casual Gaming Ecosystem



Architecture7Three Versions of Tankster

Start A Game

Game Services


Invite to PlayGame Services

WAZStorageWorkerNotification Services

Accept a Game InviteGame Services


Begin Playing a GameGame Services


Connect to the Socket ServerGame Services


Connect to the Socket ServerGame Services


PatternsCommand Query SeparationReliance on Windows Azure StorageQueuesBlobsRest ServicesSockets + Web Sockets15


Decoupled SystemsMany Independent SystemsScale parts not the entire applicationRely on cloud services17

Command Query SeparationSend a command to the web serverWeb server enqueues the commands messageWorker role reads message from queue and acts on message18Architectural DiagramGame Services


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)});};


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);}


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(message.AsString);gameCommandService.DoSomething(gameCommand); } }}



Two Communication MethodsPushPull24

Push CommunicationReal-TimeRequires More Compute InstancesMore Cost Effective for fast paced games25

Push TechnologyWebSocketsSignalRSocket.IOSomewhat limited compatibility on browsers/devices/platforms26

Push Communication ArchitectureSocket Server

Pull CommunicationSlight delay in game commandsLess compute instancesIncreased storage costsMore cost effective for slow paced games28

Pull TechnologyBlob StorageHttp RequestsCompatible on every browser/device/platform29Push Communication Architecture


Push or Pull?SpeedScale31


What is the Toolkit for Social Games?SamplesTic-Tac-ToeConnect FourGuidanceDocsArchitectureToolsClient ScriptsTest ClientServer APIs33

Server APIsGame InvitationsLeaderboardsGame FriendsUser ProfileGame Commands34Generic Server APIsHTML Web Mobile PCWindows PhoneiOSAndroidWindowsMac OS X

Additional ResourcesWindows Azure Toolkit for Social Games Nathan Tottens Blog ntotten.com36

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.37


View more >