Xbox LIVE Multiplayer Gaming on Windows 8 and Other Devices Tim Gill Brian Tyler Architect Lead...

download Xbox LIVE Multiplayer Gaming on Windows 8 and Other Devices Tim Gill Brian Tyler Architect Lead Developer Microsoft Corporation.

If you can't read please download the document

Transcript of Xbox LIVE Multiplayer Gaming on Windows 8 and Other Devices Tim Gill Brian Tyler Architect Lead...

  • Slide 1

Slide 2 Xbox LIVE Multiplayer Gaming on Windows 8 and Other Devices Tim Gill Brian Tyler Architect Lead Developer Microsoft Corporation Slide 3 Xbox LIVE Services Simple web APIs: HTTP services with JSON payloads Single authentication model Enable gameplay across any of our client platforms, including Windows Phone, Windows 8, the web, and the Xbox 360 console Slide 4 Multiplayer Today on Xbox LIVE Fast, efficient real time peer-to-peer networking Xbox 360 and Games For Windows LIVE only In use on a wide range of very successful titles Slide 5 Xbox LIVE Asynchronous Gaming Services Messaging Invite friends to play with you Send notifications to players outside the game to notify them of in-game events Matchmaking Find players to play against Custom-match criteria Multiplayer Game state storage in the cloud Session and player management Slide 6 Which Types of Game Are We Enabling? Very Low Latency twitch Low Latency connected High Latency sometimes connected Pseudo connected World of Warcraft Diplomacy Farmville Slide 7 Simple card game with players betting against the house hand (not each other) Cards are dealt from a shared deck to players on demand Total value of the cards must be < 21 or the player loses. Once all players are done getting new cards the house hand plays. If the house does not go > 21 it pays all player hands with a greater value. Slide 8 Multiplayer Service Session Storage session management in the cloud Manages session metadata and player management State Storage - generic game server technology Game state in the cloud No cloud logic (mimics P2P) Supports multiple HTTP based access models for different latency needs: Slower polling easy to code, higher latency Comet/Hanging GET more work to code, lower latency Slide 9 Multiplayer Workflow Create Session Join Session Post, Get, and Delete State Data Update Session Object Update Session Session Start Session End Gameplay Join Session Leave Session Slide 10 Multiplayer Service State Storage Game State Queue 1 Message 4 Message 3 Message 2 Message 1 Message n Queue 2 Message 3 Message 2 Message 1 Queue 3 Message 4 Message 3 Message 2 Message 1 Message n Queue 4 Slide 11 State Storage Game State Object Queue 1 Game State { "bankerInfo": { "cards": [{"s":"h","v"=3},...], "showCards": true}, "currentPlayer" : 1, "deck": [{"s":"s","v"=2},...], "playerInfos": [ {"bet": 1200, "money":1600, "name":"ShiFu", "picture":"http://cdn.xboxlive.com/188D655F- C306-4AA5-9D4E-1560B6BF0F6A/1.jpg", "cards": [{"s":"c","v"=10},...]} ] } Slide 12 Multiplayer Service Collision Detection Queue 1 Message 3 Message 2 Message 1 Player B Message 4 Player A Message 4 POST /system/mutiplayer/sessions/123/queues/1/messages ? mustFollow=3 Slide 13 Multiplayer Service Race Condition Queue 1 State Player B New State B Player A New State A DELETE POST /system/mutiplayer/sessions/123/queues/1/messages? replaceAll POST Slide 14 Session Object Players Multiplayer Service Session Objects XUID Gamertag Seat Index Is Currently In Session XUID Gamertag Seat Index Is Currently In Session Custom User Data (1Kb) Custom User Data (1Kb) Session ID Title ID Game Variant Display Name Creation Time Visibility Players Can Be Removed By Custom Game Data (1Kb) Max Players Available Seats Is Closed? Has Ended? Slide 15 Session Object Session Objects Session ID Blackjack TitleID Creation Time Visibility.Everyone PlayersCanBeRemovedBy.Self MaxPlayers: 4 Session ID Blackjack TitleID Creation Time Visibility.Everyone PlayersCanBeRemovedBy.Self MaxPlayers: 4 Player Roster Slide 16 Matchmaking Service Allows you to find people to play the game you want to be in, without putting your life on hold Slide 17 Async Matchmaking Experience Matchmaking Service POST Match criteria Match Found! Slide 18 Matchmaking Service - Response Successful match requests return a requestID in response. Two options for detecting it completes: 1. Periodic polling using the request ID for the result of the match 2. Match Found notification from the messaging service. Match Found Slide 19 Matchmaking Simple match algorithm any table with open seats. Simple polling model Slide 20 Messaging Service - Getting into the Game Two ways to get into a session: Anonymous matchmaking Invitation messages from session owner POST https://services.part.xboxlive.com/system/messaging/outbox HTTP/1.1 Content-Type: application/json x-xbl-contract-version: 1 Authorization: XBL2.0 x=STSTokenString Host: services.part.xboxlive.com Content-Length: 39 Connection: Keep-Alive { "body": { "attachments":null, "partnerData": { "MultiplayerMessageType":Invitation", "SessionId": "C8921C4E-4FC2-439E-9368-5D26889BD1BB" } }, "header": { "attributes":null, "expiration":"2011-10-11T23:59:59.9999999", "id":null, "messageType":"Multiplayer", "recipients":[{"userId":worsethanuseless","userType":"Gamertag"}], "sender":"Striker", "senderPlatform":null, "sent":"2011-10-13T16:40:58.1890842-07:00", "targetPlatforms":["WP7"], "titleId":0 } } POST https://services.part.xboxlive.com/system/messaging/outbox HTTP/1.1 Content-Type: application/json x-xbl-contract-version: 1 Authorization: XBL2.0 x=STSTokenString Host: services.part.xboxlive.com Content-Length: 39 Connection: Keep-Alive { "body": { "attachments":null, "partnerData": { "MultiplayerMessageType":Invitation", "SessionId": "C8921C4E-4FC2-439E-9368-5D26889BD1BB" } }, "header": { "attributes":null, "expiration":"2011-10-11T23:59:59.9999999", "id":null, "messageType":"Multiplayer", "recipients":[{"userId":worsethanuseless","userType":"Gamertag"}], "sender":"Striker", "senderPlatform":null, "sent":"2011-10-13T16:40:58.1890842-07:00", "targetPlatforms":["WP7"], "titleId":0 } } Game Invitation Tim Gill (worsethanuseless) Checkers Slide 21 Multiplayer Blackjack Brian Tyler Lead Developer Xbox LIVE on Windows 8 Windows 8 SDK Slide 22 So What Do I Get? Slide 23 Whats in the SDK? Rich Integration with Windows 8 Windows Runtime APIs: C++,.NET and JavaScript Tiles and Toasts with Windows Notification Service Account Creation and Sign-in UI Slide 24 Whats in the SDK? Windows Runtime projections for mainline scenarios Profile and avatar Achievements and leaderboards Async matchmaking and multiplayer Friends and game invites Title Managed Storage Windows Runtime projections for REST access Simplified API to call REST/JSON endpoints directly Slide 25 Whats in the SDK? Downloadable Content (DLC) Durable and consumable Commerce, tracking and delivery Offline Support Grant achievements Leaderboard updates while on a plane Avatar Rendering Library DX11 C++ API fully documented and supported Integrate rich, animated avatars in your game Slide 26 Whats in the SDK? Server Side User Authentication Microsoft Account Xbox Secure Token Service (XSTS) Server Side Proof of Purchase validation with Windows Store license Federated Identity for your game services Slide 27 Drilling In architecture Slide 28 Architecture Offline Support Network Policies Network Policies Foundation Layer Authentication HTTPS/JSON OS Integration Logging Diagnostics Logging Diagnostics Strongly Typed API Third-Party Logic Toasts WNS Store Slide 29 Async and Parallel Patterns Library UI THREAD or THREAD POOL Completion Event Run Then Message Loop Slide 30 Multiplayer Blackjack Brian Tyler Lead Developer Xbox LIVE on Windows 8 Refresher Slide 31 Multiplayer Workflow Create Session Join Session Post, Get, and Delete State Data Update Session Object Update Session Session Start Session End Gameplay Join Session Leave Session Slide 32 Matchmaking Simple match algorithm any table with open seats. Simple polling model Slide 33 Multiplayer Blackjack Brian Tyler Lead Developer Xbox LIVE on Windows 8 demo Slide 34 MaxPlayers = 4; sessionSettings->IsClosed = false; sessionSettings->Visibility = VisibilityLevel::Everyone; sessionSettings->TitleGroupId = titleGroupId; task createTask( signedInUser->CreateMultiplayerSessionAsync(sessionSettings, PlayerAcl::Self));"> Creating a Session // Create a new session settings object auto sessionSettings = ref new MultiplayerSessionSettings(); sessionSettings->DisplayName = "Blackjack"; sessionSettings->MaxPlayers = 4; sessionSettings->IsClosed = false; sessionSettings->Visibility = VisibilityLevel::Everyone; sessionSettings->TitleGroupId = titleGroupId; task createTask( signedInUser->CreateMultiplayerSessionAsync(sessionSettings, PlayerAcl::Self)); Slide 35 TimeoutSeconds = 60; task requestTask(service->PostRequestAsync(matchRequest));"> Requesting a Match auto matchRequest = ref new MatchRequest(); matchRequest->TitleId = titleId; matchRequest->TitleGroupId = titleGroupId; matchRequest->SessionId = sessionId; matchRequest->MaxSeats = 4; matchRequest->SeatsOccupied = seatsOccupied; matchRequest->MatchCriteria->Restriction = MatchRestriction::PreserveSession; matchRequest->MatchCriteria->CustomMatchType = "Blackjack"; matchRequest->TimeoutSeconds = 60; task requestTask(service->PostRequestAsync(matchRequest)); Slide 36 Multiplayer Blackjack Brian Tyler Lead Developer Xbox LIVE on Windows 8 Notifications Slide 37 Keeping in Touch Windows Notification Service (WNS) provides push notifications to Windows clients Xbox LIVE services integrates into WNS to deliver events. Deliver game invites Your Turn, Nudges Results in toasts and tile updates Slide 38 WNS + Xbox LIVE Create Channel Register Channel Friend You Invite Friend Send Message On Channel Push Notification Slide 39 Live Tile Update Example Slide 40 What do you need to do? To get a channel and into the database Do nothing SDK handles it all To receive toasts and tiles Optionally you can do nothing If in the user is in the game, you probably want to clear the tile update Slide 41 Questions? Slide 42