This series will consist of several parts where I will try to explain the steps you need to take in order to develop a simple 2D game for Windows 8 that can be published to the Windows Store.

Part One – Preparation

Part Two – Drawing Sprites

Part Three – Game Logic

Part Four – Polishing

XNA is a great framework for beginners and you can easily and quickly develop little games or prototypes. You can also develop more serious and complex games like Fez, Terraria, Bastion etc. Unfortunately, Microsoft decided not to continue their active support, so the games created with XNA cannot be published to the Windows Store. On the other hand, the ordinary desktop games work just fine. Because of this, I had to look for other alternatives.

MonoGame is an open-source implementation of the XNA Framework, mainly created for XNA users so they can port their games to other platforms such as iOS, Android, Mac etc. Thanks to Tom Spilman and James Ford from Sickhead Games, and few other talented developers, MonoGame now supports Windows 8. The games that are created with MonoGame can be published to the Windows Store. In this series, I will use MonoGame to show you how you can create a simple Pong clone which is considered the “Hello World!” of Game Development 🙂

There are other alternatives for developing Windows 8 games that can be published to the Windows Store such as HTML5/JavaScript or DirectX.

             

Preparing the System

Before moving to the set up of MonoGame, first we need the following:

  1. Windows 8 (Release Preview can be downloaded here)

You are probably wondering why you need Visual Studio 2012 for Windows Phone. XNA has a Content Pipeline that is used to compile all the assets for your game (sprites, models, sounds etc.). This Content Pipeline is not yet implemented in the Windows 8 version of MonoGame, so you will need to first compile the external assets in Visual Studio 2012 for Windows Phone (that supports XNA) and then copy the resulting .xnb files to your Visual Studio 2012 for Windows 8 project. I will talk about this in detail in one of the upcoming parts in this series.

If you already have Visual Studio 2012 Professional or above, you will need to install Windows Phone 8.0 SDK in order to create an XNA Windows Phone project for the assets.

If you get stuck somewhere, leave a comment below.

MonoGame Set up

You can choose between two approaches in order to install MonoGame. The first one is to download the MonoGame installer from here. The second one (which I will explain in detail in this post) is via a Git repository. Why the second approach? Well, compared to the installer, the Git repository is updated more often with the latest bug fixes and new features.

For this part, you will need a Git client. I am using TortoiseGit because it is pretty simple. If you prefer another client, feel free to use it.

  1. Download and install TortoiseGit
  2. Download and install Git

After completing the installations, you will need to clone MonoGame. To do that, first navigate to a directory of your choice where you will download all the necessary files. I will clone it on my Desktop.

Note: The complete clone has StarterKits and Sample projects, therefore it is about 1.6GB.

Right click on a blank spot on the desktop, and then click on Git Clone…

Paste the following address in the URL field: https://github.com/mono/MonoGame

Check the Recursive checkbox and click OK.

Now, you will have to wait a while until the cloning process is complete. As I said earlier, the clone weighs about 1.6GB

Creating and Installing a MonoGame Template in Visual Studio 2012

After the cloning process is done:

  1. Open the MonoGame folder and navigate to ProjectTemplates\VisualStudio2012\Game
  2. Select all files inside and create a ZIP file.


  3. Copy the ZIP file to the Visual Studio 2012 Visual C# Templates directory: C:\Users\yourUsername\Documents\Visual Studio 2012\Templates\ProjectTemplates\Visual C#
  4. Optional: If you also want the XAML template, do the same thing for the files in the XamlGame folder: MonoGame\ProjectTemplates\VisualStudio2012\XamlGame


Testing MonoGame

  1. Launch Visual Studio 2012 for Windows 8 (or Visual Studio 2012 if you have Pro or above) and create a New Project.
  2. Under Visual C#, you should now have MonoGame template(s). Pick the Game template and click OK.


  3. Because the template is the same one that is installed via the installer, the Path values of the references lead to wrong directories. Select the references as shown on the image below and delete them:


  4. Right click on the Solution –> Add –> Existing Project.


  5. Navigate to MonoGame\MonoGame.Framework and add MonoGame.Framework.Windows8.csproj to your solution.


  6. Now you need to reference the MonoGame project that you just added. Right click on References (in your project) and click Add Reference…


  7. On the left side, pick Solution –> Project and check the checkbox as shown on the image below:


  8. Press F5 to compile and run the project. If you see a Cornflower Blue screen, you have successfully set up MonoGame.

If you have any problems, leave a comment below.

In the next part, we will start with the development of Pong.

 

Advertisements