Starting game development for the Windows Phone 7 Platform

Since I’ve tackled getting up and running on the iOS platform in my previous post in this “Developing a game for the iOS and Windows Phone 7 Platforms at the same time” series, I’m now moving onto getting started with Windows Phone 7 game development. Like the previous post, the aim of this one is to have you up and running with a basic skeleton that we will build upon over the coming weeks.

Getting the tools

Unlike iOS development, the tools for WP7 are free. You still need to pay Microsoft money to have your app published on the app store, but to actually get started, you don’t need to spend anything.

  • Visual Studio 2010 Express for Windows Phone Microsoft have made a special version of their excellent Visual Studio IDE available to download for free. This version doesn’t come with all the tools and features of the commercial versions, but we don’t need anything like that. To make live a little easier, Microsoft has a full package called Windows Phone Developer Tools, which you can download. This contains almost everything you’ll need. It’s a small download that will download and installed the tools.
  • Farseer Physics Engine – The Farseer physics framework will provide us with a powerful physics engine needed to drive our game. Download Farseer Physics Engine 3.3 XNA, the current stable release. Install it once you’ve installed the Windows Phone Developer Tools

I’ve got it all installed

Once you have everything installed, launch Visual Studio and start a new project (File->New->Project). In the New Project dialog, select the Windows Phone Game (4.0) project under the XNA Game Studio 4 Template group. Name the project “Windows Phone 7 Game” and change the location if you wish. I typically keep all my code under a directory called “Development”. It makes things easy to find.


You’ll end up with a new Solution and the very basic elements for a Windows Phone 7 Game.


Hit F5 to build and run the project. If you see an error dialog popping up, check that the Error List. If it says “Zune software is not launched. Retry after making sure that Zune software is launched.” then ensure that “Windows Phone 7 Emulator” is selected and not “Windows Phone 7 Device”. This setting is in one of the toolbars along the top. This setting controls how the game is executed. We’re using the Simulator tool for now.  If you’ve had to change this, hit F5 again.


The WP7 simulator will launch and you’ll be presented with a blue screen. Don’t worry, this is all it is supposed to do right now.


Adding some physics

We will now include the Farseer framework into our project and stop there. Once you’ve downloaded the Farseer Physics Engine 3.3 XNA zip file, open it. It will contain a folder Farseer Physics Engine 3.3 XNA. Copy this folder from the zip file and paste it in the same location as your Visual Studio Solution file. In my case, this would be D:DevelopmentWindows Phone 7 Game. By copy the framework here, it lets us keep all our code together. Very important when we add this solution to source control.

Return to Visual Studio, which should still contain your Windows Phone 7 Game solution. If the Solution Explorer, a tree view showing all the projects and files in your solution, is not open within VS, open it using the menu View->Show Solution Explorer. Within the Solution Explorer, right click on the Solution at the very top and choose Add->Existing Project.

An Explorer windows will appear. Simple navigate to where you pasted the “Farseer Physics Engine 3.3 XNA folder”, open it and find a file called “Farseer Physics XNA WP7.csproj”. Select this file and choose Open. It should now load this project into your solution.

Visual Studio might prompt you with Security Warning.  Since we trust this Project, click Okay. In future, Visual Studio might display the same prompt when you open your solution, but just click okay.


Now that the project has been added, your Solution Explorer should look like this:


Hit F6 to build the solution, or use the menu Build->Build Solution. Everything should compile successfully.

Finally, we will include a reference to Farseer Physics project in our Windows Phone 7 Game. This basically lets one project use the classes and information in another. Right click on the Windows Phone 7 Game project and click Add Reference. Use the Projects Tab in the window that appears.


Choose the Farseer Physics XNA WP7 project and hit okay.

Hit F6 to build one final time and, if you wish, you can run the project again. The Simulator should still open with the same blue background since we haven’t really changed anything. However, we have now got a skeleton Windows Phone 7 project with a physics engine that we can build upon!

The next article or two will cover the construction of a physics world within the game. Stay tuned. Same bat time, same bat channel!

Starting game development for the iOS platform

This is the first post in my “Developing a game for the iOS and Windows Phone 7 Platforms at the same time” series. Yes, I am trying to think of a catchier name. Anyway, let me get on with it. This post will cover, as the title suggests, getting ready for developing a game on the iOS platform. At the end, you’ll have the basic Cocos2d game up and running.

Getting the tools

Before you can begin writing any code, it’s necessary to get your hands on the development SDK. Apple’s IDE is called XCode 4 and this include the iPhone SDK. There are two ways to get XCode 4.

  • If you are a member of the iOS Developer Program, you can download XCode 4 for free. Obviously, this isn’t really free since you have to pay the $99/£69 membership fee. However, if you’re serious about developing for the iOS platform, this is money well spent. You’ll need to join this to test your apps on a real device and to publish it. I would like to point out this is an annual membership, so you’ll have to cough up the money each year.
  • If you’re not willing to spend so much dough up front, that’s okay too. XCode is available to download from the Mac App Store for the small sum of $4.99/£2.99. You’ll need to join the afore mentioned iOS Developer Program in order to publish your app, so you’ll be paying a little more overall. As I mentioned, not joining the Developer program means you can’t run your app on a device, so you’ll be limited to the simulator. This will become important when it comes to testing the real world performance of your game.

I have XCode 4. Now what?

After downloading it (it’s a whopping 4GB) and installed it, you’ll need to get your hands on the Cocos2d framework. As I discussed in my initial post, this is a game development framework, that includes a powerful physics engine called Box2d. There are two downloads to make. The first is the framework itself. I’m using the 1.0.0 Beta version. You can then download XCode 4 templates. The installation of these adds some special project templates to XCode and this helps speed up development by giving you a simple, pre-canned game.

All done? Comfortable? Let’s begin!

First, fire up XCode 4. You’ll need to use Spotlight to find it, but keep in the dock after it launches. On a fresh installation, you won’t have any “Recent” projects.

XCode Welcome Screen

Select “Create a new XCode project” from the “New Project” dialog, select the cocos2d category from the iOS list on the left hand side. You should see the list of possible templates. Since I’m going to use Box2D, select that one and hit “Next”

Select project type

Next you’ll be asked to enter the name of the App and the “Company Identifier”. For this, I just use my name, so enter yours here. I’m also calling the game “Bouncy”. Don’t worry about this right now as it doesn’t have to be the actual name of your app when you come to publish it. The “Bundle Identifier” value is made up of this name plus your company name and you’ll need this later on so you can put your app onto a real device and eventually publish your app.

Enter name and bundle information

Next you need to choose where to save the XCode project files. Choose a location that’s suitable. I typically create a folder called Development under my home account and put my project there. This way there are in one place. XCode should then present you with the created project, all populated with the necessary files.

Project created and ready to go!

Use the “Run” button or CMD-R to execute the project. XCode will start compiling the files, which can take a few seconds depending on your machine. It will then launch the iPhone Simulator and you should see something like this after the splash screen disappears. As it says, tap the screen a few times using the mouse pointer.



Well done! You should now have a working iPhone game, albeit a simple, demo one. The steps in this post have essentially setup XCode and a basic game shell that we can build our actual game upon. In the next few posts, we’ll look at creating a world that has some basic physics and populating that world with some sprites and finally creating a level that is playable.