In a previous post I described how to integrate XNA Game Studio Content Pipeline Projects into your MonoGame pipeline. The downside of the previous recipe is that is requires a paid edition of Visual Studio 2012. This recipe will show you how to incorporate the outputs of a XNA Game Studio 4.0 Content Pipeline project into your MonoGame for Windows 8 project. While not as complete and automated as the previous recipe, it is the best we can get until the MonoGame team completes the development of the Content Pipeline Projects.
Similar to the previous recipe, you will not need VS 2010 anymore, unless you are converting an existing XNA GS 4.0 project, which is a topic I’ll cover in a later post. With a few minor changes to your MonoGame project file, but all with the Express Editions of Visual Studio.
Ingredients List
Make sure you have the following products installed :
- Visual Studio 2012 Express for Windows Phone 8 & SDK
- Visual Studio 2012 Express for Windows 8
- MonoGame 3.0.1
Recipe
-
Create new MonoGame project and solution
-
Create a new Windows Phone 8 XNA Game Project
-
Open Visual Studio 2012 Express for Windows Phone
-
Create a new MonoGame Project
-
File -> New -> Project [CTRL-SHFT-N]
-
Select “Windows Phone Game (4.0)” from the Visual C# / XNA Game Studio 4.0 category
-
Give your Game Project a name, select the same folder as your MonoGames solution above and deselect the option “Create directory for solution”
-
Click “Ok” to create your game project
-
-
-
Add some test content
Now we will add some artwork and sound to the XNA Content Project and build the XNB files.
-
Download sample assets from the Game Development Tutorial from the XNA XBox Line Indies game site.
-
Extract the contents of the zip file into a folder.
-
Right-Click the Content Project
-
Add -> Existing Item[SHFT-ALT-A]
-
Navigate to the the folder Shooter\Shooter\ShooterContent under the folder where you extracted the files and select all files
-
Click Add
-
Right-Click the Content Project
-
Add -> New Folder
-
Name it Sound
-
Right Click the Sound Folder
-
Add -> Existing Item [SHFT-ALT-A]
-
Navigate to the the folder Shooter\Shooter\ShooterContent\Sound under the folder where you extracted the files and select all files
-
Click Add
-
Right-Click the WindowsPhoneGame project and click build
-
-
Modify MonoGame
Finally we will link the compiled XNB files from the XNA GS build to our MonoGame project.
-
[ALT-TAB] back to the Visual Studio 2012 Express for Windows 8 with our MonoGame project open in it.
-
Right-Click the MonoGame Project File
-
Add -> New Folder
-
Name it “Content”
-
Right-Click the Content Folder
-
Add -> Existing Item[SHFT-ALT-A]
-
Navigate to the folder WindowsPhoneGame\WindowsPhoneGame\bin\Windows Phone\Debug\Content under your MonoGame solution folder.
-
Select all the .xnb files in the folder and “Add As Link”
-
Right-Click the Content Folder
-
Add -> New Folder
-
Name the new folder “Sound”
-
Right-Click the Sound folder
-
Add-> Existing Item [SHFT-ALT-A]
-
Navigate to the folder WindowsPhoneGame\WindowsPhoneGame\bin\Windows Phone\Debug\Content\Sound under your MonoGame solution folder.
-
Select all the .xnb files in the folder and “Add As Link” By using “Add as Link” when you change the original assets and recompile them using the WindowsPhone project, they will automatically be updated the next time you recompile the MonoGame Project.
-
In the Solution Explorer, select all the xnb files under the Content Folder
-
In the Properties Window [Alt-F4] Change Build Action to “Content” This setting will force the content to be copied into the packaging folder where it can be found when the game runs under the WinRT subsystem.
-
-
Build + Test
Now you can complete the tutorial on the XNA Xbox Live Indie Games website. NOTE: You will need to edit the names of the class fields and their usages in the Game class to remove the leading underscore.
Keep the Cash • Publish an app • Get up to $2000* Publish your app(s) in the Windows Store and/or Windows Phone Store and fill out the form at build.windowsstore.com/keepthecash to participate. You can submit up to 10 apps per Store and get $100 for each qualified app up to $2000.
*Offer good only to the first 10,000 qualified applications published in the Windows Store and/or Windows Phone Store, or until the end of the promotional period, whichever comes first. Limit 10 entries per publisher ID and up to $2,000 per person.