450 likes | 700 Views
WPH307: Building Windows Phone Games with Microsoft XNA and Visual Studio 2010 . Rob Miles University of Hull Microsoft MVP. Agenda. Mobile Gaming The Windows Phone as a gaming platform Hardware highlights Introduction to XNA Realizing your gaming ideas in software Creating games
E N D
WPH307: Building Windows Phone Games with Microsoft XNA and Visual Studio 2010 Rob Miles University of Hull Microsoft MVP
Agenda • Mobile Gaming • The Windows Phone as a gaming platform • Hardware highlights • Introduction to XNA • Realizing your gaming ideas in software • Creating games • Phone features that make games great • Getting Rich and Having Fun
GAMING GOES MOBILE • Mobile gaming has come a long way from “Snake” • Phone owners now expect to have a mini version of their console in their pockets • Fortunately Windows Phone is able to deliver this • You get a great place to write games • You get a way to make money from your work
The Windows Phone Hardware Display 480x800 QVGA 320x480 HVGA Multimedia Common detailed specs Codec acceleration Capacitive touch 4 or more contact points Memory 256MB RAM or more 8GB Flash or more Sensors A-GPS, Accelerometer, Compass GPU DirectX 9 acceleration Camera 5 mega pixels or more Dedicated camera button CPU ARMv7 Cortex/Scorpion or better 1G Hardware buttons Start, Search, Back
Windows Phone as an xna platform • Windows Phone is a great platform for games • Performance is impressive, especially in 3D • Hardware based graphics acceleration • There are some very interesting input options • You can use all the hardware and sensors in your Windows Phone games • Potential for Xbox Live integration • Support for Avatars and Achievements
Reasons not to write a game • Phones have poor performance for games • Development is difficult • It is expensive to get started • It is hard to test the games • I can’t use any of my existing code • I have to write a special version of the game for every phone • It is hard to get rich
Reasons not to write a game • Windows Phones have snappy processors and 3D acceleration • Development is difficult • It is expensive to get started • It is hard to test the games • I can’t use any of my existing code • I have to write a special version of the game for every phone • It is hard to get rich
Reasons not to write a game • Windows Phones have snappy processors and 3D acceleration • It is as easy to use as Visual Studio. And that is really easy. • It is expensive to get started • It is hard to test the games • I can’t use any of my existing code • I have to write a special version of the game for every phone • It is hard to get rich
Reasons not to write a game • Windows Phones have snappy processors and 3D acceleration • It is as easy to use as Visual Studio. And that is really easy. • Zero cost to get started and $99 to join the Marketplace • It is hard to test the games • I can’t use any of my existing code • I have to write a special version of the game for every phone • It is hard to get rich
Reasons not to write a game • Windows Phones have snappy processors and 3D acceleration • It is as easy to use as Visual Studio. And that is really easy. • Zero cost to get started and $99 to join the Marketplace • Full emulator support and in device debugging • I can’t use any of my existing code • I have to write a special version of the game for every phone • It is hard to get rich
Reasons not to write a game • Windows Phones have snappy processors and 3D acceleration • It is as easy to use as Visual Studio. And that is really easy. • Zero cost to get started and $99 to join the Marketplace • Full emulator support and in device debugging • Easy to reuse code and assets from PC and Xbox 360 projects • I have to write a special version of the game for every phone • It is hard to get rich
Reasons not to write a game • Windows Phones have snappy processors and 3D acceleration • It is as easy to use as Visual Studio. And that is really easy. • Zero cost to get started and $99 to join the Marketplace • Full emulator support and in device debugging • Easy to reuse code and assets from PC and Xbox 360 projects • Hardware scaling fits your game on any display size • It is hard to get rich
Reasons not to write a game • Windows Phones have snappy processors and 3D acceleration • It is as easy to use as Visual Studio. And that is really easy. • Zero cost to get started and $99 to join the Marketplace • Full emulator support and in device debugging • Easy to reuse code and assets from PC and Xbox 360 projects • Hardware scaling fits your game on any display size • Windows Marketplace gives you a direct path to market
Reasons to write a game • Windows Phones have snappy processors and 3D acceleration • It is as easy to use as Visual Studio. And that is really easy. • Zero cost to get started and $99 to join the Marketplace • Full emulator support and in device debugging • Easy to reuse code and assets from PC and Xbox 360 projects • Hardware scaling fits your game on any display size • Windows Marketplace gives you a direct path to market • Windows Phone makes it really easy to get into games
A word about Silverlight • Some kinds of games work really well in Silverlight • Word games, puzzle games, board games • Any game that requires a lot of complex user interaction will be easier to build in Silverlight than XNA • In XNA you would have to build all the components that make up the user interface • In Silverlight you get all these for free • If you want to make these kinds of games, take a look at Silverlight – especially if your background is WPF or Windows Forms
Quick Overview of XNA • The XNA Framework provides everything you need to get started writing games: • Full Content Management (integrated into Visual Studio) • Support for 2D Sprite-based gameplay • Support for 3D games • Common behaviours across the Windows PC, Xbox 360 and Windows Phone • One game engine can run on all platforms • Well factored object model
2D Games on Windows Phone • It is very easy to create 2D sprite based games using XNA • The Windows Phone hardware is very good at performing fast 2D texture drawing and scaling • Games can also transform and render 2D panels into a 3D environment to get a 3D appearance • You can also use parallax scrolling to get impressive looking 3D effects in games
Demo 1: Starlight Rob Miles demo
3D on Windows Phone • The phone has very good 3D support • This includes a powerful Graphics Processor Unit (GPU) • You can’t write your own shaders as you can with Xbox or Windows PC XNA • There are 5 shader effects supplied which have been optimised for phone use • A great deal of care has been taken to balance performance and battery life
Demo 2: 3D Rocket Rob Miles demo
Windows Phone Features • An XNA game can access many Windows Phone features • Touch Panel can register and track touch events • Will automatically recognise gestures such as tap, pinch and flick • Accelerometer • Three axis accelerometer that can take the place of a gamepad • Phone devices • Can interact with the phone and camera from within a game • Media • Can load and use music from the media library
Demo 3: Picture Jiggler Rob Miles demo
Using the Windows Phone Media • XNA games have direct access to the Windows Phone media content • This includes pictures taken with the camera and all the music on the device • This access even includes the album art on music • It is very easy to use this in games
Demo 4: Album Shower Rob Miles demo
Making music with Multi-touch • XNA programs have easy access to the information from the touch panel • Each touch event is given a unique ID over its lifecycle • There is also gesture detection built in • It is very easy to use touch as a replacement for gamepad control, or as a new input device in its own right
Demo 5: Windows Phone Piano Rob Miles demo
Breaking out of the sandbox • If you have written XNA games for Xbox 360 you will know how “sandboxed” they are on that platform • On Windows Phone a game can make use of underlying network abilities of the phone, along with location information and all the other device features • An XNA game is at the same level as any other program on the phone • Games can use web scraping and data sources such as RSS feeds as part of their gameplay or you could write completely new kinds of application
Demo 6: Twitter Banner Rob Miles demo
Creating XNA Games for Windows Phone • The game creation process is exactly as for Windows PC or Xbox 360 • Create the games using Visual Studio 2010 and deploy to your target • Desktop emulation of Windows Phone hardware functionality • Can create multiple versions of projects for the different platforms in the same project • Most XNA 3.1 games will migrate with no problems • If you are an experienced XNA developer your code should be easy to port onto a phone
Creating Phone Games • Creating phone applications is not quite like writing programs for other platforms • It is unlikely that the battery in an Xbox will go suddenly go flat or that another program will kick yours off a Windows PC • Games must be “well behaved citizens” on the Windows Phone platform • This means that they must be adept at storing the game state and resuming from saved status information • A game has access to isolated, persistent storage it can use to store this
Getting Started for free • The Windows Phone SDK is a free download and gives you everything you need: • Visual Studio 2010 Express for Windows Phone • Windows Phone Emulator Resources • Silverlight 4 Tools For Visual Studio • XNA Game Studio 4.0 • Microsoft Expression Blend for Windows Phone • The Windows Phone SDK will also install alongside existing paid versions of the tools
Visual Basic and C# • The original version of the Windows Phone SDK used C# as the development language • A Visual Basic version of the environment is now available • Released as a CTP • Installs into the Windows Phone Developer tools • You can use other languages too, as long as they are compiled into Microsoft Intermediate Language (MSIL)
Games and Applications • Programs are loaded onto the phone from the Marketplace over the air (WiFi or 3G) or via the Zune application • These are the only ways to get software onto a “locked” device • Registered developers can unlock a device to test their code
Joining the Marketplace • If you want to take your games to market you will need to join the Windows Phone Marketplace as a developer • This is managed via your Windows Live identity • It costs $99 per year • Students can get free membership via DreamSpark • Joining the Marketplace lets you publish games and unlock Windows Phone devices for testing • Developers can unlock up to three devices • Students can unlock just one
Free and Trial Applications • You can give away up to five applications each year you are member of the Marketplace • Any further free applications will cost $20 each for validation • You can also make available “trial” versions of a game or application • Customers can purchase an upgrade from within the application
Submitting Applications • You are guided through the submission process for your application • The application itself is submitted as a single “xap” file • This is an archive with a manifest which is generated by Visual Studio when the game is built • It contains all the game content and resources
Application Approval • The application process is “semi-automatic” • Checks for application pre-requisites and code behaviours along with a review of the program itself • Each developer has a dashboard that keeps them informed of the progress of each submission • You can submit upgrades at no cost • The submission guidelines give a lot of help to ensure that your submissions have the best chance of succeeding • You must read these before sending a game for approval
Making Money • Marketplace publishers get 70% of the price paid for the games • This is paid once you have earned at least $200 • If you are not from the US you will have to fill in a US Tax Waiver form and fax it to the Windows Marketplace team • You can still submit applications for sale before you have sorted this out
Having Fun • Writing applications that run on your phone is great fun • I think it is worth the Marketplace membership just to get the ability to do this • You can take any very silly ideas that you have and make them into programs you can carry around and use to impress people • Making money is just icing on the cake
What to do next • Download the developer tools from http://create.msdn.com • Download the sample code from: http://robmiles.com • Watch the Jumpstart videos • Register as a developer • Start making money and having fun! • Attend: • WPH310 Giving your Windows Phone XNA Games Plenty of Whizz and Bang : Thursday 9:00
Win an HTC WP7 device! • Visit the Windows Phone 7 stand in the TLC • Leave your details to enter the draw • Wednesday, Thursday: prize draw at 5.15pm • Friday: prize draw at 1pm. • Winners will be notified by email Four devices to be won. One per day.
Windows Phone 7 Developer Mixer in Berlin! • Wednesday 7pm-9.30pm • Meet the WP7 team • Bring your app to demo • One HTC device to be won • Buffet dinner + hand-brewed beer Limited numbers. Pick up your invitation at the WP7 Stand in the TLC.
Session Evaluations Tell us what you think, and you could win! All evaluations submitted are automatically entered into a daily prize draw* Sign-in to the Schedule Builder at http://europe.msteched.com/topic/list/ * Details of prize draw rules can be obtained from the Information Desk.
© 2010 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.