Sign up ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm researching Monogame. Their goal is to allow "easy" porting of an existing XNA/Windows game to mobile.

Does this mean you can have one solution (theoretically) with shared code, and it works on all three platforms (PC, Android, iPhone)? Or do you need to port your game from PC to Android, and then again to iPhone?

I'm sure "write once, run anywhere" works 80% of the time, I'm not worried about that other 20% like support for GPS, acceleratometer, etc. which doesn't exist on all platforms.

share|improve this question
Not a real answer and I've never tried MonoGame, but take a look at the Delta Engine. – NKnusperer May 30 '12 at 7:35

1 Answer 1

up vote 2 down vote accepted

You can keep all your code in one solution and most of the code will only have to be written once and work on all platforms.

Here's the catch, you need to create a new project per platform. For example you might have YourGame.Core, YourGame.Android and YourGame.Windows. Code that is shared between projects can live in the Core project and be added to the platform specific projects as linked files. It's a bit a maintenance pain, but not as much as you might think. Many developers have reported that they setup a project for a new platform in around 15 minutes once they have the windows one working.

The reason for this pain stems back to the ability to have a single project targeting multiple frameworks. For example, you can create a project that targets Mono / .NET 4 and a different project that targets Android 2.2. Each project can contain identical code, but there's currently no way to target both frameworks at the same time within the same project.

This problem is not isolated to Mono and has also been reported when people are developing for Microsoft specific platforms like Windows Phone and Silverlight.

There is a better solution in the works called Portable Class Libraries. The idea is that you can have all of your core code in a single project and simply reference the DLL in each of your other projects.

It looks like Mono has at least partial support for Portable Class Libraries according to the Mono 3.0 release notes, but I haven't tried it yet.

share|improve this answer
It's not that bad - you just basically put a few lines in each and call a few init functions. The rest, if done with careful defines in your code, like IF #MOBILE; will make porting realtively painless. – Vaughan Hilts Nov 7 '12 at 7:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.