Windows 8, XNA and MonoGame - Part 2, Getting Started

bob's blog
bob's blog

Windows 8, XNA and MonoGame - Part 2, Getting Started

Rate This
  • Comments 8

In part 1 of this series I gave you an overview of MonoGame, an open source cross platform implementation of the XNA namespace and class model and how you could use that to port you existing XNA code to Windows 8. In this article, I will show you how to get your development environment setup to support your porting effort.

Note: special thanks for Dean Ellis (dellis1972 ) who posted a video on YouTube outlining this process. I highly recommend that you view Dean’s video before you follow the steps below.

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

             
Windows Logo xna_logo image2

Developer System Requirements

Install in this order

1. Windows 8 Release Preview            
2. Games for Windows
3. Visual Studio 2010 Express for Windows Phone
4. Visual Studio 2012 RC for Windows 8
Install the items to the right in the order specified.

NOTE: Why Games for Windows? I encountered an installation failure when installing the Visual Studio 2010 Express for Windows Phone tools. The XNA support would fail.

Aaron Stebner’s directions to download and install the latest version of Games for Windows fixed the issue. Once that is installed, run the setup for the Visual Studio 2010 Express for Windows Phone and all should go smoothly.

You may be wondering, why do I need Visual Studio 2010? There is a feature of XNA called the Content Pipeline, a pre-compiler step in the preparation of graphic and audio assets for use at runtime in XNA. This feature is not implemented in MonoGame. Therefore you need Visual Studio 2010 to pre-compile your game assets which you then copy over into your VS2012 project. More on that step in part 3 of this blog series.

Git Setup


1. If you don’t already have one, setup a Git Account
2. Get yourself a
Git Client

MonoGame is an open source project managed under Git. In order to use it you will need to fork the repository from GitHub and then create a clone in your local environment.

To do that you will need an account on GitHub and a Git Client. I like the GitHub for Windows client. It has a nice Metro look and feel. It will get you in the mood to develop for Windows 8
Smile

image 

After you install the GitHub Windows Client you will have 2 programs available, GitHub (GUI) and Git Shell. The Git Client is a Metro ‘Styled’ desktop application that provides a GUI interface. Git Shell is a PowerShell based command line interface to Git. We will use Git Shell for our purposes.

 

image

       image

                            

There are a lot of developers who contribute to MonoGame. The Windows 8 support is being developed by Tom Spillman and James Ford of Sickhead  Games as well as several other talented developers. In particular we will be using the develop3D branch. That is where the Windows 8 support is being submitted.

Note: If you would like to contribute to  the Windows8 implementation of MonoGame, contact Tom Spillman (requires codeplex account)

 

Cloning the MonoGame Source Code

1. Run Git Shell

2. Navigate to the location on disk where you want to clone the source code (use CD command)

3. Type the following command to clone the MonoGame project:

    git clone https://github.com/mono/MonoGame

4. Once that command completes, navigate to the MonoGame directory by typing:

CD MonoGame

5. Now we will initialize the project submodules by typing the command:

    git submodule init

6. And then update the submodules

    git submodule update

This may take some time so head over to the Windows Surface site to check out the new devices.

When the process completes you can navigate to the MonoGame folder and list out the contents

image

Create and Deploy the Visual Studio MonoGame Project Template

1. Open an Explorer Window and navigate to the MonoGame Project directory, then to the templates folder:
         
C:\Users\[you]\Documents\GitHub\MonoGame\ProjectTemplates\VisualStudio11.MonoGame.2.5\VS11MGWindowsMetroTemplate

2. Create a Zip of the all files in this directory

        image

3. Copy the ZIP file to the VS2012 Visual C# Templates directory:


C:\Users\[you]\Documents\Visual Studio 2012\Templates\ProjectTemplates\Visual C#

 

   image

 

Testing your MonoGame Setup


1. Open Visual Studio 2012 and select New Project

2. Under Visual C# you should see the MonoGame project template listed. Select that and click OK.

3. Right click on your solution in the Solution Explorer and add the MonoGame Framework Windows 8 Project. You will find the project file in this directory:


    C:\Users\[you]\Documents\GitHub\MonoGame\MonoGame.Framework

The file is called:

    MonoGame.Framework.Windows8.sln
image
4. Add a reference to the MonoGame Framework in your game project by right clicking on references, select Add Reference. Under Projects choose the MonoGame Framework project (check the box!) and click OK

5. Compile and run the solution. You should get a cornflower blue screen (not a blue screen, a cornflower blue screen, very different!), the default XNA application.
             
            
image

image

Now you are ready to add your XNA graphic assets and code. In part 3 of this blog series I will cover the basic format of an XNA application and my code migration experience.

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

 

Leave a Comment
  • Please add 3 and 6 and type the answer here:
  • Post
  • I've been using MonoGame on Windows 8 for two games to date and I have to say I'm really impressed! The first game I wrote initially using XAML/C# and while that worked it was like fitting a square peg into a round hole at times. That being said, if you do decide to use MonoGame (which to repeat I recommend) be aware that you're going down the road less traveled and sometimes you have to dig yourself out of the metaphorical ditch!

  • User TortoiseGit as a GIT client, life's much easier

  • Thanks Simon. Here is the link if anyone wants to use Tortoise, code.google.com/.../tortoisegit

  • The only advantage I've found to TortoiseGit is that git-svn works with it, not with GitHub.

  • Update: 9/24/2012

    After grabbing the MonoGame content, step 1 reads:

    "C:\Users\[you]\Documents\GitHub\MonoGame\ProjectTemplates\VisualStudio11.MonoGame.2.5\VS11MGWindowsMetroTemplate "

    However, there is no "VisualStudio11.MonoGame.2.5" folder there anymore. It has now been replaced with:

    "VisualStudio2010.MonoGame.2.5"

    I guess it has changed in the last several weeks. Just an update for the blog, to avoid confusion for others.

  • I've played with this a bit more today (9/24/12)

    The folder and content you need to drag from the GitHub repository into VisualStudio12 Templates is:

    - The "Game" folder, which is found under ProjectTemplates ---> MonoGame3 ----> Game

    - MonoGame3.vstdir

    Do not put the MonoGame3.vstdir into the "Game" folder.

    BOTH of these need to be in your VisualStudio2012/ProjectTemplates/ VisualC# folder, but unzipped. If they are zipped, they will not be found.

  • Cool one.

  • Good article.

Page 1 of 1 (8 items)