Porting from Xbox 360 to Xbox One

There are two ways to get started programming for Xbox One. One way is to start with the project template we’ve provided in the Visual Studio 2012 and add code to exercise the Xbox One features you’re interested in learning about. The framework provided with the Xbox One samples can be a useful way to get basic functionality so that you can concentrate on a particular area of the new Xbox One features.

The other way to get started programming for Xbox One is to port an existing Xbox 360 or Windows PC game engine or title to Xbox One. Modifying a familiar code base to work on Xbox One is a good way to learn how Xbox One development is different from Xbox 360 or Windows development. It also gives you a way to compare performance and resources between the Xbox 360, PCs and Xbox One.

To Start Porting Your Code Today

You can start working today with Direct3D 11 on a PC running Windows 7 or Windows 8 and a compatible graphics card. With the exception of the variances noted on the Graphics page, Direct3D 11 programming works the same on Xbox One as it does under Windows.

When porting existing Xbox 360 code, the first thing you should do is port it to the PC. Typically, a PC version of a game uses Direct3D 9, uses 32-bit pointers, and is built using Microsoft Visual Studio 2010 or 2012. Getting Xbox code to compile for the PC involves removing Xbox-specific API calls, accounting for the fact that Xbox and PC processors use different endianness, and other factors.

Once you have a version of your game that runs on a PC, you need to make a few big changes.

Modify your code to be 64-bit

Moving to 64-bit code means that the ported code will be using 64-bit pointers. This is not a trivial exercise. When you change to 64-bit, data structures change in subtle ways, and file formats that treat pointer values as offsets may need to be changed. You can work on moving to 64-bit using either Visual Studio 10 or Visual Studio 2012, on Windows 7 or Windows 8.

Move to using Visual Studio 2012

One prime benefit of moving to Visual Studio 2012 is that it has new support for graphics debugging that is similar to the GPU capture facility in PIX for the Xbox 360. This tool will be useful in porting your Direct3D 9 code to Direct3D 11.

Modify your code to use Direct3D 11

Moving to Direct3D 11 is a complex task because the programming model of the API changed significantly from the Direct3D 9 model. See the Resources section of this topic for links to additional guidance about porting to Direct3D 11.

D3DX has been deprecated, and is not available for Xbox One development. You must remove all dependencies on D3DX in order to run your code on Xbox One. For equivalent texture functionality currently in D3DX11 and XGraphics, refer to the frameworks “DDSTextureLoader” and “DirectXTex” described in the Graphics Overviews. The code for these frameworks is in the Xbox One samples Common folder. More information is available in this article. The DirectXTK library also provides useful helper classes for eliminating D3DX dependencies.

Existing math libraries such as XNAMath and the Xbox math functions have also been deprecated in Xbox One. You should update your code to use DirectXMath instead. DirectXMath is documented on MSDN.

Next Steps

Once you have a 64-bit version of your game running on a PC with Direct3D 11, you can start working on getting it to run on your Xbox One dev kit.

In this release, applications must be built using the Xbox One API set. To specify which API set your code will use, set the preprocessor symbol WINAPI_FAMILY to an appropriate value. Set WINAPI_FAMILY to WINAPI_FAMILY_TV_TITLE to build the application using the Xbox One API set. You can set WINAPI_FAMILY in Visual Studio by adding it to the preprocessor definitions in the project’s Properties tab. If you call the compiler directly, use the command line switch /DWINAPI_FAMILY=WINAPI_FAMILY_TV_TITLE.

Resources