Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Social Gaming with Windows Phone and Azure

Social Gaming with Windows Phone and Azure

Presented at TechEd South Africa 2011

Daron Yondem

October 19, 2011

More Decks by Daron Yondem

Other Decks in Programming


  1. Submit your session evaluation for a chance to win! Sponsored

    by MVA http://microsoftvirtualacademy.com
  2. Social Gaming with Windows Phone and Azure Daron Yondem Chief

    Architect | DEVELOAD Software Microsof Regional Director Silverlight MVP INETA MEA President
  3. Daron Yöndem is • Silverlight MVP • Microsoft Regional Director

    for MEA • INETA MEA President • Book Author about HTML5, ASP.NET AJAX, Silverlight • Architect at DEVELOAD Software • Blog at http://daron.yondem.com
  4. DEVELOAD is • Consulting – Software architecture and design –

    Custom software development of Windows, Web Windows Phone, Azure and Silverlight applications – Mentoring services to get you started and keep you going • Web site: www.deveload.com
  5. You Are... • Interested in building WP7 Games • Wondering

    what Cloud computing can offer to help your serve millions of gamers?
  6. Let’s start with... • What Cloud computing can offer? •

    What we have in hand with Windows Azure? • What kind of integration scenarios can happen between WP7 and Azure. • How can Azure help me fascilitade building Social Games reacing millions of people?
  7. Why Phone + Cloud? • The cloud levels the playing

    field • The cloud provides a larger pool of resources from which to pull • The cloud provides a way to reach across device platforms
  8. Why WP7 and Windows Azure? • PaaS: you build it,

    Windows Azure runs it • Automatic O/S patching • Scalable • Utility billing • Additional services (e.g. ACS, Traffic Manager, Caching, CDN, etc.) • Common development tools – Visual Studio – Languages – Emulators for development
  9. Identity Options • Create your own (e.g. username + password,

    token) – Custom model – ASP.NET Membership Providers • Use a single existing identity system (e.g. Live Id, Facebook, etc.) • Outsource identity management (e.g. Access Control Service)
  10. To learn more … Authenticating Users in a Windows Phone

    7 App via Access Control Service, OData Services and Windows Azure http://bit.ly/wp7acs
  11. Storage • SQL Azure – Relational database – Highly available

    – Managed for you as a service • Windows Azure Tables – Non-relational structured storage – Massive scale-out – OData • Windows Azure Blobs – Big files – REST
  12. SQL Azure: OData Service • Client sends data to web

    role • Web role stores data in SQL Azure Web Role (1) (2)
  13. Windows Azure Blobs: Public Blobs • Client sends data to

    web role • Web role stores data in blobs • Client fetches public blobs directly Web Role (1) (2) (3)
  14. Windows Azure Blobs: SAS • Client gets Shared Access Signature

    from web role • Client stores data in blobs • Client fetches public blobs directly Web Role
  15. Windows Azure Tables: Proxy Calls • Client sends data to

    web role • Web role stores data in blobs Web Role
  16. Web Role versus Worker Role • Web Role has IIS

    • Worker Role does not – DLL with Main() • Both implement the RoleEntryPoint
  17. Scaling Work in Windows Azure 1. Web role receives message

    2. Web role enqueues work 3. Worker role polls queue 4. Worker role sends notifications MPNS Worker Role Web Role (1) (2) (3) (4)
  18. Phone-Initiated Communication Options • HTTP-based, request/response • Framework choices (WCF,

    OData, WebRequest, etc.) • Wire format choices (SOAP, JSON, POX, etc.)
  19. Cloud-Initiated Communication • Push Notifications – Single connection between phone

    and Microsoft Push Notification Service – Bandwidth- and battery-friendly – No guarantee of delivery • Three kinds of push notifications – Raw – send a message to an application – Toast – send a message to the user – Tile – update an image, title, or count
  20. Subscribing to Push Notifications • Phone opens a channel •

    Phone sends URL to cloud • Cloud pushes notifications via URL • Microsoft Push Notification service notifies phone MPNS Web Role
  21. Let’s go on with... • How can we build social

    games with Silverlight? • Performance Tips and Tricks
  22. Threading • UIThread – PerFrame Callbacks, Touch, Networking, User Code,

    Layout • RenderThread (Composition Thread) – Opacity, DoubleAnimations, Perspective Transforms, Rectangular Clips, RenderTransforms • Worker Threads
  23. DON’T! Non-rectangular clips Large textures ( > 2K pixels either

    way) Complex animations (e.g. ColorAnimation) Opacity mask
  24. Step 1 : Timer • CompositionTarget.Rendering – Frame Animations •

    DispatchTimer – It’s inside the UIThread • StoryBoard • System.Thread.Timer public partial class Page : UserControl { System.Threading.Timer Sayac; public Page() { InitializeComponent(); Sayac = new System.Threading.Timer(Tick, TOP, 500, 500); } public void Tick(object sender) { ((Ellipse)sender).Dispatcher.BeginInvoke(delegate() { ((Ellipse)sender).Height += 1; }); } }
  25. Step 2 : Graphics • 2D games easy to build

    inside Silverlight • What about 3D? – Kit3D - http://www.markdawson.org/kit3d/ – Balder - http://www.codeplex.com/Balder – XNA! • You can create a whole new 3D world!
  26. Step 3 : Audio • Windows Media Audio and MP3

    support. • XNA Libraries to play effects and wma files. • MediaElement can help you for background music. • You can even have live streams in your game!
  27. Final Step: Pyhsics • Farseer Pyhsics Engine – It’s for

    both Silverlight and XNA! – Includes helpers and behaviors easy to use inside Expression Blend!
  28. In Conclusion • Azure and Cloud – Helps us serve

    millions of gamers with web/worker roles, CDN, SQL Azure, Notification Services – Azure Toolkit for Windows Phone helps us there. • Performanca and tactics for WP7 game development – Composition Thread, DoubleAnimations, Performance Counter and so on. – Using Dispatcher and StoryBoards together.
  29. Submit your session evaluation for a chance to win! Sponsored

    by MVA http://microsoftvirtualacademy.com