Getting The Game Running With Visual Studio

"Dr. Dobb's Challenge" was created in the Visual Studio 2008 environment.  After downloading and unzipping the source code to a working directory, simply open the Dobb.sln solution file from within Visual Studio 2008 by using "Open -> Project/Solution" from the File menu.

2008_02_25_open.jpg

In the Solution Explorer in the column on the left, you will see three project subfolders:  Header Files, Resource Files, and Source Files.  Clicking on the "+" icons will expand the respective folder to display its contents.  Subsequently, double-clicking on any of the files within a folder will open it for viewing.

As you would expect, all of the header files are included in the Header Files folder.  Resource Files contains all of the levels in text format, as well as a blank level template, aptly named levelTemplate.txt.

2008_02_25_explore.jpg


Expanding the Source Files folder reveals that there are four subcategories within:  Core, Entities, GUI, and Levels.  The Core folder contains all of the core components of the game, including sound, input and sprite.  The WinMain() and WindowProc() methods are also defined in main.cpp within this folder.

The Entities folder contains all of the game entity components:  AI, terrain, tokens, and the player class.  All entities stem from the parent class CEntity, as defined in entity.cpp.  The CLevel class is also included in this folder since it handles where entities need to be loaded in each level.

And finally, the GUI folder contains the classes for the Main Menu and Game (mainmenu.cpp and game.cpp respectively).  As the folder name indicates, these handle the interface between the user and the game.

To build the solution, select "Build Solution" from the "Build" menu or simply press F7.  This will compile and link all of the necessary source code and create an executable in the build directory for the selected configuration.  In this solution, there are two configurations:  Release and Debug.  And in the screenshot below, you can see the "Release" configuration is currently selected just below the "Help" menu heading, so the DobbChallenge.exe executable can be found in the "Release/" subdirectory.

2008_02_25_run.jpg 

To run the solution, select "Start Debugging" from the "Debug" menu or simply press F5.  Note that if you skip the build step described above and go straight to "Start Debugging", it will automatically compile and link your solution, if necessary.

2008_02_25_run.jpg 

And there you have it, the basics to navigating and compiling your new Visual Studio Solution.  And now for the fun and gritty details of game development.


DDJ