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

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

Post on 03-Jan-2016

213 views

Category:

Documents

1 download

TRANSCRIPT

Building Social Games with Windows AzureBuilding 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 architectures2ContextBuilding for a Rich EcosystemNot locked into a particular deviceBest Experience for targeted deviceHigh Resolution for Windows 8Scaled down for mobile3Features of Connected GamesAuthenticationUser SettingsState StorageReal-Time CommunicationGame Services: i.e. Leaderboard & Achievements4Casual Gaming Ecosystem5Tanksterdemo6Architecture7Three Versions of TanksterStart A GameGame ServicesWAZStorageWorkerInvite to PlayGame ServicesWAZStorageWorkerNotification ServicesAccept a Game InviteGame ServicesWAZStorageWorkerBegin Playing a GameGame ServicesWAZStorageWorkerConnect to the Socket ServerGame ServicesWAZStorageWorkerConnect to the Socket ServerGame ServicesWAZStorageWorkerPatternsCommand Query SeparationReliance on Windows Azure StorageQueuesBlobsRest ServicesSockets + Web Sockets15Scale16Decoupled SystemsMany Independent SystemsScale parts not the entire applicationRely on cloud services17Command Query SeparationSend a command to the web serverWeb server enqueues the commands messageWorker role reads message from queue and acts on message18Architectural DiagramGame ServicesWAZStorageWorkerJavaScript 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)});};20Send 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);}21Process 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); } }}22Communication23Two Communication MethodsPushPull24Push CommunicationReal-TimeRequires More Compute InstancesMore Cost Effective for fast paced games25Push TechnologyWebSocketsSignalRSocket.IOSomewhat limited compatibility on browsers/devices/platforms26Push Communication ArchitectureSocket ServerPull CommunicationSlight delay in game commandsLess compute instancesIncreased storage costsMore cost effective for slow paced games28Pull TechnologyBlob StorageHttp RequestsCompatible on every browser/device/platform29Push Communication ArchitectureWAZStoragePush or Pull?SpeedScale31Toolkit32What is the Toolkit for Social Games?SamplesTic-Tac-ToeConnect FourGuidanceDocsArchitectureToolsClient ScriptsTest ClientServer APIs33Server APIsGame InvitationsLeaderboardsGame FriendsUser ProfileGame Commands34Generic Server APIsHTML Web Mobile PCWindows PhoneiOSAndroidWindowsMac OS XAdditional ResourcesWindows Azure Toolkit for Social Games watgames.codeplex.com 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

Recommended

View more >