It was announced that Microsoft is no longer producing the Xbox 360 console. It was a great console and still has a lot of life in it. Of course, I have two different ones, but I rarely use one and the other is so I can stream Netflix. (Not a smart TV, in fact, it is a big ole CRT thing – well big as in depth, not viewing area.)
Since many of the 360 games I bought and haven’t played yet are coming to Xbox One Backwards Compatibility list, I’ll have fewer reasons to turn on the 360. Still, there are some games, like Batman Arkham Origins and Assassins Creed Rouge that I just recently played that were only available on the 360.
The 360 will always have a special place in my heart, because that was the first console I was able to deploy (and debug) a game to. This was basically unheard of before XNA came out.
Now with MonoGame, anyone who wrote code using XNA, can have that game live on in the new world on Windows 10. This includes on HoloLens. Here Microsoft is shipping it’s first holographic computer and thanks to the open source project, and in particular, Tom Spilman, XNA code will run on the HoloLens.
The Xbox 360 turned 10 years old in November 2015. It still has life in it and support for the console will continue for at least another 3 years. I loved the 360, I love my Xbox One and I know I’m going to love my HoloLens. It is supposed to arrive tomorrow!
Oh, by the way, I’m hoping to send the updated XNA Game Studio 3.0 Unleashed code to GitHub tomorrow. Will that mean two posts in a row? Only time will tell…
As I’m going through and updating the code I ran into a following snag that took me a bit to figure out. In this case, I only had a Pixel Shader and no Vertex Shader. The shader worked just fine back in the day, but during the upgrade I was told that MonoGame only supported ps_4_0 and this shader was version 1.0 (ps_1_0). Simply changing the version number in the shader file fixed that.
But then I had a bug where the shader wasn’t giving me the results I wanted.
After poking around a little bit, I finally found out that the method signature needs to explicitly have all of the parameters. I found this information here:
Once I made that small tweak (added in the different parameters (albeit through a struct)) it worked like a charm. A struct doesn’t have to be used, but the parameters should be in the right order it seems – position, then color, then texture coordinates.
Note, that this pixel shader doesn’t do anything but return the pixel of the texture passed to it. Typically you would do some math on the color before returning it. Check out Chapter 15, under SimpleGame for some different pixel shader examples when I update the code to GitHub. (Before the end of the month…)
So make sure that your pixel shader parameters are all present and associated with the right semantics!
I’ve started working on upgrading my old XNA Game Studio 3.0 Unleashed book’s code so it will run on the Universal Windows Platform (UWP). I haven’t touched this code since it was created back in 2008/2009, but with the HoloLens coming, I thought it would be good to dust off the code and see what it would take to upgrade.
The reason for doing this is because of a .NET Rocks! podcast. Richard and Carl interviewed Tom Spilman. I heard Tom speak at a .NET usergroup in Seattle when I was in town for a conference a few years back. I’ve been impressed with the amount of work he has put into the MonoGame open source project to make it work on Windows.
Still, when I’ve tried to get into MonoGame for Windows 8 I had issue. It wasn’t ready yet, and I didn’t have time to try and fix it, so I went on to use Unity. I don’t regret that decision as Unity is a fantastic tool.
Still, I wanted to go back and look at my XNA code and see if I could get this to run in Windows 10.
Based off my initial results, I’m expecting I’ll have the updated code on GitHub by end of the month…
If you are interested in the original XNA GS 3.0 code, it is hosted on codeplex at:
I’ll create another post when I get it put onto GitHub. I’ll be starting a fresh repo as I don’t believe there would be any benefit of starting with the 3.0 code.
Before I started, I had to install MonoGame. You can get the latest from here:
Here is the steps I am taking to upgrade my old XNA 3.1 code to use the XNA 4.0 API inside of MonoGame 3.5.1
Installed MonoGame
Create New MonoGame app – picking Windows Universal. I do want this to run on HoloLens after all. 😀
Restored NuGet Packages
Copy over my content to the Content folder. (including the .contentproj file) (through explorer, if through VS, I don’t include them in the project)
Double click on the MonoGame content.mgcb content pipeline file.
This brings up the pipeline tool. I then import the .contentproj file.
I build and fix any issues. Some .fx files needed to be updated in my case as I was using vs_1_0 and ps_1_0 and MonoGame requires it to be 4_0 and above for both the vertex and pixel shaders.
If my Game class (not filename) was called something other than Game1, I opened the Game1 that loaded in the project and renamed it to the name of the game I was converting. I made sure to let Visual Studio do the renaming, so it renamed all the backend code correctly.
I then copied all my .cs files from my original project into Visual Studio.
If the Game file name was different than Game1.cs, then I deleted Game1.cs – otherwise, I just overwrote it.
I then went through the process of updating the XNA 3.1 API to XNA 4.0 API.
I remember there being a cheatsheet for this. Unfortunately, that page no longer works, but thanks to the Way Back Machine, we can still get to it: