Saturday, February 1, 2014

Tutorial: Porting and Deploying to Windows 8/RT with MonoGame- Death Plot

The second in our series of MonoGame tutorials is porting to Windows 8/Windows RT. In my opinion, this is by far the easiest of the many ports you can do with MonoGame.
This is a tutorial and walkthrough of me porting my Mini Ludum Dare 48 game: Death Plot, to Windows 8/8.1/RT

Video Tutorial:


Written Tutorial:

Prerequisites:
1) Windows 8, or Windows 8.1
2) Visual Studio (2012 or higher)- Select VS 2013 Express for WINDOWS
Get it here: http://www.visualstudio.com/downloads/download-visual-studio-vs
3) An already made XNA or MonoGame project to port. (Meaning you also have .NET framework, XNA GS 4.0 refresh, etc.)


Installing Visual Studio 2013 Express for Windows


Steps:
1) Install MonoGame-
You can get it from here: http://monogame.codeplex.com/ (Version 3.0.1 currently)

BUT I highly recommend you get it from here instead: http://build.monogame.net/job/develop-win/
If you have VS 2013, or want the latest version, the installer here is better, because it is more up to date. The 3.0.1 release is from early 2013.

2) Create a MonoGame Windows 8 project- (Go to New Project select MonoGame Windows Store or Windows Store XAML)

Optional- 2.5) Retarget the project to Windows 8.1- Upside and downside to this. Upside: you get a lot of new features. The downside is that Windows 8.1 according to NetMarketShare has only a 3.95% marketshare compared to Windows 8's 6.63%. This means you lose potential players.
What I am doing is having two projects, one targeting Windows 8/RT, and one targeting 8.1.

3) Add your content- Go to your original XNA project folder and go to bin-x86-content and copy the content XNB's. Note that they HAVE to be XNB's or it wont work. You cannot add PNG, or any traditional format.
To turn the traditional format to PNG's, add them to a XNA project, and build the XNA project.
In the project you are porting, they should already be XNB's.
Copy all your content to the content folder in your new Windows 8 monogame project.
Copy the XNB's to the premade Content folder.

4) Set the properties of all of your content to Content and Copy If Newer

5) Copy your code EXCEPT FOR YOUR OLD PROGRAM.CS

6) Make sure the namespaces of the new Program.CS and your old code that you are porting match

7) Change any needed code. For instance, I had to remove controller vibration, because my build of MonoGame didn't support it. EDIT: MonoGame now supports controller vibration

8) Debug your game in either the simulator, or your machine! It should now run!
Tada! Death Plot v1.0.2.335 is now running in the simulator!

Congratulations! You ported your XNA game to Windows 8! You can now run your game on Windows 8, Windows RT, and Windows 8.1!!

9) Publish to the Windows Store and make money!- To do this, you need to create a developer account here: https://appdev.microsoft.com/StorePortals/en-us/Account/Signup/Join
It costs 19$ annually to have a developer account, but it allows you to publish on both the Windows Phone, and Windows 8 store, for the same cost.

1 comment: