I love coding little apps for my phone and (hopefully soon) tablet. The project I am working on now is porting a simple Snooker game I wrote using DirectX and C++ nearly a decade ago over to Windows 8 and Windows Phone devices.

My initial plan was to just copy my C++ code to a Direct3D project, tweak a few things and see it run. An overly optimistic goal, given my rusty C++ skills and the fact that DirectX API has evolved a lot since DirectX 8. So I started looking for alternatives that would get me to my goal quicker (I like to keep my hobby project short). If XNA had support on Windows 8 and Windows Phone 8 devices I would go with that one, but since they are not I started looking at MonoGame which is an open source implementation of XNA API. And it is awesome.

To get started you need to get MonoGame source code from GitHub by cloning the repository. The source contains VS2012 templates, copy these over to your templates folder and you are ready to start coding with MonoGame. For more details on how to do this follow instructions at bob’s blog. But you will need to (or can) do certain things differently!

First, MonoGame project has evolved a bit since and now you will have three VS2012 templates in there:

  • Game is the one you want to use if you are writing a game using MonoGame only,
  • XamlGame is a combination of MonoGame and XAML and
  • WindowsPhone is obvious

Secondly, before you can load your mesh models into your game you need to convert them into XNB file format, but at the moment there are no Content Importers in XNA. So you will need to use project templates that come with XNA Game Studio in order to convert the models to XNB format. There were some issues with installing XNA on Windows 8 in the past (see Aaron Stebner’s WebLog) but if you install Windows Phone 8 SDK it installs without a problem and you can use XNA Content project from VS2012. Then create a “Content” folder within your MonoGame project and copy XNB files in there (mark them as Content in properties and make sure they are always copied to output directory). I believe you could tweak the location by changing the line below in your Game class:

Content.RootDirectory = "Content";

This should have you ready and going. As for myself, I have this after one day:

Snook