Microsoft really put a lot of effort in its Universal Window Platform (UWP) architecture, allowing the developer to use the same API to develop your application on tablets, mobile phones, PC and now, your XBox One console.
This is an awesome new for Wave Engine users because now we can create our games directly for Xbox One and deploy them.
Since the beginning Wave Engine invested heavily in Universal Windows Platform, which now we can benefit from the different platform it supports.
To develop for Xbox One first of all we have to Activate the Xbox One Developer Mode and later debug our UWP game on it.
Most of the Xbox setup information we are explaining here can be read in this Windows Dev Center page and its articles.
XBox One Developer Mode
Last March Microsoft announced that every Xbox One can be turned into a Game Development Kit with no extra cost, explaining the necessary steps needed to enable a Developer Mode in your console.
Important: Take in mind that for now the Developer Mode in the Xbox One is in a early pre-release, and can cause occasional crashes and data loss. Under no circumstance Wave Engine will be responsible for these problems.
The Xbox One has two modes:
- Retail Mode: The normal mode that every console user would use: You can play games and apps.
- Developer Mode: Special mode only for developers that allows the user to deploy and debug your app and games, but cannot play retail games or apps.
You can switch among every mode at any time.
Before you start
Read carefully this article:
As a summary, you need to do the following before you start developing:
- Create a Windows Dev Center account.
- Join the Windows Insider Program. This is necessary to get the Windows SDK preview.
- Have a Windows 10 PC up to date.
- Having a Xbox One connected to a network. Better if it’s wired.
- Install Visual Studio 2015 Update 2. Make sure you chose Custom install and select Universal Window Development Tools checkbox.
- Install the latest Windows 10 SDK preview build. you can get this from here.
Developer Mode activation
For activating the Developer Mode on your Xbox One, please read the following article, following carefully its instructions:
As a brief summary, you should do the following:
- Search for the Dev Mode Activation application in your Xbox One store.
- Open it and note the code displayed on screen:
- Go to developer.microsoft.com/xboxactivate and enter the previous code.
Important. If you don’t have a Dev Center account, please create one.
- After this, you will get an update for the console.
- Enter into the Dev Mode Activation, and click in Switch and restart button to switch to the Developer Mode.
Switching from and to Developer Mode will reboot the console, and will take longer than usual. Don’t panic 🙂
Once we start in Dev Mode we will see a special dashboard, with a Dev Home application big on the right side.
Switching between Retail and Developer Mode
At any moment you can switch between modes:
- To switch to Retail Mode, just open Dev Home app and click on Leave Dev Mode button.
- To switch to Developer Mode, Open the Dev Mode Activation app and click on the Switch and restart button, like in the previous section.
Create your Wave Engine game for Xbox One
The magic of UWP is based on it can be deployed on multiple platforms. Since Wave Engine supports UWP as one of its platforms, to create a Xbox One game using Wave Engine we only have to add a UWP profile to our game project.
Add UWP profile to your application.
- In your Visual Editor, click on Edit / Project Properties in the main menu.
- In the Project Properties dialog, on the Profiles tab, click on the icon to add a new profile.
- In the New Profile Dialog, select UWP in the Platform combobox. You can set its name as XboxProfile for example. Cick on Ok.
- Now we have our application with 2 profiles, one of them a UWP called XboxProfile.
Xbox One programming guidelines
You can add the UWP profile to any game and deploy to Xbox One. However, you have to take in mind that you won’t be able to use some input systems on your console by default:
It’s normal that you use the keyboard, mouse or touchs as input, specially when you develop for mobile phones. However, for Xbox One you will need to use the Gamepad as the main input device for your game.
Fortunately, using it is really easy, just accessing GamepadState property on the Input Wave Service.
To get the state, just write the next code:
// State of player one
var state = WaveServices.Input.GamePadGetState(PlayerIndex.One);
The GamepadState struct contains the following information:
- ThumbSticks. Contains two Vector2 properties with the Left and Right thumb stick positions of your controller.
- Triggers. Contains two float properties with the Left and Right triggers of your gamepad.
- Dpad. Contains the ButtonState (Pressed or Released) of the directional pad.
- Buttons. Contains the ButtonState of all the buttons of your gamepad.
For this sample we will deploy the next game scene:
The camera on this scene is a FreeCamera3D, which can already be controlled by the gamepad.
Deploy your game in Xbox One
To deploy your game you need to open the UWP Solution on Visual Studio.
In the previous case, the solution will be called TestTemple_XboxProfile.sln (because the name of the project is TestTemple and the profile is XboxProfile).
For a complete guide of how to deploy and debug your app in Xbox One please read carefully the next article:
Pair your console with Visual Studio
- In the debug area, select Remote Machine as deploy target:
- This will load a dialog, where you should enter your Xbox One IP (In this case 192.168.1.2) :
- The first time you deploy your game, you will need to Pair your console with your Visual Studio. To do that just enter in Dev Home app in your console and click on Pair with Visual Studio.
- Enter your PIN into the Pair with Visual Studio dialog. This is just an example:
- After a correct pairing, your application will be deployed and you will be able to debug your game in the Xbox One.