Tuesday, February 21, 2012

MonoGame: Getting Started 1/3

In this post I will give a short walk-through on how to port your existing XNA game to iOS and Android using MonoGame. MonoGame is an open source implementation of the XNA framework. To keep things simple you should start with a simple 2D game
MonoGame is based on Mono, so you need to install Mono first. For iOS and Android you need the Mono libraries MonoTouch and/or Mono For Android from Xamarin. For MonoTouch you need an Apple PC. To write the source code you will use MonoDevelop. For Mono For Android you can choose to use either an Apple PC or a Windows PC. On Apple you again have to use MonoDevelop. On Windows you can choose between Visual Studio or MonoDevelop. Unfortunately Visual Studio Express will not work as it does not support plug-ins.

You can get evaluation versions from Xamarin here:

MonoTouch for iOS:
Mono For Android:

To install these please follow their installation documentation.
MonoTouch install:
Mono For Android install:

You will also find a lot of useful tutorials and an API reference on their webpage.

Now you are ready to start with MonoGame. First get the following downloads.

Download MonoGame (currently 2.1) from here:
You could also get the source of the developer branch from their GitHub repository but I recommend starting with the stable download version.
Second get the samples from their GitHub:

After you extracted the MonoGame source to an appropriate path on your computer, you are ready to go.

MonoGame does not come with a script that will convert your project file automatically, so you have to do this by hand. Basically you have to create a solution and project file for iOS and Android each. The best way to create these is to take these files from the MonoGame sample applications and edit them in a text editor. But before doing this you should make sure that these run fine.
Therefore open an iOS and/or Android sample project and run them in the emulator. Make sure that all references to Mono and MonoGame are correct. Once the sample runs, you are ready for the next step.
I recommend creating a new directory for each platform to keep things more clear. A directory structure for a typical XNA game then may look like this:

MyGame +-MyGameContent
         +- Properties
       +- MyGame.android

I keep the WP7 default directories for the project and content and then add additional directories for iOS and Android. Inside each platform directory I then create an additional content directory. For Android this has to be inside an directory called Assets.


  1. help! for some reason I have a hard time finding and setting properly all the necessary references! Could you help me ? :)

    Thank you for this very appreciated article by the way.


    1. Check this https://www.youtube.com/watch?v=-ycmeVYm_gI video it might help you :)

  2. Wonderful blog & good post.Its really helpful for me, awaiting for more new post. Keep Blogging!

    game app developer