Torque/vs2k5

From TDN

Guide to Compiling TGE 1.4 or 1.5 with Visual Studio 2005 Express & Visual Studio 2008 Express



TGE 1.4 and TLK 1.4 require a patch (described below) - later versions support VC2005 out-of-the-box and do not require a patch.



Compilation of resources/forum threads by Matt Fairfax, Ray Gebhardt and other helpful parties. Blame any errors and typos on Chris Calef. Better yet, fix them, it's a Wiki!

Microsoft currently is offering the compiler for free and is a perfect fit with an indie budget in mind. Why would you need a compiler? A compiler is required in order to change the engine source code. There have been several improvements to the engine made by other TDN developers that you will want to incorporate into your engine as well as bug fixes posted on forums.

Contents



If you are using TGE 1.4.2 or higher (including TGE 1.5.X) then skip
step #2.




Warnings

First, a couple of minor warnings:

1) If you are running Windows 2000, you will need Service Pack 4.

2) If you have a nonstandard drive configuration, you will still need 420 megs free on your C: drive (or it could be whatever drive has your main windows directory.) You can install the program wherever you want, however.

3) You will be required to install Internet Explorer, SP1


Directions


There are two different ways to get it to work. The new directions are recomended.


New Directions

(head down to the bottom of this page for older/more tested directions which are a little harder to use)


1) Start by navigating to: http://www.microsoft.com/express/2005/

 

Image:TGB001-02-10-vc-download.jpg

 

From this page, there are three steps you need to follow (assuming you don’t have any prior beta version installed). Start by clicking the Download link and saving it to your computer. When it’s finished, you should have a file called vcsetup.exe. Run it:

 

Image:TGB001-03-vc-setup_1.png

 

NOTE: If vcsetup.exe just hangs for hours and hours or if you prefer to have the installation files on CD, you can also download an image over here: http://msdn.microsoft.com/vstudio/express/support/install/ and burn it on a CD!

Here, you can choose to send your setup experience to Microsoft. I always choose to. It can’t hurt, right? When you’ve made your decision, click Next.

 

Image:TGB001-04-vc-setup_2.png

 

Accept the license agreement, then click Next.

 

Image:TGB001-05-vc-setup_3.png

 

For building Torque-based games, you really only need the Graphical IDE. If you want additional help, above and beyond what http://msdn.microsoft.com/ provides, select Microsoft MSDN 2005 Express Edition. You do not need SQL Server Express Edition, as any online game you build will use whatever database engine your ISP provides (like mySQL or MS Access). Click Next.

 

Image:TGB001-06-vc-setup_4.png

 

I recommend the default install path. Go ahead and click Next to begin the download and install process. This will take a while, depending on whether you selected MSDN Express Edition and the speed of your internet connection…

 

Image:TGB001-07-vc-setup_5.png

 

…zzzZZZzzz… Almost there!

 

Image:TGB001-08-vc-setup_6.png

 

At the completion of the install you will see this screen:

 

Image:TGB001-09-vc-setup_7.png

 

You must register within 30 days. Once you register, the software is free to use forever after, so register now to get that hurdle out of the way (Click Register Now and follow the instructions). When you are done registering, click Exit.



Note there is no need for the following patch (Step 2) if you have TGE v1.5. You can skip to step 3.

2) Download the patch for TGE for VS2005 Express Edition from here:

http://tdn.garagegames.com/wiki/images/e/e8/TGE_VS2005.zip

Or the VS2005 Express Edition update for the Torque Lighting Kit (TLK):

http://tdn.garagegames.com/wiki/images/1/1d/TLK_VS2005.zip


Extract this archive into your <torque dir> folder. It should create a new folder called VS2005 in the same folder where the vc6 and vc7 folders are located. It should also create the new folder <torque dir>\lib\MSPlatformSDK.

It should also prompt you to overwrite these files (they needed to be updated to work with VS2005):

<torque dir>\lib\directx8\basetsd.h
<torque dir>\lib\maxsdk40\imtl.h
<torque dir>\tools\max2dtsExporter\exporter.rc
<torque dir>\tools\ms2dtsExporter\DTSPlugin.cpp
<torque dir>\tools\ms2dtsExporter\resource.rc

Ok, let's prepare Torque:

3) Open up Visual C++ 2005 Express Edition Beta. Choose File->Open->Project/Solution and browse to <torque dir>\VS2005\Torque SDK.sln

4) Now right-click on Torque Demo in the Solution Explorer and choose "Properties" (at the bottom). Under "Configuration Properties" left click on "Debugging". On the right put in ../example in the "Working Directory" property. Next, choose "Release" from the "Configuration" drop down at the top left. Put in ../example in the "Working Directory" property here also.

Now to compile:

5) In the menu goto Build->Build Torque Demo or right-click on the top toolbar and select "Build" from the menus listed there. This'll bring up a floating menu (I always doc mine immediately). The button on the left builds the current project, the middle button builds the entire solution, and the right button cancels an in-progress build. You can just hit the one on the left.

6) Assuming we have it all configured correctly you should see a few warnings but in the end you will get:

Torque Demo - 0 error(s), 8 warning(s)
========== Rebuild All: 7 succeeded, 0 failed, 0 skipped ==========

Running Torque:

7) Since we set the "Working Directory" above all we have to do is click the green Start button in the middle of the upper menu. You can also hit F5 or goto Debug->Start. Torque should start up!

Old Directions



1) Download Visual C++ 2005 Express Edition from here: http://msdn.microsoft.com/vstudio/express/visualC/default.aspx .

Install it.


2) Download the Microsoft Windows Platform SDK

The Platform SDK thing is BIG. It unzips to a full gig if you don't turn off any of the optional stuff, and at best I think it's still around 700 megs. Even compressed it's several hundred megs of download, and goes even slower than you would expect because Microsoft's site seems to always be getting hammered. (at least as of 11/29/05 or so.)

To help people with slow connections deal with this problem, I created a stripped-down version containing basically nothing but what you need to build Torque. Obviously, if you want a fully-functional compiler capable of creating a wide range of windows software, you should download the full thing. But if you only want to compile Torque and you don't care about anything else, and you have connection or hard drive limitations, go ahead and download the minimalist version here:

http://public.garagegames.com/chrisc/TBE/MSPlatformSDK.zip

Go here for the full:

http://tinyurl.com/cew8e (Select the correct architecture for your machine)

Whichever version you use, either double click on the installer and let it go to its default, or else unzip the zip file to Program Files. Either way you should end up with a directory called Program Files/Microsoft Platform SDK.

Now that you have the basic compiler installed, find the executable (or the desktop shortcut, or the link from your Start Menu, whatever you like to use) and click on it. Make sure the IDE opens up and shows you the "Visual C++ 2005 Start Page". If this comes up, you're on your way!
Ok, let's prepare Torque:

3) Open up Visual C++ 2005 Express Edition Beta. Choose File->Open->Project/Solution and browse to <torque dir>\vc7\Torque SDK.sln

4) At this point it will open up the Visual Studio Conversion Wizard. Hit Next, choose Yes, create a backup before converting (if you like), Next, and Finish. It will convert the projects. It will say some didn't convert but that doesn't seem to make a difference in compiling TGE.

5) Delete "basetsd.h" from the lib\directx8 folder in the Torque SDK. This is now a system library in newer versions of the platform SDK. If you don't delete it, the "basetsd.h" in DirectX 8 will override the "basetsd.h" in the platform SDK.

6) Disable building of the projects max2dtsExport Max3, max2dtsExport Max4 and ms2dtsExporter (I am pretty sure these projects are no longer used by most people anyways).

7) Change the properties of each project so that Configuration Properties -> C/C++ -> Language -> Treat wchar_t as Built-in Type is equal to No.

(you will have to do this for each project).

8) Now we need to point Visual Studio at the files in the Platform Core SDK so that it can use them for compilation:

Goto Tools->Options. Expand "Projects and Solutions" on the left and click on "VC++ Directories"

Choose "Include files" from the "Show directories for:" drop down in the top right. Add this entry (click on the button that looks like a folder):

    C:\Program Files\Microsoft Platform SDK\Include

Choose "Library files" from the "Show directories for:" drop down in the top right. Add this entry (click on the folder looking button):

    C:\Program Files\Microsoft Platform SDK\Lib

9) Now right-click on Torque Demo in the Solution Explorer and choose "Properties" (at the bottom). Under "Configuration Properties" on the left click on "Debugging". On the right put in ../example in the "Working Directory" property. Next, choose "Release" from the "Configuration" drop down at the top left. Put in ../example in the "Working Directory" property here also.

10) (Whoops, one more, thank you Vernon Finch!) Right click on Torque Demo in the solution explorer and choose properties. Select Linker > Input, and click on Additional Dependencies. I had to add in "User32.lib", "gdi32.lib" and "Advapi32.lib". After that it built fine for both debug and release.


If you made it through all that, go up to File -> Save All, to make sure Visual Studio remembers all these project changes. (You don't want to have to do them again!)


Now to compile:

11) In the menu goto Build->Build Torque Demo or right-click on the top toolbar and select "Build" from the menus listed there. This'll bring up a floating menu (I always doc mine immediately). The button on the left builds the current project, the middle button builds the entire solution, and the right button cancels an in-progress build. You can just hit the one on the left.

12) Assuming we have it all configured correctly you should see a bunch of warnings but in the end you will get:

Torque Demo - 0 error(s), 62 warning(s)
========== Build: 7 succeeded, 0 failed, 0 skipped ==========

Running Torque:

12) Since we set the "Working Directory" above all we have to do is click the green Start button in the middle of the upper menu. You can also hit F5 or goto Debug->Start. Torque should start up!

Gotch'yas - Set Startup Project


"You set your working-Directory but are still getting "main.cs not found" when doing run/debug from Visual Studio 2008"

Look at the Solution-Explorer panel, and notice which 'project' is in BOLD FACE. This is the "start-up project" and it should be set to Torque-Demo. If it's not (or just to double-check), right-click on 'Torque-Demo' and click Set as Startup Project. Now that Torque-Demo is in bold, in the main-menu bar hit Debug > Start Debugging and Torque should start-up as you would expect. If not, you have a different problem than I did (or just more problems)...  ;-) ~SGP


Quick Note


Just a quick but important note: when adding the line C:\Program Files\Microsoft Platform SDK\Include, make sure it's spelt Include with a (capital). Not include (lowercase). Maybe this will save some headaches. If you're unsure, just search for that directory on your computer to make sure its looking for the right folder.

Conclusion


Good luck, have fun!!