560 likes | 673 Views
Play together! Leaderboards with Windows Azure and Multiplayer with Wi-Fi Direct. Jianye Lu Program Manager Priya Dandawate Program Manager 3-051. Play games t ogether!. Gamers have more fun Play with other people, and discover new people Developers reach out to more gamers
E N D
Play together! Leaderboards with Windows Azure and Multiplayer with Wi-Fi Direct Jianye Lu Program Manager Priya Dandawate Program Manager 3-051
Play games together! • Gamers have more fun • Play with other people, and discover new people • Developers reach out to more gamers • Grow user base through social networks • Boost game usage with competition/cooperation among friends • New opportunities • New platform and new devices
We help gamers play together in your games with turnkey solutions for key scenarios!
Agenda • Easily connect games with Proximity API • Build social backend with Windows Azure Mobile Services • Do more with our solutions
Windows.Networking.Proximity • Easy to connect via Wi-Fi Direct or NFC • No AP required • Proximity discovers nearby PCs running your app in the foreground • No need to deal with IP addresses • Wi-Fi Direct provides a fast, high quality connectionLocal P2P network; no AP required • Connection time: 3-10 seconds • Throughput: 20 mbps – 30 mbps • Latency: 30-100ms • High through-put and low latency • Simple user experience • Windows takes care of the complexity of getting connected so you can focus on the gaming experience
PeerFinder.Role = PeerRole.Client; PeerFinder.Role = PeerRole.Host;
PeerFinder Networking Model Host Client
PeerFinder Host Client PeerFinder.Role= PeerRole.Host; PeerFinder.TriggeredConnectionStateChanged += TriggeredConnectionStateChanged; PeerFinder.Start(); PeerFinder.Role= PeerRole.Client; PeerFinder.ConnectionRequested += ConnectionRequested; PeerFinder.TriggeredConnectionStateChanged += TriggeredConnectionStateChanged; PeerFinder.Start();
Finding players Client Host privateasyncvoidFindPeers() { progressBar.Visibility= Visibility.Visible; try { varpeerInfoCollection = awaitPeerFinder.FindAllPeersAsync(); if (peerInfoCollection.Count > 0) { // Display nearby clients in a list ... PeerFinder.Role = PeerRole.Client; PeerFinder.Start(); // Wait for Host to find and invite client.
Connecting players Client – incoming connection request Host privateasyncvoidConnectionRequested(object sender, ConnectionRequestedEventArgs e) { List<string> existingInvitations = newList<string>(); existingInvitations.Add(e.PeerInformation.DisplayName); ... ReceivedInvitationsHeader.Text= "STOMP invitations :-)"; progressBar.Visibility= Visibility.Collapsed; } privateasyncTaskConnectToPeers(PeerInformation peer) { progressBar.Visibility= Visibility.Visible; StreamSockets = await PeerFinder.ConnectAsync(peer); ConnectedPeertemp = newConnectedPeer(peer.DisplayName); connectedPeers[temp] = newSocketReaderWriter(s, this); ... startGameButton.Visibility= Visibility.Visible; }
Connecting players (continued) Client – connect devices Host // Host connecting to client... // Navigate client to a new page - WaitingForHost ... { backButton.Visibility = Visibility.Collapsed; WaitingForHostParametersparameters = (WaitingForHostParameters)navigationParameter; StreamSocketsocket = awaitPeerFinder.ConnectAsync(parameters.peer); pageTitle.Text = "Connected! Waiting for Host..."; ... }
Tap and connect Client – connect devices Host privateasyncvoidTriggeredConnectionStateChanged(objectsender, TriggeredConnectionStateChangedEventArgs e) { if(e.State == TriggeredConnectState.PeerFound) { // Show indeterminate progress UI } elseif (e.State==TriggeredConnectState.Completed) { socket = newSocketReaderWriter(e.Socket, this); } elseif (e.State == TriggeredConnectState.Failed) { // Inform Game Leader that connection failed } } privateasyncvoidTriggeredConnectionStateChanged(object sender, TriggeredConnectionStateChangedEventArgs e) { if(e.State == TriggeredConnectState.PeerFound) { // Show indeterminate progress UI } elseif (e.State == TriggeredConnectState.Completed) { StreamSocketsocket = e.Socket; WaitForHost(socket); } elseif (e.State == TriggeredConnectState.Failed) { // Inform challenger that connection failed } }
Sending/Receiving data - timer Client Host privatevoidUpdateTime(TickOption option){// Decrement the timer by 1 second foreach (SocketReaderWritertempsocketinconnectedPeers.Values) {string message = string.Format("{0} {1}",Constants.OpCodeUpdateClientTime, timeLeft.ToString(@"m\:ss"));tempsocket.WriteMessage(message); }} publicasyncvoidReadMessage() { // Read incoming message from the socket uintbytesRead = awaitdataReader.LoadAsync(sizeof(uint)); uintmessageLength = dataReader.ReadUInt32(); bytesRead = awaitdataReader.LoadAsync(messageLength); currentMessage = dataReader.ReadString(messageLength); ... } privateintParseMessage() { ... caseConstants.OpCodeUpdateClientTime: if(gamePage != null) gamePage.UpdateClientTime(words[1]); break;
UX considerations • Keep user up-to-date on the state of the connection • Ex: indeterminate progress bars, text • Game terminologyTranslate Host/Client networking model into fun gaming terminology • Ex: Host – Game Leader, Client – Challenger/player • Network failure cases Host connection fails vs. Client connection fails
Don’t stop at Games… • Sharing photos and videos • Drawing, painting, sketching…together • Learning together – interactive virtual chalkboards • Collaborative DJ-ing • Easy translators – multi-lingual chat room • …
Proximity APIs provide a quick and easy way to get your app connected Windows takes care of the complexity of getting connected so you can focus on the gaming experience
Agenda • Easily connect games with Proximity API • Build social backend with Windows Azure Mobile Services • Do more with our solutions
Windows Azure Mobile Services • Use cloud storage for structured data • With powerful server scripting and database management • Allow users to login with popular identity providers • Microsoft Account, Facebook, Twitter, and Google • Send push notifications • Integrated with live tiles on Windows/Windows Phone • Integrated with notifications on iOS/Android
Why Windows Azure Mobile Services? • Add a backend service to your game in minutes • Data storage, authentication, push notifications, and more • Cross-platform support • SDKs for Windows/Windows-Phone/iOS/Android/HTML5 • Reliable, scalable and production ready • Enjoy high availability, global reach across multiple data centers, and easily scale your backend up as required • Windows Azure Mobile Services provides preconfigured backend
First things first • Create and register your game with Windows Store • Sign up for Windows Azure Mobile Services • Create and connect your first mobile service
Adding leaderboard • Create tables on Azure server to record results and leaderboard • Update server-side scripts to insert new data and update leaderboard • Add client code to insert results and retrieve/display leaderboard
Create tables • Update server script • Add client code
Create tables • Update server script • Add client code
Create tables • Update server script • Add client code
Create tables • Update server script • Add client code
Adding authentication • Register an account provider • Connect your account provider with your app and your Azure mobile service • Add client code to bring up built-in log-in page • (Optionally) Restrict data access based on authentication
Register provider • Connect provider • Add client code • Restrict data access
Register provider • Connect provider • Add client code • Restrict data access
Register provider • Connect provider • Add client code • Restrict data access
Register provider • Connect provider • Add client code • Restrict data access
Register provider • Connect provider • Add client code • Restrict data access
Register provider • Connect provider • Add client code • Restrict data access
Adding push notifications • Register and connect Live Connect service • Acquire and store channels for push notifications • Update server side scripts to send out push notifications
Register and connect service • Acquire and store channels • Update scripts to send
Register and connect service • Acquire and store channels • Update scripts to send
Register and connect service • Acquire and store channels • Update scripts to send
Register and connect service • Acquire and store channels • Update scripts to send
Register and connect service • Acquire and store channels • Update scripts to send
Register and connect service • Acquire and store channels • Update scripts to send
Do more with Windows Azure Mobile Services • Leaderboard • Id and log-in • Live tiles
Do more with Windows Azure Mobile Services Achievements Profiles and data roaming Toast notifications • Leaderboard • Id and log-in • Live tiles → → →
Do more with Windows Azure Mobile Services Achievements Profiles and data roaming Toast notifications Match-making Id, preference, skillset, locations • Leaderboard • Id and log-in • Live tiles → → →
Do more with Windows Azure Mobile Services Achievements Profiles and data roaming Toast notifications Match-making Id, preference, skillset, locations Turn-based gaming Id, game status, push notifications • Leaderboard • Id and log-in • Live tiles → → →
Command line tools • Scripts to automate the creation, verification, and deletion process of a mobile service
Integrated support in Visual Studio • Server Explorer to manage services, tables, and scripts • Wizard to set up push notifications
Windows Azure Mobile Services provides a preconfigured backend so you can focus on your gaming contents and logic, not services.http://aka.ms/mobileservices