Code/Visual C Project SDK

From TDN

This page is a Work In Progress.

How do I create a new Visual C++ Project from the SDK?

I see a lot of people asking "How do I create a new Visual C++ project from the SDK" or just asking "How do I start a new game project." To that end, I assembled this mini-tutorial and since I see this question so often in the forums, TDN seemed like a good place for it.


Solution: New Game Project with VC7

You only need to do this if you know (or are pretty sure that you know) that you will be editing the source code included with the Torque SDK to build your game. If you don't think you'll need to do any C++ programming, and are certain you can build it just using the Torque Scripting Language, then you don't need to do all of this.


1. Download TorqueGameEngineSDK-1-4.exe from the GarageGames website from Your Account page.

2. Run TorqueGameEngineSDK-1-4.exe and let it install to C:\Torque\SDK

3. Make sure that .cc and .cp files are registered correctly with VC7 by right-clicking on the file "C:\Torque\SDK\vc7\VC7 .cc compiling.reg" and selecting "Merge" and then answering "Yes"

4. Come up with name for your game that you can live with for awhile (I'll be using "mygame" for this set of instructions)

5. Create a new folder at the root of your C:\ Drive that will be the name of your project (c:\mygame)

6. Copy all the contents of C:\Torque\SDK to c:\mygame

7. Delete c:\mygame\uninst-tsdk.exe

8. Delete c:\mygame\ReadMe.html

9. Open .\vc7\Torque SDK.sln in VC++

10. In the solution explorer, right-click on select Project Dependencies

11. For each Dependency that is _NOT_ checked, you can (a) delete the project in the solution

  • for version 1.4, I deleted these projects from the solution:
    • buildWad
    • dtsSDK
    • fonttool
    • langc
    • map2dif
    • map2dif plus
    • max2dtsExporter
    • max2dtsExporterPlus
    • max2mapExporter
    • maya2dtsExporter
    • ms2dtsExporter
    • Torque Tool Lib

12. Select "File --> Save TorqueDemo as..." and save your new project using the same name as the project folder (ie. mygame)


13. Back in the .\vc7 folder, you can now delete the project files that correspond to the projects you just removed from the solution.

  • for version 1.4, I deleted these project files:
    • buildWad.vcproj
    • dtsSDK.vcproj
    • dtsSDKPlus.vcproj
    • fonttool.vcproj
    • langc.vcproj
    • map2dif plus.vcproj
    • map2dif.vcproj
    • max2dtsExporter_Max3.vcproj
    • max2dtsExporter_Max4.vcproj
    • max2mapExporter.vcproj
    • maya2dtsExporter_Maya6.vcproj
    • ms2dtsExporter.vcproj
    • Torque Tool Lib.vcproj

14. Going up one folder to the "mygame" directory, you can now delete the folders:

  • vc6
  • pb
  • tools

15. Going down to the "lib" directory, you can now delete the folders:

  • dtsSDK
  • dtsSDKPlus
  • maxsdk31
  • maxsdk40
  • mayamacsdk5
  • mayasdk4
  • mayasdk5
  • mayasdk6

16. Going back to the .\vc7 folder, rename the solution file "Torque SDK.sln" to your game name (ie. mygame.sln)

17. Delete the files Torque SDK.ncb, Torque SDK.opt,and Torque SDK.suo in .\vc7

18. Open mygame.sln

19. Now you'll notice that the Torque Demo project in your solution is still named "Torque Demo" but if you look at its properties, you can see that it points to "mygame.vcproj" -- now we can rename it

20. Rename the "Torque Demo" project to match your game name (ie. MyGame)

21. Back in the .\vc7 folder, you can now delte the files Torque Demo.vcproj, and Torque Demo.ncb -- there are still some "Torque Demo" files we have to rename, so don't delete any other "Torque Demo" files yet...

22. Still in the .\vc7 folder, rename "TorqueDemo.rc" to match your game name (ie. mygame.rc)

23. In the solution explorer, expand your project and right-click on the "Source Files" folder, selct "Add --> Add Existing" and add your mygame.rc

24. Remove the TorqueDemo.rc

25. Now, expand your game project in the solution explorer until you get to "MyGame --> Source Files --> core" and double-click on TorqueConfig.h

26. Edit TORQUE_GAME_NAME

27. Edit TORQUE_GAME_VERSION_STRING

28. Save and close TorqueConfig.h


To compile to a diffrent folder select the project property page/Configuration Properties/Linker/General and set the output File path there


EDIT You have to do this for both the Release and the debug it's probably wise to add a _DEBUG to the name of the .exe but it's up to you. You can change the release and the debug from the selection box in the upper left of the dialog. Also, it might be a good idea to do the same thing for the glu2d3d and opengl2d3d projects within the solution. UNSURE if it is needed but you might want to copy the dll's OpenAL32.dll and wrap_oal.dll from the example folder over to your new folder. END EDIT


29. Scroll-up to the top of the solution explorer and highlight the solution

30. From the build menu, select "Configuration Manager" and set your solution to either "RELEASE" or "DEBUG" (probably want debug right now)

31. BEFORE you build your solution, close VC++ and COPY your entire mygame directory to c:\Torque (so you should have c:\Torque\mygame). Now rename this "mygame" folder to "template" -- now, you won't have to do all these steps all over for your next game or next attempt :-)

32. From the build menu, select "clean solution"

33. From the build menu, select "build solution"

If you did absolutely everything as above, you'll now have mygame.exe in your c:\mygame folder along with glu2d3d.dll and opengl2d3d.dll

Now, remember, your mygame.exe can't _do_ anything at this point because it needs a main.cs file and it needs a module to run.

To TEST your build, you can copy the folders "common" and "starter.fps" and the file main.cs from c:\Torque\SDK\example\ to c:\mygame. Edit main.cs and change the line

$defaultGame = "tutorial.base";

to

$defaultGame = "starter.fps";

Once you've tested to make sure the FPS works the same in your mygame folder as it does in the SDK\example folder, you should now delete the starter.fps folder and the common folder and get to work building your own game :-)

Next Steps:

Now, you'll probably want to change the icon for your game intead of using the torque.ico. Grab a copy of png2ico and edit your mygame.rc file to accomplish this.

To package your application when you are done, you'll need an installer. I recommend INNO_Setup for this (don't forget to grab the ispack as well).