Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Building your First Mobile Game using XNA 4.0

You're reading from   Building your First Mobile Game using XNA 4.0 A fast-paced, hands-on guide to building a 3D game for the Windows Phone 7 platform using XNA 4.0

Arrow left icon
Product type Paperback
Published in Jan 2013
Publisher Packt
ISBN-13 9781849687744
Length 158 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Thomas Goussaert Thomas Goussaert
Author Profile Icon Thomas Goussaert
Thomas Goussaert
Brecht Kets Brecht Kets
Author Profile Icon Brecht Kets
Brecht Kets
Arrow right icon
View More author details
Toc

Developing for Windows Phone


Let us start by talking about the Windows Phone platform itself. All Windows Phone devices have minimum sets of hardware they have to comply with. This includes three buttons: start, search, and back, a resolution of 480x800, a touch screen, an accelerometer, and more. The list of specifications can be found at http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff637514(v=vs.92).aspx.

With the launch of Windows Phone 7 back in 2010, Microsoft offered two possible ways to develop applications for Windows Phone. The applications we write must be developed using either Silverlight or XNA Game Studio 4.0. Both Silverlight and XNA are powered by the .NET framework. This means we can develop apps for Windows Phone using managed programming languages such as C# (version 3). This book will only cover XNA development, as this framework is very suitable for developing games. We won't be discussing Silverlight.

But first, what is XNA? XNA is a managed framework which runs on top of the .NET framework. It enables us to build games for Windows, Xbox 360, and Windows Phone, with limited adaptations to the source code when switching to another platform. Because it runs on top of the .NET framework, you can use VB.NET or C# as programming languages. In this book, we will use C# and won't cover VB.NET.

What makes XNA interesting in terms of game development is that it takes care of the boring stuff (initializing and maintaining the graphics device and setting up your render loop for instance) for us; this enables us to skip the boiler plate code and focus on the interesting part, being our game.

XNA Game Studio 4.0—the development environment for XNA—is part of the Windows Phone SDK. This toolset is an extension for Visual Studio 2010, and is available for free. Using XNA Game Studio 4.0, you can develop XNA games for Windows Phone (amongst others), and deploy to an emulator or an actual Windows Phone device. However, when you want to deploy to an actual device, the device has to be registered. To register your Windows Phone, you need a valid Dev Center Developer account, which costs $99 annually—unless you are a student. Students can get a free (limited) developer account through www.dreamspark.com. A valid Dev Center Developer account will enable you to create games for and deploy them to Windows Phone. This does not include deploying to Xbox 360.

Installing the Windows Phone SDK

Let us start by installing all the software we need. XNA Game Studio 4.0 (our development environment) is part of the Windows Phone SDK. You can download the latest version from https://dev.windowsphone.com/en-us/downloadsdk. At the time of writing, the most recent version is 'Windows Phone SDK 7.1'. The setup will install the following applications:

  • Microsoft Visual Studio 2010 Express for Windows Phone

  • Windows Phone Emulator

  • Windows Phone SDK Assemblies

  • Windows Phone SDK Extensions for XNA Game Studio 4.0

  • Microsoft Expression Blend SDK for Windows Phone

  • Silverlight 4 SDK and DRT

  • WCF Data Services Client for Windows Phone

  • Microsoft Advertising SDK for Windows Phone

Note that all these applications will enable you to build applications for Windows Phone 7.0 and Windows Phone 7.5. The tools we will use are the Windows Phone Emulator and XNA Game Studio 4.0.

When you already have a version of Visual Studio 2010 installed (Professional for instance), the add-ins for this version will be installed automatically. Make sure you have all service packs installed for that installation version.

After installing the SDK, make sure you install the latest update. This can be downloaded from the same location as the SDK. At the time of writing, the latest update is 'Windows Phone SDK 7.1.1 Update'.

Registering your Windows Phone

To be able to deploy games to our Windows Phone, we need to register the device. There are three prerequisites:

  • Obtain a Microsoft account if you don't have one. This can be done through www.live.com.

  • Create a valid Dev Center Developer account (if you don't have one). This can be done through https://dev.windowsphone.com/en-us/join. An Dev Center Developer account costs $99 annually, and it will enable you to deploy games to Windows Phone.

  • If you are a student, you can register for free using a valid DreamSpark account. Go to www.dreamspark.com to register. Your university/school representative can help you out here.

  • Install Zune from www.zune.net.

Once the above is taken care of, we can start registering our Windows Phone. Start by making sure that the date and time are correct and connect your phone to your PC using the USB cable. Zune will start automatically. If it does not start, we need to start it ourselves. If everything went okay, the phone will appear in the 'Device' tab of the Zune software. On the first run, this might take a few minutes, while Windows installs the drivers for the phone.

Next we can open the Windows Phone Developer registration tool we can find by clicking Start | All Programs | Windows Phone SDK 7.1. Once the application has started, you should see the following window:

Once the status says Phone ready, register using your Microsoft account.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image