MonoGame – Getting Started.

I’ve spent some time this week learning more about MonoGame and testing it’s feasibility for use in Slug Chronicles. Needless to say, at this point in time MonoGame is receiving a serious amount of developer love from it’s contributors. I’m guessing that my approach to this has been a bit off the beaten path because I’ve had some trouble getting everything to play nice. I originally planned to do a lot of my core development on my Mac using MonoDevelop as my main IDE, as it turns out this probably isn’t the best approach. I finally did get most things working though and I’ve started experimenting with different project setups.


I started by heading over to and seeing what was available. Basically, if your on Windows installation is a snap. Simply grab the latest installer and off you go. If your on Mac it’s a little different. There is no installer that will get your templates and other goodies set up so you need to do a bit of the heavy lifting. There are some instructions on manually setting up your Xamarin addins in the ProjectTemplates/MonoDevelop folder if you choose to go that route.

I have an existing XNA game – Krisotron – so I decided that getting that to work on my Mac would be a good test. In short, I was able to get most things working pretty quickly. The biggest hurdle was getting the assets compiled for Mac. After some reading, trial and error, and frustrations I found that the easiest way to go about this is just simply setup a MonoGame content project (available template after you use the MonoGame installer) on Windows and build for the platform you want. The only thing I wasn’t able to get working was my music. My original sound files are mp3, I tried leaving the mp3 in the content folder, building mp4’s, wma’s, etc… It just doesn’t work for whatever reason. If anyone has any idea how to get this to work properly please let me know. I haven’t tried porting to iOS yet, but I have a feeling that will work with raw mp3’s.

While working on my sound issue I remembered that Bastion was built using MonoGame, I decided to have a peak at their MonoGame DLL on Mac to see if I could find any hints of how exactly the got their music to work. Turns out, the replaced all of the sound code with FMOD. A very good choice. It would be nice if sound became a pluggable component to monogame which would ease a lot of the platforms head aches that I’m reading about since most of the issues revolve around supported sound formats. Being able to swap a default implementation for something like FMOD would be awesome. As of right now, I havent been able to use MediaPlayer.Play( Song ) successfully on Mac. I plan to address this once I’ve figured out the best way to layout these projects.

I decided to dig a little deeper and test exactly how much effort it would take to setup a project that would be deployed on Mac, iOS, Windows, PS4, and Android. This is what I have so far. I setup my main repository with the following folder structure.

  • /assets – Folder for raw asset files, fbx, psd files, marketing art, etc..
  • /src – Folder for all source code. Contains 1 solution per platform. SlugChronicles.Android.Xamarin, SlugChronicles.Win.VS2010, etc…
  • /src/SlugChronicles.Assets – For compiled and ‘ready to compile’ assets
  • /src/SlugChronicles.Assets/Compiled – Compiled assets (xnb)
  • /src/SlugChronicles.Assets/Content – Raw content ready to compile
  • /src/SlugChronicles.Assets/SlugChronicles.Win.Content – The windows content projects are in this directory and are setup to spit out the xnb files into the Compiled folder. The Compiled folder has subfolders for each of the platforms and then those Content folders are symlinked to the projects.
  • /src/SlugChronicles.Clients/{PLATFORM} – One project per platform. Contains minimum source code to insatiate Game Class contained in gamelib.
  • /src/SlugChronicles.GameLib – This folder contains one csproj per platform, and all of the source files. Platform specific files will go in folder with platform name.
  • /third_party – This folder contains git submodules for MonoGame, MonoGame PS4, etc..

One note about the third_party folder. I found it’s easier to have 2 submodules. One for the master branch, and another for develop. Switching between branches might kill files that you modified or mess up generated files created by ProtoBuild. This just makes it easier to manage for me. In each of the solutions I’ve also included solution folders for project references to either master or develop. One of the main reasons I employed this strategy is because I wanted to try all of the latest develop changes but for some reason develop doesn’t currently work on MacOS. There is a “GL.GetError() returned InvalidFramebufferOperationExt” error… some google searches didn’t yield any reasonable fixes so for now on MacOS I will stick with the stable master branch 3.2 release. On windows I plan to use the develop branch since that seems to have a lot more eyes on it at this time, hopefully in the future when I’m more familiar with the internals I’ll be able to contribute any fixes that may be needed for MacOS I’m just to inexperienced with MonoGame and it’s goals at this point to be of any use.

Setting up the platform specific projects is a snap once you get the hang of it. I decided to forgo the whole Xamarin add-in and just do it manually using the project template xml files as a guide to what was needed. Since I’m using project references to link against MonoGame as opposed to using pre-built DLL’s the add-ins aren’t really needed. I do recommend getting the project templates for Visual Studio since setting up the content project manually could be a pain.

I’m not happy with the way the content workflow stuff is working right now. I may decide to build something around MGCB.exe which is in the Tools folder and can be used to build content straight from the command line, it supports all of the same platforms MonoGame support and for the most part works on Mac although except for converting mp3’s it converted all of the resources I threw at it. Someone is currently building a GUI tool based around MGCB so this could be a promising solution in the future.

Let’s talk a bit about costs, MonoGame is 100% free but this is a bit misleading since it requires a Mono implementation for the target platform and that seems to be currently by Xamarin. Comparing it to other frameworks competing in the cross-platform arena the prices are fair. You’ll need to purchase their Mono implementation for iOS, Android, PS4, and Mac (this is only required if you want to deploy to the mac Appstore). Each of the can be had for under 300 with the exception of PS4 which is more expensive but within reach for indies unlike Unity which will costs you tens of thousands more.

Overall I think MonoGame is a viable game platform as evidence by the list of titles released using it. It will require a bit of tweaking to get it to work perfectly for all your target platforms but nothing that can’t be overcome. I think as MonoGame matures it will only get better.



Share Button


  1. Kim Spillner says:

    Hi, I can’t seem to figure out how to add the MonoGame templates to the new XamarinStudio 5. Any hints on how to get it working there?

Speak Your Mind