So, as many of you have heard, Microsoft has killed off XNA and every game written in the framework is doomed.
Except that isn’t the whole story.
If you don’t know, XNA is a game development framework made by Microsoft to aid developers in rapidly creating cross platform games. The name stands for: XNA's Not Acronymed. Writing a game in XNA enables it to run on Windows, XBOX, Windows Phone, and the [now dead] Zune HD. The only real changes that need to be made are the controls and UI (different screen sizes). Even if you’ve never heard of XNA, chances are that you’ve played a game made in it if you’ve ever used a Windows Phone. One such game is ARMED! - which now has a Windows 8 version made in MonoGame. XNA was loved by a lot of people, and gained popularity because it was an easy entry point into 2D and 3D game development, and it was a good way to reuse code across platforms.
Enter: Windows “m-word” apps.
With the launch of Windows 8 and RT Microsoft has made a major shift to account for modern devices that have boat-loads of sensors, and a variety of different input mediums. Try using Photoshop – or any traditional Windows application – with a touch screen and you will see exactly why Microsoft has made this tectonic shift. Along with making apps more touch-friendly, these new apps will run on both traditional x86 (Intel CPU’s for instance) and mobile ARM chips. Microsoft has also made all languages equal, so whether you are writing your app in HTML/CSS/JS, XAML/C#, or even C++/XAML, you will be targeting the same WinRT API’s.
Here is a visual representation of the modern Windows platform as it stands today:
Something that bloggers, media, and the internet at large have chastised Microsoft for is the fact that it is not possible to write XNA games anymore. This is 100% correct. However what many people forget is that XNA is still fully possible on Windows 8 as a desktop application. Yes, that won’t console many people, but regardless, support hasn’t magically vanished.
Secondly, and this is the most important point of this article: It is still possible to make an XNA game or port your existing XNA game to a Windows Metro app. That game will run on both x86 and ARM devices. Microsoft has left us in the lurch – and somewhere deep deep down, I am sure they have a good reason – but all hope is not lost.
Here’s a description of MonoGame from their website:
MonoGame is an Open Source implementation of the Microsoft XNA 4 Framework. Our goal is to allow XNA developers on Xbox 360, Windows & Windows Phone to port their games to the iOS, Android, Mac OS X, Linux and Windows 8 Metro. PlayStation Mobile development is currently in progress.
At a very high-level, what this wonderful bunch of people is doing is method-by-method recreating the XNA framework with compatibility for the aforementioned platforms. So they create an implementation of each thing that XNA does in each platform. To avoid legal issues, no code has been disassembled from Microsoft’s binaries.
As a developer with a bunch of Windows Phone apps written in XNA, this is quite a relief. I’ve been playing with MonoGame over the past few weeks and it really is as good as it sounds. I timed myself getting Matchy to build and run and it took under 15 minutes. Of course, after getting it to run I still had to change a lot of the UI because of the larger display and varying resolutions. Another game I ported was Relaxify. Once again, an almost trouble-free experience in terms of porting. I did of course beef it up a lot for all these fancy new devices.
It is at this point, dear readers, that this stops being your average Windows Phone Central article. If you are not a developer, you may want to skip the rest and head straight down to the comments.
So how do you, the frustrated XNA developer, use this? Easy:
The installer for MonoGame 3.0 Beta has just been released and you can grab it from here: http://monogame.codeplex.com/releases/view/96421. If you are reading this at some point in the future, rather go to the MonoGame Codeplex site to get the latest version. If you want to keep up to date with the changes (and you probably should), then you can also clone the repository here.
- Install it.
- Once installed you can open up Visual Studio 2012 and the new templates will be waiting for you.
- Once loaded the project will be pretty much as you expect, with a Game.cs file and a bunch of others. One notable feature is the XAML integration. So along with XNA rendering you can use standard XAML controls.
Now something that seems to trip a lot of people up, and is possibly the only big difference between developing for standard XNA and MonoGame is content processing. Traditionally, along with your game project there was a Content project where you added sounds, models, textures, etc. Upon building those assets were compiled into XNA’s native .xnb format and then read through the ContentProcessor for use in the game. And all that was handled by Visual Studio 2010. Fast forward to today; Visual Studio 2012 has dropped this feature because it was a part of XNA.
The workaround is to have a separate content project:
After installing the XNA 4.0 SDK create a new Windows Game (4.0).
Add any assets to the content project and build the solution.
Copy the resulting .xnb file/s from the bin to a new folder Content in bin\Debug\AppX\ of the MonoGame project.
- Now just load content like you always have.
- Rejoice, for XNA lives!
As mentioned before, XNA is a really easy way to get into game design. Four lines of code after setting up MonoGame and the content project as explained above, we have a rotating 3D model imported from 3ds Max.
Although there is no built in support for XNA in Visual Studio 2012, one awesome feature is an FBX model viewer. FBX is an Autodesk 3D model format which includes support for a bunch of handy things like embedded animations and textures. This is the model format of choice for using with XNA. Installing VS2012 makes it the default application for FBX files, and the viewer is a really welcome addition.
So there you have it folks, XNA is alive and well, albeit unofficially. Something to keep in mind is that long-term you may want to venture out into C++ or Unity.
What do you think of Microsoft’s decision, and how has it effected your development? Sound off in the comments below!