Met many issues along the road to make my game run on Xbox. So I thought I could start documenting it.
-Applied to the ID@XBOX program (easy to google).
-I emailed them about games I wanted to release. In the beginning they thought my game weren't showing of the power of the xbox. But they must have lowered their expectations since then, and considering I am a total bottom of the barrel developer, I would say than anyone has a chance today.
-I received a document to fill out. They wanted to know things like: how it plays, how it compares to similar games, is it console exclusive and a couple of screen shots.
Two things to note here: They wanted to try a demo, and they wanted the demo to support an xbox controller.
As part of the license I recieved two xbox dev kits for free (Xbox ONE X and Xbox ONE S). I had to sign a lot of legal papers to never mention them to anyone (only to see them lined up on the E3 showfloor two weeks later).
The mail tracking of the dev kits didnt work, so I had to hunt them down by calling the post office, so make sure to keep an eye on that.
Websites to visit
I got links to a couple of websites. They are all a bit of a half-finished mess, I am still pretty confused why it is this way and I am not sure they do either. Use Internet Explorer for the best experience. Tip is to archive all setup emails you get, I had to go back and read them a couple of time.
Xbox Dev Portal (XDP). So far Ive only used it to activate the consoles.
Game Developer Network (GDNP). There are some deeply buried tutorials here plus a developer forum that has 2 posts a month.
Xbox One Home Page. A new page that is supposed to replace GDNP, not complete but way easier to navigate.
Microsoft Account (MSA). I still dont know what I do on this page, but you need to create an account here I guess
Windows Dev Center. Manage your game submissions here. Your games end up under "Partner Dashboard".
I followed a tutorial I found on: Game Developer Network>Development>Hardware>Recovery and Developing> The Xbox One Dev Kit Quick Start Guide>Getting Started with Xbox One Development>Setting Up Your Xbox One Development Environment>Connecting the Xbox One Hardware
-Hook it up like a normal Xbox, but also plug a controller in the back USB ports (worked without a keyboard for me).
-Don't let the Xbox update anything in Retail mode, this will remove the ability to boot the dev mode. I fixed this mistake by factory resetting it in the system settings.
-The Xbox need to be updated by downloading a OS image called a "Recovery". See Xbox One XDK & Recovery.
-On the xbox (Console settings>Launch settings) System>Console info>Console Id. Write that down.
-Use your link to the Xbox Dev Portal site. Manage> Console convertion. This site is tricky because it showed a green "READY!" message even when I did the wrong thing. In some instances I had to wait a half an hour for changes to take effect.
On the white sticker on your xbox there is a serial number that starts with "SN". Select that console on the site and enter the Console ID, included "." and the last two numbers.
- Install the XDK, was easy but is a download that takes hours.
-You get a "Xbox One Manager" app on your computer. I ran that with the xbox connected to the same network and the app found it immediately. I didn't have to change anything in my firewall or router (ignoring the instructions to do that).
I had to install VS2017, and then reinstall Monogame from the development branch. Make sure to include all templates in monogame.
-Start a Window10 Universal project. Right click References>Manage NuGet Packages...>install Microsoft.Xbox.Live.SDK.WinRT.UWP
-Change target platform from x86 to x64.
-Change debugging play arrow from "Local Machine" to "Remote Machine". I found the Xbox suggested there (while running the Xbox and the Manager app).
-Your game must render something or it will just immediately close.
-The Content pipeline manager stopped working for some reason. You can start it from
C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\Pipeline.exe
and select your project content file.
Here I was able to run a "hello world" test on my Xbox.
Porting my Game
-I setup a shared project solution so I could toggle between a OpenGL project for computer platforms and DirectX for Xbox. Referencing the Content was a bit tricky, read my solution here.
-I was using the Steam API for user settings and network. I put a layer of abstraction between Steam, Xbox and the rest of the code, example:
public string Name
-I had to replace "System.Threading.Thread" with "System.Threading.Tasks.Task". They are very similar in use, just make sure to only let one Task at time access the storage.
-System.IO.Stream.Close() needs to be replaced with "Dispose()".
-Some of the Shader Effect code needed adjustments
#define SV_Position0 POSITION
#define NORMAL0 NORMAL
#define VS_SHADERMODEL vs_3_0
#define PS_SHADERMODEL ps_3_0
#define VS_SHADERMODEL vs_4_0_level_9_1
#define PS_SHADERMODEL ps_4_0_level_9_1
float4 Position : SV_Position0;
float2 TexCoord : TEXCOORD0;
float3 Normal : NORMAL0;
float3 Tangent : NORMAL0;
VertexShader = compile VS_SHADERMODEL VS_Flat();
PixelShader = compile PS_SHADERMODEL PS_Flat();
-I temporarily removed all save and load. The Xbox is using some storage container, you cant just save and load anywhere - unlike the PC.
Here I was able to run my game on XBOX, Woohoo!
Some weird bugs/fixes
-When I reboot the xbox or the computer, I sometimes have to reselect the Remote Machine:
Right-click the UWP project > properties > Debug > Click the Remote Machine "Find..."-button.
-When debugging against the Xbox, sometimes the deploy just wont run, I fixed this by having a small "hello world" project I deploy on the xbox - and then it works again.
-Something in my new setup makes the visual studio crash if I open a Effect.fx file. But I just edit them in the notepad instead.
-When the Visual Studio crashes, I have to reset the Content build option in the Project.projitems file.
-The conditional compilation intellisense (the text between #if XBOX and #endif) breaks when changing startup project. A fix is to Right-click the other project and select "Unload Project" (and Reload it again if you want to)
-A lot of the start setup is made manually by the Xbox employees, I began my certification with some mail exchange.
-The first choice is between UWP and ERA.
I couldn't find any information comparing them, so this is what I guess they do:
Universial Windows Project - This is an app system that is the same on Xbox, Windows and mobile. Ive heard Xbox run Windows RT as a virtual OS on the console, and the apps on there.
Exclusive Resource Access - Runs as a classic xbox game on XboxOS (im just guessing!). Does Monogame support this - I don't know.
Next up is adding the Xbox Live User system and some storage management. I also need to figure out where I upload my game for Certification.
Will update this as I go on...