Jump to content

  • Log In with Google      Sign In   
  • Create Account

Like
18Likes
Dislike

Game Development with Win32 and DirectX 11 - Part 00: Setup

By Josh Vega | Published Dec 11 2013 12:00 AM in Game Programming
Peer Reviewed by (NightCreature83, Dave Hunt, Bacterius)

C++ Win32 DirectX 11


Writing a complete game from scratch can be difficult, even for a seasoned programmer. In this tutorial series, I'll walk you through the development process of a full-fledged game written from the ground up. It may sound easy, but it has a pretty steep learning curve. If at any point thoughout this series you have trouble or are unable to figure out how to get something to work properly, feel free to PM me and I'll get back to you ASAP (please do a web-search of your question first though).

Prerequisites


Now, some of you might be wondering why we are using Win32 rather than a cross-platform wrapper like SDL or GLFW. Well, since we'll be using Microsoft DirectX to handle everything from our graphics to our sound, there's really no need for a cross-platform solution. Using Win32 may not be as easy as SDL or GLFW, but it will allow for a much more customizable user experience.

Before we get started though, we need to make sure you have all the prerequisites required for this tutorial series.

Note:  
These are not the only prerequisites you will need. As the series progresses, we'll be adding more dependencies.


Experience


The first and most important prerequisite for this tutorial is C++ experience. This tutorial is not intended for C++ newcomers. I recommend you have knowledge of, and experience working with all or most of the following C++ concepts:
  • Using and writing operator methods
  • Dynamic memory management
  • Using and writing namespace, classes, and structures
  • Using friendship, inheritance, and polymorphism
  • Templates
  • Exceptions
  • Type casting
  • C++11 changes
If you believe you do not fully understand one or more of the topics listed above, I recommend you 1) Bookmark this page so you can come back to it later, and 2) Research and learn about the topic(s) in which you believe (or know) you are lacking in. In order to keep the lessons quick and to-the-point, I will refrain from explaining and teaching about C++ related topics (unless it is extremely rare and I have no expectation that you would know about it without having used it before).

I also recommend you have some experience actually writing programs in C++ using some of the topics listed above (it's one thing to read about a concept and another to put it into practice).

Software


Knowledge and experience aren't the only things needed for this tutorial series. You'll need the help of a few software packages to get the most out of this tutorial series. Though it is possible to substitute most of the packages listed below with other packages (possibly open-source), I will not explain how to do so as this tutorial series is designed to be used with the packages below.

Microsoft Windows

Obviously this is the most important piece of software you'll need. Without a complete, working Windows environment, you would have nowhere to compile or test your code. I recommend that you do not install Windows through a virtual machine as this will severely increase compiling time and keep you from being able to properly test your project. For this tutorial series I will be using Windows 7 Professional 64-bit. This tutorial is not tailored for use with any other Windows version (e.g. Vista or 8), although I don't see any reason why it wouldn't work with Windows 8 (though I currently am unable to test it). I also recommend using a 64-bit install of Windows as it will allow you the ability to use more than 4GB of RAM, allowing for more available memory (if you have more than 4GB).

Note:  
Microsoft Windows XP and prior do not support DirectX 11.


Microsoft Visual Studio 2010

Now, we'll need a compiler. I've opted for Visual Studio rather than open-source equivalents because I have a lot of experience with it. Now, if you want to download Visual Studio, you can go to the Visual Studio download page and grab Visual C++ Express 2010. I will be using Visual Studio 2010 Professional, but this turorial series is designed for use with Express. If you will be using Visual Studio 2012, you will need to change your Platform Toolset setting for the project (please find a tutorial on how to do so).

Microsoft DirectX SDK

Without the DirectX SDK, you would have no way of using any of the DirectX modules. You will need to pick up the latest one (June 2010) from the download page. After installation, it should create a folder in your Program Files (or Program Files (x86) on 64-bit Windows) called Microsoft DirectX SDK (June 2010). In here is pretty much everything you need to get working with any of the DirectX modules. Please note that for graphics, we will be using Direct3D 11. The June 2010 SDK is currently the only SDK version that supports Direct3D 11 and thus using a prior one will not allow you to complete this tutorial series properly.

Note:  
In Microsoft Windows 8 and above, you will need to download the Windows SDK rather than the file above (the DirectX SDK comes packaged with the Windows SDK).


Lesson Tasks


Please perform the following actions to prepare yourself for the next tutorial:

  1. Install all of the software packages described above (or your chosen equivalent).

Coming Up...


In the next tutorial, we'll get the Visual Studio project set up and make sure all the dependencies are in order.



License


The GNU Lesser General Public License (LGPLv3)




Comments
If you are going to use PIX in future documents for debugging, please be aware that this will not work on windows 8 any more. MS has moved graphics debugging into VS2012 Pro and hasn't updated pix to understand the DX11.1 runtime.

Other then that I am willing to test your solution tutorials on Win8 for you and check what's different.

Seeing you are recommending a 64-bit windows install, why not also make the tutorial about 64-bit programming.

Yeah, I relized that after I finished writing the article. I'm gonna try to keep graphics debugging to a minimum, but I realize that there's gonna come a point where I will need to do so. I'm also going to make sure and use D3D_FEATURE_LEVEL_11_0. I also have a VS2012 Pro license so I can write both the tutorial for both methods.

 

Testing the solutions under Win8 would be a big help. Thanks.

 

That was one of the things I was contemplating before writing this article. I then decided to go with 32-bit because I understand that there are going to be those who won't be able to get their hands on 64-bit Windows (or hardware that supports it).

Exactly what I'm looking for... =)

Exactly what I'm looking for... =)

 

Glad to hear! Hopefully I can get the next lesson (still in writing) published sometime next early next week.

Awsome, can't wait for the next lesson :)

 

How many do you think there will be in total?

Awesome. I'm all ears.. errm. eyes. :)

How many do you think there will be in total?

 

Really I'm not sure... I only have a plan for the next 5 or 6 lessons so far, but I do have a list of other concepts I'm planning on adding to the series later on. Some of them include:

 

  • Skeletal Mesh loading and animation (using assimp).
  • Joystick & game-pad input (using XInput).
  • Client-Server multiplayer.
  • Client-Client multiplayer.
  • Scripting language implementation (most likely Python or Lua).
  • High-end graphics techniques (e.g. real-time global illumination).
  • Procedurally generated terrain (or maps).
  • Doppler effect (for accurate sound simulation).

 

Once all these (and whatever else I think up) are completed, I'm thinking of maybe switching pace a bit and writing a "Game Development with X11 and OpenGL 4.3" type series that will cover the same concepts, just for X11/OpenGL rather than Win32/DirectX.

 

Right now though, I'm just focusing on writing a set of good introductory tutorials.

If you are going to use PIX in future documents for debugging, please be aware that this will not work on windows 8 any more. MS has moved graphics debugging into VS2012 Pro and hasn't updated pix to understand the DX11.1 runtime.

btw graphics debugging is now free in VS2013 Express edition and it understands Direct3D 11.1, 11.2

Warning: if you read a DX Book in one week, means that you've understood nothing. 


Note: Please offer only positive, constructive comments - we are looking to promote a positive atmosphere where collaboration is valued above all else.




PARTNERS