This page goes through on how to build the 3D game for Windows 10 – it will be a Windows UWP (Universal Windows Platform) App. The UWP App means that your game will run on any Windows device, whether it’s a PC, tablet and Xbox. It will also be available to be put on the Windows Store.
I am using Windows DirectX 12 which is an API that allows you to build a 3D game.
To build this app, I am using the following resources:
- Visual Studio Community IDE / Compiler
- the book Introduction to Game Programming with Direct 3D 12.0 – – this book helps you to understand DirectX code
- code from the book – you can get it on GitHub here
- win32 DirectX documentation from Microsoft
- code from Microsoft’s DirectX 12 Tool Kit
- code from a Microsoft sample 3D game – this game uses UWP but it’s helpful to view the game specific code
- Adobe Photoshop for textures and 2D images (you can use the free Gimp app instead)
- Maya LT for 3D models and 3D levels (you can use the free Blender app instead)
- Logic Pro X (similar to Garage Band), FL Studio and Audacity (free app) for music / audio creation and recording
With Visual Studio Community, you have to download the Windows Universal tools for C++
Setting up the DirectX12 Kit
To setup the DirectX12 Kit, read the following documentation. Read the Getting Started guide, then go through the tutorials. There is also a list of DirectX11 tutorials which might be useful once you have setup the DirectX12 Kit.
The first tutorial and the second tutorial takes you through the Game Loop using win32 and winUWP respectively. On this page, I used the second tutorial as I wanted to use Windows UWP with Device Resources (DR).
You download and install the VSIX file, then create a new project.
Select the project Direct3D12 UWP Game DR (C++/WinRT) as below.
Then save it to a folder on your computer. I called my game Blindfate.
When you run it by pressing the green play button (I changed it to 64 bit)
it will look like below:
The tutorial explains what is going on.
The following classes are created:
- Game – the main game class for our game.
- IDeviceNotify – checks if the Direct3D device is created or lost
- DeviceResources – this class creates the Direct3D device and has the code to display graphics to the screen
- StepTimer – the timer for the game to keep the game running smoothly
- ViewProvider – creates the Window app.
Adding the DirectX12 Kit
The third tutorial runs through adding the DirectX12 Kit to our game. Read the instructions carefully on doing this.
Understanding the Code so far
The code contains the setup of Direct3D but doesn’t draw anything as yet except for displaying a blue window.
Some helpful references to understand how the DirectX 3D pipeline works are here:
- Learning DirectX 12
- DirectX 12 Quickstart
- the book Introduction to Game Programming with Direct 3D 12.0 helped with the detail of the code
- Code flow for DirectX12 3D graphics – this contains more code on how to render a triangle to the screen
Setting up the Xbox
You can run your game on your Xbox to test it out and see what it looks like.
To do this, follow the steps here.
Note: you will have to reboot your Xbox out of development mode to play your games.
The next thing to do is to build our game bit by bit by adding more functionality (eg: user input on keyboard/mouse and games controller) and 2D / 3D graphics as we build by following the tutorials.