3D Game App Version 1

To make the game, I am reading the book Introduction to 3D Game Programming with DirectX 12 by Frank D. Luna. Using this book has got me to the furthest point in getting close to creating a 3D game, though I still have a long way to go.

So far, I was able to show some of the book’s 3D models and textures on the screen as a 3D scene and also got the player to move around the 3D scene with the keyboard and mouse.

The code implements the following:

  • game loop including a timer
  • code to show graphics on the screen including 3D models and textures
  • camera to show the screen from different points of view
  • user or gamer input such as keyboard and mouse
  • lots of maths code 🙂

See the screenshots below:

Wireframe view (when you press “1”) – the skull and car were created by the book’s author using 3D modelling software. The ground, buildings, columns with spheres were created using code from the book.

A birds eye view of the game. The 3D environment is only small. I use the W,A,S,D to move forward / back with A/D rotating, space bar to fly up, X to fly down, Q/E to strafe left and right, and the mouse to move around as well as rotate.

The code base, textures and models from the book are here.

You can download here here and run the app.

I can’t publish the code due to copyright as it’s the condition of using the book, but I can describe how I have utilised the book. Later on the website, I will add sections bit by bit as I rewrite the code and use my own images and 3D models. The book encourages you to read it and study the code given, then to rewrite it to suit your app – in this case our game. I will provide relevant links to the book’s code as well.

The first thing I did was to create a Windows Desktop project using Visual Studio Community. Note that my game name is “BlindFate”.

I then downloaded all the common files and put them into Visual Studio Community. I then created the files Blindfate.cpp and Blindfate.h – these are the main game app files.

With the files Blindfate.cpp and Blindfate.h, I used the “Shapes Demo” of Chapter 7.

I then adapted the code from ShapeApp.cpp from Chapter 7 and put it into Blindfate.cpp and you have to use the changes using the other files in the Shapes Demo.

The book’s textures were used – I didn’t use many, just the bricks, stone and tile textures. I used some of the Chapter 7 demo code to implement the textures.

The book’s 3D models were used – the skull and car.

It’s clever how the author used mathematics to create the other 3D models such as floor or ground, the rectangular boxes and the columns with spheres.

I also used the book’s camera code by looking at the Chapter 15 demo code. That way I could adapt it to my app.

I added more keyboard and mouse code to add the functionality I was looking for.

There is a lot more in the book which I haven’t tried yet such as adding a sky, mountains, water, shading and character animation.

Also I will need to research how to add music, sound effects and voice. Some items may be available in the DirectX12 Tool Kit from Microsoft