Introduction to MonoGame
If you are not familiar with XNA though, it is basically a game development framework that allows for creating games quickly without having to write all that repetitious code that all games need.
Basically it makes creating games more about the game and less about the technical details.
The only problem with XNA is that it only really works for Windows, XBox360 and Windows Phone 7. If you want to create a game on Android and iOS, you can’t use XNA.
This is where MonoGame comes in. MonoGame is an open source port of the XNA framework that can run on many more platforms that Microsoft’s XNA.
Great, so what does this actually mean?
Well, if you are interested in game development, especially if you are interested in game development for the most popular platforms today, MonoGame might be able to help you to write pretty close to the same exact code and have it work on Android, iOS, Windows 7, Windows 8, Windows Phone 7, MacOS, XBox 360, Linux and the new Playstation console.
That is pretty awesome! Especially if you are trying to monetize your effort.
In my mind MonoGame helps overcome two huge barriers to getting into game development.
- Difficulty of monetizing the effort. By allowing the same code to be shared on most platforms, a game developer can get paid for their effort in multiple marketplaces.
- Not knowing where to get started. The XNA API is so simple to use that you can get a simple game, like a Pong clone for example, up and running in about a couple of hours.
Also, because MonoGame is basically just XNA, you can find a whole host of resources on how to develop a game using the platform.
In my upcoming Pluralsight course, I show how to create a Pong clone on Windows and then we get that game up and running on Android, iOS and Windows Phone 7, with minimal changes.
Getting started
It can be a bit challenging to find good information to get started in each platform using MonoGame, but the basics are located on the Github page.
For the Windows tutorial there, you can use Visual Studio instead and use the MonoGame installer.
For each platform things area slightly different, but really not all that hard. If you want to have your game run in Android and iOS, you’ll need Mono for Android and MonoTouch respectively.
For Android development, you can use Visual Studio as long as you have Mono for Android installed and all you really need to do is link your files from your Windows project and create a small bit of startup code in an Android Activity to start the game.
For iOS development, you will need to use MonoDevelop, which is packaged with the install of MonoTouch. MonoTouch itself uses XCode and the iPhone SDK, so you have a bit more installing to do there, but the idea is pretty much the same. One you have MonoTouch running on your Mac, you can link over the files from your Windows project, add a small bit of startup code, and you are up and running. (You’ll also need to download the actual MonoGame source code to add to your project, since there isn’t an installer for Mac currently.)
Xamarin also has a seminar they did on MonoGame to help you get started.
True cross platform development, finally
At least for game developers. For other applications in the mobile space, there are some solutions that help you share your code, but nothing that really allows you to have near 100% portability without a big sacrifice.
I was pretty amazed the first time my game just ran on my Android and iOS devices with virtually no changes.
I’d definitely encourage you to check out MonoGame and stay tuned for my Pluralsight video on the topic, where I will go through all the details of creating a game and getting it running on most of the major platforms.
Reference: Introduction to MonoGame from our NCG partner John Sonmez at the Making the Complex Simple blog.