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
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 Star Invaders.
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 using WinRT. You might be more familiar with win32 code to create a Windows app, but Microsoft has updated its C++ to use WinRT for the future.
Adding the DirectX12 Kit
The third tutorial runs through adding the DirectX12 Kit to our game. Read the instructions carefully on doing this.