다음을 통해 공유


Windows 8, XNA and MonoGame – Part 1, Overview

Games are likely some of the most popular apps on Windows 8 and you are in a great position to take advantage of this huge opportunity. How huge? The Windows Store Blog sums it up well:         

With more than 630 million Windows 7 licenses sold to date, across 200+ countries and regions around the world, Windows has an unrivaled global reach. Combined with the flexibility of monetization options that the Store provides, Windows 8 represents the single biggest developer opportunity for any platform.

This is a 3 part series. You can reach the other posts in this series here:

xna_logo

Casual game developers have been using XNA since 2004 to easily create games for Windows, XBox and most recently Windows Phone. XNA is a .NET framework for game development providing a content pipeline and game asset load functionality, animation, math, sound and user input tracking via gamepad, mouse, keyboard and touch with game logic organized in a straightforward game loop architecture. Game development is not trivial and XNA was a level up for a great number of students and developers who wanted to learn how to create games. XNA along with Visual Studio made it as easy as File –> New –> XNA Game Studio Project and you were off and gunning.

Windows 8 is Windows reimagined and reinvented from a solid core of Windows 7 speed and reliability with an all-new Start Screen experience and a new developer API called WinRT.

Windows8LogoWhite

Since Windows 8 is built on the strong foundation of Windows 7, any app built for Windows will run in the Windows 8 desktop environment. This includes apps based on XNA, Win32, .NET, WPF, Silverlight, etc. 

Windows 8 also introduces a new type of app called a Modern UI Style App for developers that wish to make their app available in the Windows 8 Store, for free or for sale. Using Visual Studio 2012, you have a language choice of C++, XAML with C#, VB or C++, or HTML5/JS to create a Metro Style App.

Using the XNA Framework is not a choice for building a Metro Style App. Official Microsoft guidance on game development is documented here. The recommended way to build highly immersive games on Windows 8 is to use HTML5/JS, XAML/C#, XAML/VB or C++ and DirectX, all great choices. But if you have been developing with XNA and have an existing code base, your only option it would seem is running as a desktop app.

This is where MonoGame comes in…

image

MonoGame is an Open Source implementation of the Microsoft XNA 4 Framework. The goal is to allow XNA developers on Windows & Windows Phone to port their games to the iOS, Android, Mac OS X, Linux with both PlayStation Suite and Windows 8 support currently under development.

NOTE : This project is not linked with Microsoft or any of it subsidiaries. It is a non-profit, open source project. MonoGame is licensed under the Microsoft Public License (Ms-PL)

MonoGame provides a cross platform XNA Framework implementation for XNA developers who want to take their code to non-Microsoft platforms as well as the ability, thanks to Tom Spillman and James Ford of SickHeadGames, Dean Ellis and several other talented developers, to target Windows 8. Using MonoGame for Windows 8 you can take your XNA code and with a recompile and some additional platformisms create a Metro Style App worthy of the Windows 8 store.

MonoGame is still under development and so any use of it should come with a note of advice to stay on top of that effort. Also as game developers we should always be looking at expanding our game development skills on Windows using HTML5, XAML and DirectX in order to get the most out of the platform. But given that so many developers have XNA games, MonoGame for Windows 8 is a viable migration solution in the near term.

How MonoGame Works

MonoGame is a recreation of the XNA Namespace Hierarchy and Class Structure. If you dig into the source code of MonoGame, you will find that platform specific code is encapsulated within a #pragma compiler directive. Different directives are used for different platforms and can be controlled through BUILD rules. Here is a snippet from the ContentTypeReader class that shows the use of both the WinRT and Android #pragmas:

image

In order to provide a complete implementation of XNA on Windows 8, MonoGame leverages SharpDX , an open-source project delivering the full DirectX API for managed code (.NET) and Windows 8 (WinRT). SharpDX is an open-source project, free of charge available under the following MIT License.

         image

By adding the MonoGame Framework to your Visual Studio Solution, you are providing your XNA code base the identical namespace and class model it was based on. Theoretically by moving your code over into a new Visual Studio Project Solution along with MonoGame, you should de able to recompile and BLAMO!! Metro Style Game.

Theory and practice are of course 2 different things and I can’t say that it will be a perfect port with no issues. There are always issues. That is why they call it SOFTware. But any time you can leverage existing code to get to done is a good thing so lets dig in.

         

Generation App: Getting You There

We are here to help you get your app on Windows. Here is how you can gain an advantage and stand out from the crowd through the programs we’re offering:

Generation App       

  • Design Consultation
  • Technical Consultation
  • Online training and tips from insiders      

In the part 2 of this of this series I will detail how to get started using MonoGame to port an existing XNA game to Windows 8.

-bob

Technorati Tags: MonoGame,Windows 8,Visual Studio,XNA,Metro Style App,XAML,C#,DirectX,Win8,HTML5,JavaScript

Comments

  • Anonymous
    August 26, 2012
    May I suggest the plural "pragmata" rather than "pragmas"? :)

  • Anonymous
    August 28, 2012
    duly noted :)

  • Anonymous
    October 25, 2012
    More with XNA on other platform!

  • Anonymous
    October 27, 2012
    Good one.

  • Anonymous
    November 29, 2012
    So, microsoft officially acknowledged the fact that XNA will nolonger be developed, didn't they? Nice to know

  • Anonymous
    December 12, 2012
    (Not related to the blog entry): The 11 megabyte BigSky.jpg file you have at the header of your blog is a bit of a hog. you should trim it down.