Gamasutra: The Art & Business of Making Gamesspacer
From XNA to MonoGame
View All     RSS
October 30, 2014
arrowPress Releases
October 30, 2014
PR Newswire
View All





If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 
From XNA to MonoGame

May 15, 2013 Article Start Page 1 of 6 Next
 

A reprint from the May 2013 issue of Gamaustra's sister publication Game Developer magazine, this article explains how you can transition your XNA projects to MonoGame. Purchase the May 2013 issue here.

For a long time, the idea of making "real" games using managed languages such as C# was considered lunacy. But things have changed, and managed languages are now proving to be quite viable for making games, thanks in large part to XNA and Unity 3D, with both using C# as their main development language or scripting engine. Many new game devs learned to use XNA in order to get their games on the Xbox 360 and Windows PCs, and even though Microsoft recently announced that XNA will neither see any more active development nor be supported in Microsoft's Metro interface, those devs don't have to start over from scratch. Enter MonoGame, an open-source implementation of the XNA 4 API.

What is MonoGame?

MonoGame's project goal was initially to allow XNA developers to publish their games on iPhone, but the project has grown a lot since those humble beginnings. It now supports a number of platforms, including Mac OS X, Linux, Windows 8, Windows Phone 8, Android, and iOS. For the most part, it is free to use (though you'll need to pay for a license for the Xamarin iOS and Android frameworks) and modify, as all the code is covered by the MS-PL (Microsoft Permissive License). Now, MonoGame's goal is first to produce an XNA-compatible cross-platform API, which can be extended to new platforms as they appear. For example, because MonoGame already supported Android, we were able to add Ouya support to MonoGame in a matter of days.

Once the XNA API is stable, we're planning to extend the API with new features that people would have liked to see in XNA, and extend the API to make it even easier to do certain tasks. For most of the team involved, some of whom have been working on MonoGame for a few years now, this is a long-term project. 

Getting Started with MonoGame

First off, head over to www.monogame.net/downloads and grab the latest stable release. At the moment, MonoGame supports Visual Studio and MonoDevelop/Xamarin Studio.

If you want to use Visual Studio: The Windows installer will install project templates for all editions of Visual Studio 2010 and 2012. Particular requirements for your target platform are as follows:

  • For Windows desktop, you can use VS 2010 Express or higher, or VS 2012 Express for Desktop or higher on Windows 7 or 8.
  • For Windows Store, you will need VS 2012 Express for Windows 8 or higher on Windows 8.
  • For Windows Phone 8, you will need Windows 8 64-bit and the Windows Phone 8 SDK. This will install VS 2012 Express for Windows Phone, and can also work with VS 2012 Professional or higher. To use the Windows Phone 8 emulator, your PC needs to meet specific hardware requirements; see www.microsoft.com/en-GB/download/details.aspx?id=35471 for details.
  • For Android and/or iOS, you will need VS 2010 or 2012 Professional or higher and Xamarin Business or higher on Windows 7 or 8.

To build content to xnb format, you will also need XNA Game Studio 4.0 or the Windows Phone 7.11 SDK installed. This is a temporary measure until our content pipeline replacement is completed. To install either of these SDKs on Windows 8, you need to have the Windows Games Live client first.

A full list of the prerequisites and download links can be found here.

If you want to use MonoDevelop/Xamarin Studio: MonoDevelop is a free open-source IDE that is available for Windows, Linux, and Mac OS X (www.monodevelop.com). MonoGame is available as a package, which includes the runtime for each platform. You can download this from Codeplex as an .mpack file, and install it via the AddIn Manager within MonoDevelop. Recently, Xamarin has released Xamarin Studio, which is an updated version of MonoDevelop for people wanting to use this IDE. There is also a .mpack file available for that version.

Once you have installed the required package into your chosen IDE, you will be able to create a new MonoGame project. There are a number to choose from, but to get started, you should pick the one that is native to your platform -- for Windows, create a new "MonoGame for Windows GL" application; for Mac OS X, create a "MonoGame for MacOS," and so on. Once you have a new project you will see the familiar Game class that renders the customary CornflowerBlue screen.

Skulls of the Shogun dev 17-Bit used MonoGame to build a Windows 8 version of the game.

Before you start coding, there are a few things you should watch out for. For Windows, all of the templates will work out of the box, but if you want to work on an Android project, you will need Xamarin.Android from Xamarin installed. MonoDevelop/Xamarin Studio does include templates for Mac OS X and iOS, but these will currently work only on an Apple Mac because of the underlying development requirements. For iOS, you'll need to install Xamarin.iOS, and for Mac you'll need to grab MonoMac. Also, due to some issues with the AddIn for MonoDevelop and Xamarin Studio, you will need to download the MonoGame source code and add references to the required MonoGame projects for MacOS, iOS, and Android. (The team is working on getting this fixed.) 


