This thread is to provide a careful, complete description of the Steps I have followed on June 4th and 5th, 2011 in order to get the Game Coding Complete textbook code to compile. My name is Richard McKenna (McKillaGorilla is my old trash-talking StarCraft name) and I teach 2 game programming courses at Stony Brook University (see cs.stonybrook.edu/~games). I am evaluating the GCC textbook and like the written material in the book itself, and so would like to similarly evaluate the code base, but currently have a problem that has not yet been resolved.
Forgive me for the length of my post and the fact that I include steps that should seem obvious, I'm just being thorough and outlining in careful detail any steps my students may need to follow in case I use the book. I have more than 30 steps, and would prefer not to have more than 30 emails from each student along the way trying to figure out how to get it working, plus I'd prefer for them to spend their time on the code and data structures and algorithms used rather than Visual Studio quirks.
Although if I can get this working and like the library I may just make a VS2010 project from scratch and develop my own stable build process. But that's getting ahead of myself. I have not yet committed to that sort of time investment. Of course I'm not against someone else providing that for me (hint hint, nudge nudge, know what I mean?).
Anyway, I have tried to combine the instructions as provided in the README file that comes with the code as well as the various posts on the message board. Specifically, there were 3 from Mike (the author) summarizing the steps for compilation in VS 2010. Note that step 31 down at the bottom shows where I am stuck, but the rest may provide some indication as to why this is so. Any help would be appreciated, Here are the steps I've followed. Enjoy!
1) Got GameCode3 project using TortoiseSVN using SVN Checkout gamecode3.googlecode.com/svn/trunk/ in Windows Explorer. Put full code base into my "GCC_VS2010" directory
2) Downloaded 3rdParty-2010.zip from code.google.com/p/gamecode3/do…il?name=3rdParty-2010.zip link provided by code.google.com/p/gamecode3/downloads/list
3) Unzipped 3rdParty-2010.zip to GameCode3/Source directory. While it was unzipping, I checked my fantasy baseball team and then took a nap. After the nap, the unzip process was almost finished. Once done, the contents of GameCode3/Source were:
-boost_1_45_0
-bullet-2.73
-LuaPlus
-oggvorbis-win32sdk-1.0
4) Went to GameCode3/Source directory and double
clicked on GameCode3_2005 Visual Studio Solution file,
which opens it in Visual Studio 2010. Obviously VS 2010
must be installed for this to work, and no I'm not joking.
5) Ran Visual Studio Conversion Wizard. Left selection as "Yes, create a backup before converting" and clicked "Next". I understand, this option doesn't matter, just being thorough. Clicked Finish and all 6 projects are converted without error:
-DXUT10
-Editor
-EditorApp
-GameCode3 (initially the Startup Project)
-Lang
-TeapotWars
6) Downloaded and installed the latest and greatest DirectX SDK, the June2010 version. Installed in C://Program Files (x86)/Microsoft DirectX SDK (June 2010)
7) Added property sheet in VS 2010. Here's how:
-from menu, selected View->Property Manager. This opened the Property Manager
-selected all the Projects that use DirectX (DXUT, Editor, GameCode3, and TeapotWars) using CTRL-Left Mouse Button and clicked on Add New Property Sheet
-named new property sheet WinDX and saved it to the Source Directory
-it appeared in all 4 projects at the top in both Debug and Release, so DXUT and GameCode3 listed the following 5 in this order:
-WinDX
-Upgrade from VC 7.1
-Microsoft.Cpp.Win32.user
-Unicode Support
-Core Windows Libraries
The Editor project also had Windows Dynamic Link Library sheet Teapot Wars also had an Application sheet
Opened my WinDX Property Sheet. To this sheet I only added 2 things, under VC++ Directories:
-Include Directories, I added the DirectX\Include directory
-Library Directories, I added the DirectX\Lib\x86
Note that obviously "DirectX" is just short for the June 2010 directory where it is installed. I now saved my WinDX Property Sheet settings and closed the Property Manager. Note that I did not have to reorder any property sheets.
9) Searched for "atltypes.h" in VS 2010 solution and found it referenced twice inside GameCodeStd.h . Note this is a potential source of confusion because on the message board it was listed as alttypes.h, which will not be found.
10) Saved gcctypes.h to Source directory, the same as GameCodeStd.h, as posted on message board. Then in VS2010, right-clicked on GameCode3 project->Add->Existing Item and selected the gcctypes.h file. Then commented out both #include <atltypes.h> lines and added #include "gcctypes.h" in their place. The compiler was happy with this.
11) Went to String.cpp in Dumbstuff directory and changed both occurrences of "std::string.npos" to "std::string::npos"
12) Had a very strange moment where I went to DXUT.h to change <dxerr9.h> to <dxerr.h> and found
that it was already changed. I don't recall doing that today. I thought I had done it a day or so ago in a previous attempt to get this working, but perhaps I did it without thinking. Looking at the SVN data, the last commit revision was April 2009, so I must have done it. Anyway, it should be correct now.
13) Right Clicked on the DXUT project and selected "Build". This succeeded. Note that I did not change the Output Directory for this project, and so left it as ..\..\Libs, which is where it placed the DXUT10d Object File Library.
14) Right Clicked on the Editor project and selected "Build" and AHA! Now I got the dxerr9.h error inside the Source\DX10\dxstdafx.h file that I was expecting before. This is a bit tricky because when I searched the VS2010 solution for "dxerr9.h" it does not come up because it is an "External Dependency" I presume. Anyway, I now changed "dxerr9.h" to "dxerr.h" and that error went away. The build failed, however, due to 4 compiler errors inside GameCodeStd.h, which is actually inside the GameCode3 project and is included by Editor.h. The compiler flagged:
#include <boost\config.hpp>
#include <boost\shared_ptr.hpp>
#include <boost\utility.hpp>
using boost::shared_ptr;
The error message read "fatal error C1083: Cannot open include file: 'boost\config.hpp': No such file or directory". Here is where my previous attempts really started to go haywire.
15) In looking at the Editor project properties, I saw that for "Additional Include Directories", it lists "$(SolutionDir)3rdParty\boost_1_37_0", which is the wrong version of boost. The 3rdParty-2010.zip file came with version 45. So, I simply changed the 37 to 45. I did the same for the GameCode3 and TeapotWars project properties pages and when I did I saw the "Additional Include Directories" is listed as "$(SolutionDir)\3rdParty\boost_1_37_0", which is slightly different. It had a "\" after $(SolutionDIr). This was true of all similar listings, which was not true for the Editor project. Having used Visual studio for more than a decade my mind is a jumbled mess of all the various versions and their conventions. I can't remember what it should be, but I assume there should be a slash and that it's not implied by $(SolutionDir). Plus, an extra slash wouldn't do any harm would it? It probably doesn't matter, but anyway, I went to the Editor project and added it for all the $(SolutionDir)\ references. I then did the same for the Teapot Wars project properties.
16) Now I went back to the Editor project and tried to build it and I hit the motherload. When it builds, it flagged every reference to Lua and boost, and even some stuff inside of Lua and boost. We're talking a mile of compiler errors. The hope here is this can be resolved all at once and not one at a time.
17) I started with the first one listed, "gamecode3\source\actors.h(128): error C2061: syntax error : identifier 'LuaObject'", which is one of many in that file. I've figured out that Lua uses the LuaPlus namespace, so I added "using LuaPlus::LuaObject;" after #include "LuaPlus/LuaObject.h" inside actors.h. I rebuild and that error is gone.
18) Similar problems in source\scripting \LuaStateManager.h . It flagged all sorts of lua types, so I added:
using LuaPlus::LuaStateOwner;
using LuaPlus::LuaObject;
after the other lua includes. This took care of those compiler errors.
19) I'll skip the boost errors for now and just handle the lua stuff, so next up was source\scripting\scripteventlistener.cpp. I added:
using LuaPlus::LuaFunction;
using LuaPlus::LuaState;
after the includes and resolved these errors.
20) Next up was Events.h, to which I added "using LuaPlus::LuaState;"
21) Next is AiEvents.h, to which I added:
using LuaPlus::LuaObject;
using LuaPlus::LuaState;
22) Next is EventManager.h, to which I added "using LuaPlus::LuaState;"
23) Next is PhysicsEventListener.h, to which I added "using LuaPlus::LuaState;"
continued ...
Forgive me for the length of my post and the fact that I include steps that should seem obvious, I'm just being thorough and outlining in careful detail any steps my students may need to follow in case I use the book. I have more than 30 steps, and would prefer not to have more than 30 emails from each student along the way trying to figure out how to get it working, plus I'd prefer for them to spend their time on the code and data structures and algorithms used rather than Visual Studio quirks.
Although if I can get this working and like the library I may just make a VS2010 project from scratch and develop my own stable build process. But that's getting ahead of myself. I have not yet committed to that sort of time investment. Of course I'm not against someone else providing that for me (hint hint, nudge nudge, know what I mean?).
Anyway, I have tried to combine the instructions as provided in the README file that comes with the code as well as the various posts on the message board. Specifically, there were 3 from Mike (the author) summarizing the steps for compilation in VS 2010. Note that step 31 down at the bottom shows where I am stuck, but the rest may provide some indication as to why this is so. Any help would be appreciated, Here are the steps I've followed. Enjoy!
1) Got GameCode3 project using TortoiseSVN using SVN Checkout gamecode3.googlecode.com/svn/trunk/ in Windows Explorer. Put full code base into my "GCC_VS2010" directory
2) Downloaded 3rdParty-2010.zip from code.google.com/p/gamecode3/do…il?name=3rdParty-2010.zip link provided by code.google.com/p/gamecode3/downloads/list
3) Unzipped 3rdParty-2010.zip to GameCode3/Source directory. While it was unzipping, I checked my fantasy baseball team and then took a nap. After the nap, the unzip process was almost finished. Once done, the contents of GameCode3/Source were:
-boost_1_45_0
-bullet-2.73
-LuaPlus
-oggvorbis-win32sdk-1.0
4) Went to GameCode3/Source directory and double
clicked on GameCode3_2005 Visual Studio Solution file,
which opens it in Visual Studio 2010. Obviously VS 2010
must be installed for this to work, and no I'm not joking.
5) Ran Visual Studio Conversion Wizard. Left selection as "Yes, create a backup before converting" and clicked "Next". I understand, this option doesn't matter, just being thorough. Clicked Finish and all 6 projects are converted without error:
-DXUT10
-Editor
-EditorApp
-GameCode3 (initially the Startup Project)
-Lang
-TeapotWars
6) Downloaded and installed the latest and greatest DirectX SDK, the June2010 version. Installed in C://Program Files (x86)/Microsoft DirectX SDK (June 2010)
7) Added property sheet in VS 2010. Here's how:
-from menu, selected View->Property Manager. This opened the Property Manager
-selected all the Projects that use DirectX (DXUT, Editor, GameCode3, and TeapotWars) using CTRL-Left Mouse Button and clicked on Add New Property Sheet
-named new property sheet WinDX and saved it to the Source Directory
-it appeared in all 4 projects at the top in both Debug and Release, so DXUT and GameCode3 listed the following 5 in this order:
-WinDX
-Upgrade from VC 7.1
-Microsoft.Cpp.Win32.user
-Unicode Support
-Core Windows Libraries
The Editor project also had Windows Dynamic Link Library sheet Teapot Wars also had an Application sheet
Opened my WinDX Property Sheet. To this sheet I only added 2 things, under VC++ Directories:
-Include Directories, I added the DirectX\Include directory
-Library Directories, I added the DirectX\Lib\x86
Note that obviously "DirectX" is just short for the June 2010 directory where it is installed. I now saved my WinDX Property Sheet settings and closed the Property Manager. Note that I did not have to reorder any property sheets.
9) Searched for "atltypes.h" in VS 2010 solution and found it referenced twice inside GameCodeStd.h . Note this is a potential source of confusion because on the message board it was listed as alttypes.h, which will not be found.
10) Saved gcctypes.h to Source directory, the same as GameCodeStd.h, as posted on message board. Then in VS2010, right-clicked on GameCode3 project->Add->Existing Item and selected the gcctypes.h file. Then commented out both #include <atltypes.h> lines and added #include "gcctypes.h" in their place. The compiler was happy with this.
11) Went to String.cpp in Dumbstuff directory and changed both occurrences of "std::string.npos" to "std::string::npos"
12) Had a very strange moment where I went to DXUT.h to change <dxerr9.h> to <dxerr.h> and found
that it was already changed. I don't recall doing that today. I thought I had done it a day or so ago in a previous attempt to get this working, but perhaps I did it without thinking. Looking at the SVN data, the last commit revision was April 2009, so I must have done it. Anyway, it should be correct now.
13) Right Clicked on the DXUT project and selected "Build". This succeeded. Note that I did not change the Output Directory for this project, and so left it as ..\..\Libs, which is where it placed the DXUT10d Object File Library.
14) Right Clicked on the Editor project and selected "Build" and AHA! Now I got the dxerr9.h error inside the Source\DX10\dxstdafx.h file that I was expecting before. This is a bit tricky because when I searched the VS2010 solution for "dxerr9.h" it does not come up because it is an "External Dependency" I presume. Anyway, I now changed "dxerr9.h" to "dxerr.h" and that error went away. The build failed, however, due to 4 compiler errors inside GameCodeStd.h, which is actually inside the GameCode3 project and is included by Editor.h. The compiler flagged:
#include <boost\config.hpp>
#include <boost\shared_ptr.hpp>
#include <boost\utility.hpp>
using boost::shared_ptr;
The error message read "fatal error C1083: Cannot open include file: 'boost\config.hpp': No such file or directory". Here is where my previous attempts really started to go haywire.
15) In looking at the Editor project properties, I saw that for "Additional Include Directories", it lists "$(SolutionDir)3rdParty\boost_1_37_0", which is the wrong version of boost. The 3rdParty-2010.zip file came with version 45. So, I simply changed the 37 to 45. I did the same for the GameCode3 and TeapotWars project properties pages and when I did I saw the "Additional Include Directories" is listed as "$(SolutionDir)\3rdParty\boost_1_37_0", which is slightly different. It had a "\" after $(SolutionDIr). This was true of all similar listings, which was not true for the Editor project. Having used Visual studio for more than a decade my mind is a jumbled mess of all the various versions and their conventions. I can't remember what it should be, but I assume there should be a slash and that it's not implied by $(SolutionDir). Plus, an extra slash wouldn't do any harm would it? It probably doesn't matter, but anyway, I went to the Editor project and added it for all the $(SolutionDir)\ references. I then did the same for the Teapot Wars project properties.
16) Now I went back to the Editor project and tried to build it and I hit the motherload. When it builds, it flagged every reference to Lua and boost, and even some stuff inside of Lua and boost. We're talking a mile of compiler errors. The hope here is this can be resolved all at once and not one at a time.
17) I started with the first one listed, "gamecode3\source\actors.h(128): error C2061: syntax error : identifier 'LuaObject'", which is one of many in that file. I've figured out that Lua uses the LuaPlus namespace, so I added "using LuaPlus::LuaObject;" after #include "LuaPlus/LuaObject.h" inside actors.h. I rebuild and that error is gone.
18) Similar problems in source\scripting \LuaStateManager.h . It flagged all sorts of lua types, so I added:
using LuaPlus::LuaStateOwner;
using LuaPlus::LuaObject;
after the other lua includes. This took care of those compiler errors.
19) I'll skip the boost errors for now and just handle the lua stuff, so next up was source\scripting\scripteventlistener.cpp. I added:
using LuaPlus::LuaFunction;
using LuaPlus::LuaState;
after the includes and resolved these errors.
20) Next up was Events.h, to which I added "using LuaPlus::LuaState;"
21) Next is AiEvents.h, to which I added:
using LuaPlus::LuaObject;
using LuaPlus::LuaState;
22) Next is EventManager.h, to which I added "using LuaPlus::LuaState;"
23) Next is PhysicsEventListener.h, to which I added "using LuaPlus::LuaState;"
continued ...
Richard McKenna
Lecturer
Computer Science Department
Stony Brook University
Lecturer
Computer Science Department
Stony Brook University