Article Start Page 1 of 6 Next

Related Jobs

CCP
CCP — Newcastle, England, United Kingdom
[10.30.14]

Senior Backend Programmer
Guerrilla Games
Guerrilla Games — Amsterdam, Netherlands
[10.30.14]

Animation System Programmer
Square Enix Co., Ltd.
Square Enix Co., Ltd. — Tokyo, Japan
[10.30.14]

Programmers
Blizzard Entertainment
Blizzard Entertainment — San Francisco, California, United States
[10.29.14]

iOS Engineer, San Francisco






Comments


Thomas Happ
profile image
I've been trying to determine if monogame is compatible with the Playstation Mobile development kit (which is also C#). I think that would be quite handy given Sony's recent indie push!

Tom Spilman
profile image
MonoGame does have PSM support.

K Gadd
profile image
We're using MonoGame on PSM right now. It's way better than trying to port from scratch.

Pedro Kayatt
profile image
Would like to suggest to take a look into the Cocos2d-x for XNA. People have been using it with MonoGame with success and porting the game to as many platforms as you would like!
XNA is good, don't get me wrong, but using a simple engine to take the best of it seems to be the best!

David Amador
profile image
Nice article. and thanks for the plug to my blog :)

Cheers

David Keyworth
profile image
XNA's always been awesome, but now that it's completely cross-platform it's been pretty cool to see all the professional games coming out of a managed C# environment.
Sadly, given that even a basic, clean-installed content-project setup on Windows gives all sorts of warnings and errors for me, I'm under the impression that MonoGame is essentially still an "early development" product that takes quite a lot of effort for an amature coder like me to get running smoothly. I may start my future projects in Microsoft XNA, hoping that the Mono project matures a bit further in the near future, for the ease of usability Microsoft's project has.

Curtis Turner - IceIYIaN
profile image
Shows about 3,000 games on XBLIG:
http://marketplace.xbox.com/en-US/Games/XboxIndieGames?SortBy=Rel
easeDate

On Windows Phone I have no idea. Windows Phone 8's can use something other than XNA:
http://www.windowsphone.com/en-us/store/top-rated-games

On Windows it doesn't seem like many XBLIG crossed over. However, the prices for these games are slightly higher.

I suggest developers try and get different resolutions and input methods into their games.

Robert Schmidt
profile image
Anyone ever heard of Silversprite? I've been burned too many times by ambitious open source projects that run out of steam after people have invested a great deal into them. Unity3D is a cross platform version of what XNA should have been. I recommend new game developers invest their time in that.

Wendelin Reich
profile image
Not for the first time, I had to think about how open source tends to fail in the games area. Of course, I would love to see MonoGame succeed, but I'm not naive enough to bet my money (i.e. my time) on it.

Is the problem that games are so hardware-dependent? Even _huge_ open source projects such as the Linux kernel tend to have problems keeping up with hardware evolution (and thats one reason why Linux and games is still a problematic combination).

Or is the problem that game developers have strong economic incentives not to share full-fledged, working code projects? If so, then why does open source work in other areas of IT?

Yet another reason is that game developers have unusually high demands on software reliability. People will accept if OpenOffice crashes (it has auto-save), but a game that crashes tends to be a HUGE turnoff to users. Perhaps thats because (often) games have so extremely complex internal state, which is difficult to reproduce (either for the user via replay, or via a sufficiently fine-grained auto-save).

Dylan Wilson
profile image
MonoGame has a very unique market in that existing XNA developers can port their games to many other platforms including Android and iOS with relatively little effort.

Comparing it to Silversprite isn't even in the same ballpark. Unity3D is a perfectly fine option for developing games but it's not direct competition for MonoGame. Unity3D is a full game engine, whereas MonoGame is a replacement for the XNA framework. They solve different problems.

Brian Perry
profile image
I started out being very excited that I could develop XNA games using mono-game from linux using mono-develop. After doing a simple game though, I realized that you needed a windows machine in order to put art into mono-game. If your developing on Mac or Linux then, your out of luck. They said they were developing an art pipeline for mac and linux so I guess I have to wait until then.

Dean Ellis
profile image
Believe it or not SilverSprite is kind of the GrandFather of MonoGame :)

As for Mac development as the article says you can make use of raw assets like png etc, there are only a few content types where you MUST use the content pipeline, fonts and effects are the main ones.


none
 
Comment: