Torque 101: Intro to Torque
by Infinitum3D · in Torque Game Engine · 10/05/2006 (10:12 am) · 155 replies
I have just purchased and downloaded the TorqueGameEngineSDK_1.4
I will be documenting my experiences with it here. I am new to Torque and C++, so I hope others here will be able to learn from my mistakes.
UPDATE: Since I make several mistakes, you should always read through the entire thread of posts before trying anything. There are times that I ruin everything and have to start over entirely. Also, I have upgraded to Torque 1.5 since this post.
Thanks!
1. Download and run the TorqueGameEngineSDK-1-4.exe
This will install the Torque SDK on your computer. It will also place a link on the desktop called Torque Game Engine SDK.
This link is to twelve shortcuts;
FPS Starter Kit
Getting Started Tutorial
readMe.html
Racing Starter Kit
Torque Developer network (online)
Torque Game Engine Demo
Torque Game Engine Home Page
Tutorial Base
Torque Show Tool Pro
Torque Documentation (online)
Torque SDK forums (online)
Uninstall Torque Game Engine
I will read up on these and post more soon. I am starting with the ReadMe.html and the getting Started Tutorial.
UPDATE 10/07/06:
The ReadMe.html is just a one page note about where to find help. Look it over or skip straight to the Getting Starting .pdf tutorial.
2. The Getting Started tutorial is excellent. Follow it through, word by word, step by step, from start to finish, even if a section looks like common sense. !!!Be sure to place the TorqueScript in the EXACT location, exactly as the tutorial says!!! This was my first mistake.
All we have left to do is make sure that our 'clientGame.cs' file gets loaded. Open up GameOne/main.cs and find the 'Client scripts' section of the function called initClient. At the bottom of that list, add the following line, which will load our file:
I added the line at the bottom of the page, not at the bottom of the initClient function.
Update 10/11/06:
Next try to make some changes. For example: tdn.garagegames.com/wiki/Beginner
a. Make a new Torque Logo model that is blue instead of red.
b. Make it give 2 points instead of just 1.
c. Make a yellow one that gives 5 points.
Once I have done this, I'll explain how to do it.
Tony
I will be documenting my experiences with it here. I am new to Torque and C++, so I hope others here will be able to learn from my mistakes.
UPDATE: Since I make several mistakes, you should always read through the entire thread of posts before trying anything. There are times that I ruin everything and have to start over entirely. Also, I have upgraded to Torque 1.5 since this post.
Thanks!
1. Download and run the TorqueGameEngineSDK-1-4.exe
This will install the Torque SDK on your computer. It will also place a link on the desktop called Torque Game Engine SDK.
This link is to twelve shortcuts;
FPS Starter Kit
Getting Started Tutorial
readMe.html
Racing Starter Kit
Torque Developer network (online)
Torque Game Engine Demo
Torque Game Engine Home Page
Tutorial Base
Torque Show Tool Pro
Torque Documentation (online)
Torque SDK forums (online)
Uninstall Torque Game Engine
I will read up on these and post more soon. I am starting with the ReadMe.html and the getting Started Tutorial.
UPDATE 10/07/06:
The ReadMe.html is just a one page note about where to find help. Look it over or skip straight to the Getting Starting .pdf tutorial.
2. The Getting Started tutorial is excellent. Follow it through, word by word, step by step, from start to finish, even if a section looks like common sense. !!!Be sure to place the TorqueScript in the EXACT location, exactly as the tutorial says!!! This was my first mistake.
All we have left to do is make sure that our 'clientGame.cs' file gets loaded. Open up GameOne/main.cs and find the 'Client scripts' section of the function called initClient. At the bottom of that list, add the following line, which will load our file:
I added the line at the bottom of the page, not at the bottom of the initClient function.
Update 10/11/06:
Next try to make some changes. For example: tdn.garagegames.com/wiki/Beginner
a. Make a new Torque Logo model that is blue instead of red.
b. Make it give 2 points instead of just 1.
c. Make a yellow one that gives 5 points.
Once I have done this, I'll explain how to do it.
Tony
#42
Let's continue...
Open the C:\Torque\SDK\example\GameOne\data\missions\GameOneMission.mis file.
At the bottom, just before the last }; type in this
new AudioProfile(Background_Music) {
filename = "~/data/music/background.wav";
description = "AudioDefaultLoop";
preload = false;
};
This creates a new audio profile (well, duh). It tells the Background_Music player we made earlier to play the file background.wav
I think that's all there is too it. Just for the record, all I'm doing is following a tutorial and telling you what I'm doing. I hope this works. Let me fire up Torque and see.
Well, I don't hear anything. My background wave is the theme from the Altered Beast video game. I can't use it for real, since it's copyrighted, but for my audio test it should work. Let me go back and see if I can fix things.
OK, I forgot a quotation mark in the mission.cs file after alxPlay. Fixed it. Sound works. Yay!!! Now I need an original background wav.
More to come later.
Tony
11/02/2006 (10:34 am)
OK, I had to reboot. My laptop overheats when I run Torque with a few other programs. Not Torque's fault. Just a lousy laptop I guess.Let's continue...
Open the C:\Torque\SDK\example\GameOne\data\missions\GameOneMission.mis file.
At the bottom, just before the last }; type in this
new AudioProfile(Background_Music) {
filename = "~/data/music/background.wav";
description = "AudioDefaultLoop";
preload = false;
};
This creates a new audio profile (well, duh). It tells the Background_Music player we made earlier to play the file background.wav
I think that's all there is too it. Just for the record, all I'm doing is following a tutorial and telling you what I'm doing. I hope this works. Let me fire up Torque and see.
Well, I don't hear anything. My background wave is the theme from the Altered Beast video game. I can't use it for real, since it's copyrighted, but for my audio test it should work. Let me go back and see if I can fix things.
OK, I forgot a quotation mark in the mission.cs file after alxPlay. Fixed it. Sound works. Yay!!! Now I need an original background wav.
More to come later.
Tony
#43
EDIT: Oh yes and, what happend to those .difs you were suppost to send me?
11/03/2006 (6:03 am)
For me it doesnt work, probably cause im not using tutorial.base... im trying to use the "BACKGROUND SOUND" for my game , in console.log doesnt have any errors...EDIT: Oh yes and, what happend to those .difs you were suppost to send me?
#44
So now I have a simple village, a blue boxy player character, a lake and a volcano, and a background theme playing. So, a player can make the blue guy walk around, climb hills, swim (well, walk) in the lake, and explore inside buildings. We can also pick up the red torque logos that are still scattered around the land. I know I said I was going to get rid of them but I haven't yet. And actually, we don't pick them up. We run into them, and they disappear, and our score counter increments by one. We need to be able to collect things, so we need an inventory system.
Next goal, develop an inventory system.
I have a tutorial by Tim Newell that creates an Inventory Manager, however it involves using Visual C++ to modify the player.h file. It doesn't look complicated, but I don't want to get into C++ yet, unless we don't have any other choices.
I'm looking for another inventory manager using Torquescript instead.
Well, since we have to use C++ (and I have to learn it anyways), we may as well jump right in. I'm using Visual Studio's Visual C++ 2005 Express Edition. It's free from Microsoft for a short time (hurry). The tutorial for it (and dl link) is tdn.garagegames.com/wiki/Torque/vs2k5#Guide_to_Compiling_TGE_1.4_with_Visual_Stu...
Ok, I forgot to register VS2005, and I don't currently have an internet connection (I'm at work), so I can't register it now. This has been a real waste of time. I apologize.
So on to something else...
Let's add some weather patterns to our game.
This is from the TDN tdn.garagegames.com/wiki/WorldBuilding/MissionEditor/Adding_Precipitation#Introd...
We start by creating a new .cs file in the server\scripts directory. My new file is called environments.cs
Open Environment.cs using notepad. Create a new precipitation datablock as follows
datablock PrecipitationData(gentleRain)
{
dropTexture = "~/data/enviroment/gentleRainDrop";
splashTexture = "~/data/enviroment/gentleRainSplash";
dropSize = 1;
// splashSize = 0.1; // I commented out this line, since I don't have a good image for it.
useTrueBillboards = false;
splashMS = 250;
};
gentleRainDrop and gentleRainSplash are image files located in the environment folder located in the GameOne\data directory. If you don't have an environment folder, go ahead and create one. If you don't have gentleRainDrop.jpg or gentleRainSplash.png (either .jpg or .png is acceptible) then you can create one or find one online. Just make sure they are 32x32 (or another power of 2) in size. If any of this is confusing, let me know. I think everyone who has followed the GettingStarted.pdf understands about images/graphics, but if not, I'll try to help.
dropSize and splashSize are self explanitory. I think useTrueBillboards determines how the images are facing. I think a Billboard is always facing the camera, so it doesn't have sides or a back, just a front facing the camera. I could be wrong. The tutorial has it set as false so I'll leave it that way. And I think splashMS is the speed of the splash effect.
Save the environment.cs file
Open game.cs (in the server directory) and add the exec line. Remember, it goes in the function onServerCreated()
as follows
exec("./Scripts/environment.cs");
Save game.cs
Open GameOneMission.mis I'm going to stop listing the directory of everything. I think you can find the files at this point. If you want me to continue listing full diurectories, I will, but I don't think it's needed anymore. We're no longer totalNewbies, we're more like stillNewbies.
So open GameOneMission.mis (in the data folder). At the bottom, just before the last }; type in this
new Precipitation(rain) {
position = "0 0 0"; //Doesn't matter where it goes
rotation = "1 0 0 0"; //Doesn't matter either
scale = "1 1 1";
nameTag = "Rain"; //Give it a name
dataBlock = "gentleRain"; //Use the datablock that we created earlier
minSpeed = "12"; //How Slow?
maxSpeed = "19"; // How fast?
minMass = "0.05"; //How small?
maxMass = "2"; //How Big?
maxTurbulence = "0.1"; //How turbulent?
turbulenceSpeed = "0.2";
rotateWithCamVel = "1"; // Do you want the precipitation to always face the camera?
useTurbulence = "1";
numDrops = "200"; // How many drops should be seen at once? Be careful with this one!
boxWidth = "30";
boxHeight = "50";
doCollision = "1"; //Want the precipitation to go through interiors?
};
I'm not sure how doCollision works, but set at 0, there is no collision andrain falls through interiors. Set at 1, a little rain still leaks into my tavern. It must be my DIF. It is just a little rain, and it's only my tavern that leaks. My houses do not. Great. My tavern has a leaky roof. Pretty realistic, I guess.
Ok. Save all the files. Run Torque, and it should work. I made gentleRainDrop.png and gentleRainSplash.png, and I've sized them to 2x2. Even at 2x2 they look like huge white squares. I need better images with transparencies or something. By the way, this precipitation effect can be used for snow, meteor showers, magic spells, or anything else that falls from the sky like rain. Just change the images and tweak the settings in the mission file. I went into environment.cs and set the dropSize as 0.1 and it looks like a snowstorm. Pretty cool, but not great. I could almost say it looks like falling ash from my volcano. Hey, wait a minute...
No matter what color I make the gentleRainDrop.png, it always appears as a white square.Now, I deleted the images from the data/environment folder and it still looks like its snowing?!? If there are no images to display, where is the snow coming from? Does it default to a blank image?
Anyways, it works, it just doesn't look very good.
You can change things by going into the World Editor Creator and in the lower treeview, under MissionObjects>Environment>Precipitation, you can create additional rainstorms. Try it. Click Precipitation, and a window pops up called Building Object: Precipitation
Make the object name GentleRain, the name GentleRain, and the precipitation data gentleRain (from the drop-down box). Wow, that looks better than mine, but still not perfect. Anyways, I'm deleting my original precipitation object from the upper treeview, and I'll keep the new one for now. We now have an environmental control.
Things to improve upon at a later date:
1. Images. Need to look better.
2. Timing. Rain should start/stop at intervals.
3. Ferocity. Gentle rain, thunderstorm, hurricaine :)
4. Sound effects. Wind, thunder, the splish-splash of the rain hitting the ground.
5. Others. Snow, hail, fireballs, manna, whatever.
More to come...
Tony
11/03/2006 (6:58 pm)
PrecipitationSo now I have a simple village, a blue boxy player character, a lake and a volcano, and a background theme playing. So, a player can make the blue guy walk around, climb hills, swim (well, walk) in the lake, and explore inside buildings. We can also pick up the red torque logos that are still scattered around the land. I know I said I was going to get rid of them but I haven't yet. And actually, we don't pick them up. We run into them, and they disappear, and our score counter increments by one. We need to be able to collect things, so we need an inventory system.
Next goal, develop an inventory system.
I have a tutorial by Tim Newell that creates an Inventory Manager, however it involves using Visual C++ to modify the player.h file. It doesn't look complicated, but I don't want to get into C++ yet, unless we don't have any other choices.
I'm looking for another inventory manager using Torquescript instead.
Well, since we have to use C++ (and I have to learn it anyways), we may as well jump right in. I'm using Visual Studio's Visual C++ 2005 Express Edition. It's free from Microsoft for a short time (hurry). The tutorial for it (and dl link) is tdn.garagegames.com/wiki/Torque/vs2k5#Guide_to_Compiling_TGE_1.4_with_Visual_Stu...
Ok, I forgot to register VS2005, and I don't currently have an internet connection (I'm at work), so I can't register it now. This has been a real waste of time. I apologize.
So on to something else...
Let's add some weather patterns to our game.
This is from the TDN tdn.garagegames.com/wiki/WorldBuilding/MissionEditor/Adding_Precipitation#Introd...
We start by creating a new .cs file in the server\scripts directory. My new file is called environments.cs
Open Environment.cs using notepad. Create a new precipitation datablock as follows
datablock PrecipitationData(gentleRain)
{
dropTexture = "~/data/enviroment/gentleRainDrop";
splashTexture = "~/data/enviroment/gentleRainSplash";
dropSize = 1;
// splashSize = 0.1; // I commented out this line, since I don't have a good image for it.
useTrueBillboards = false;
splashMS = 250;
};
gentleRainDrop and gentleRainSplash are image files located in the environment folder located in the GameOne\data directory. If you don't have an environment folder, go ahead and create one. If you don't have gentleRainDrop.jpg or gentleRainSplash.png (either .jpg or .png is acceptible) then you can create one or find one online. Just make sure they are 32x32 (or another power of 2) in size. If any of this is confusing, let me know. I think everyone who has followed the GettingStarted.pdf understands about images/graphics, but if not, I'll try to help.
dropSize and splashSize are self explanitory. I think useTrueBillboards determines how the images are facing. I think a Billboard is always facing the camera, so it doesn't have sides or a back, just a front facing the camera. I could be wrong. The tutorial has it set as false so I'll leave it that way. And I think splashMS is the speed of the splash effect.
Save the environment.cs file
Open game.cs (in the server directory) and add the exec line. Remember, it goes in the function onServerCreated()
as follows
exec("./Scripts/environment.cs");
Save game.cs
Open GameOneMission.mis I'm going to stop listing the directory of everything. I think you can find the files at this point. If you want me to continue listing full diurectories, I will, but I don't think it's needed anymore. We're no longer totalNewbies, we're more like stillNewbies.
So open GameOneMission.mis (in the data folder). At the bottom, just before the last }; type in this
new Precipitation(rain) {
position = "0 0 0"; //Doesn't matter where it goes
rotation = "1 0 0 0"; //Doesn't matter either
scale = "1 1 1";
nameTag = "Rain"; //Give it a name
dataBlock = "gentleRain"; //Use the datablock that we created earlier
minSpeed = "12"; //How Slow?
maxSpeed = "19"; // How fast?
minMass = "0.05"; //How small?
maxMass = "2"; //How Big?
maxTurbulence = "0.1"; //How turbulent?
turbulenceSpeed = "0.2";
rotateWithCamVel = "1"; // Do you want the precipitation to always face the camera?
useTurbulence = "1";
numDrops = "200"; // How many drops should be seen at once? Be careful with this one!
boxWidth = "30";
boxHeight = "50";
doCollision = "1"; //Want the precipitation to go through interiors?
};
I'm not sure how doCollision works, but set at 0, there is no collision andrain falls through interiors. Set at 1, a little rain still leaks into my tavern. It must be my DIF. It is just a little rain, and it's only my tavern that leaks. My houses do not. Great. My tavern has a leaky roof. Pretty realistic, I guess.
Ok. Save all the files. Run Torque, and it should work. I made gentleRainDrop.png and gentleRainSplash.png, and I've sized them to 2x2. Even at 2x2 they look like huge white squares. I need better images with transparencies or something. By the way, this precipitation effect can be used for snow, meteor showers, magic spells, or anything else that falls from the sky like rain. Just change the images and tweak the settings in the mission file. I went into environment.cs and set the dropSize as 0.1 and it looks like a snowstorm. Pretty cool, but not great. I could almost say it looks like falling ash from my volcano. Hey, wait a minute...
No matter what color I make the gentleRainDrop.png, it always appears as a white square.Now, I deleted the images from the data/environment folder and it still looks like its snowing?!? If there are no images to display, where is the snow coming from? Does it default to a blank image?
Anyways, it works, it just doesn't look very good.
You can change things by going into the World Editor Creator and in the lower treeview, under MissionObjects>Environment>Precipitation, you can create additional rainstorms. Try it. Click Precipitation, and a window pops up called Building Object: Precipitation
Make the object name GentleRain, the name GentleRain, and the precipitation data gentleRain (from the drop-down box). Wow, that looks better than mine, but still not perfect. Anyways, I'm deleting my original precipitation object from the upper treeview, and I'll keep the new one for now. We now have an environmental control.
Things to improve upon at a later date:
1. Images. Need to look better.
2. Timing. Rain should start/stop at intervals.
3. Ferocity. Gentle rain, thunderstorm, hurricaine :)
4. Sound effects. Wind, thunder, the splish-splash of the rain hitting the ground.
5. Others. Snow, hail, fireballs, manna, whatever.
More to come...
Tony
#45
I'll try to do the inventory thing next.
Saska, I'll send the difs soon.
Tony
11/03/2006 (6:59 pm)
PS, I registered VS2005C++I'll try to do the inventory thing next.
Saska, I'll send the difs soon.
Tony
#46
EDIT: Oh yes and try give a screen shot of how your tge game looks like now with all those things youve added.
11/04/2006 (2:42 am)
My sound isnt working too.EDIT: Oh yes and try give a screen shot of how your tge game looks like now with all those things youve added.
#47
____________________________________________________
READ THROUGH THE ENTIRE POST BUT DON'T TRY ANYTHING. I'VE MESSED UP, AND I HAVE TO START OVER FROM SCRATCH
____________________________________________________
It's OK, though. It all turns out OK in the end.
So now my game consists of a blue character (default), a lake, a volcano, a very simple village (empty), annoying background music, annoying rainfall (snowfall?), and five torque logos that I can run into to make disappear. Oh yeah, and a scoreboard that increments everytime I collide with a torque logo.
It's really starting to shape up. But it's still nowhere near being good. If our demo version will be released as v1.0, then I'd say we are at v0.005 Just 995 improvements and we're ready for beta testing :)
OK, I've registered VS2005. I'm going to try to compile my project. I'm using the tutorial from TDN called Code/Visual C Project SDK. Note: This tutorial is for v1.4 not 1.5, but I don't think it matters. We'll find out. EDIT: This did NOT work for me. You can read it, or skip ahead to the other tutorial which DID work for me.
Step 1. and 2. I've already dl'd and installed the TorqueGameEngineSDK-1-4.exe, run it, and installed it to C:\Torque\SDK.
3. The tutorial says to register the .cc and .cp files with VC7 by right-clicking the file VC7 .cc compiling.reg and selecting "Merge" then answering "Yes".
I'm not using VC7, I'm using Microsoft Visual C++ 2005 Express Edition. I'm hoping the steps are the same. After all, both are acceptible C++ compilers, right? NOTE: This doesn't work for VS2005EE (Read it, but don't bother trying it.)
OK, so I merged the file into the registry. Next step.
4. and 5. Make a new folder in C:\ called C:\mygame
6. Copy everything from the SDK into C:\mygame
7. and 8. Delete the unneccessary files uninst-tsdk.exe and ReadMe.html
9. Open VC++, and open the file .\vc7\Torque SDK.sln
The .sln file was created in an earlier version of Visual Studio, so a Conversion Wizard opens to convert the file to the current format. I created a backup of the .sln file at the request of the Conversion Wizard. It says the file has been successfully converted with warnings.
If TorqueDemo is not highlighted, click it to highlight it.
10. Right click and select Project Dependencies
In the Project Dependencies pop-up window, note the names of any unchecked dependencies. The unchecked dependencies can be deleted.
In mine, the unchecked dependencies were;
buildWad
dtsSDK
fonttool
langc
map2dif
map2dif plus
max2dtsExporter Max3
max2dtsExporter Max4
ms2dtsExplorer
Torque Tool Lib
11. Click OK to close the Project Dependencies window. Go into the Solutions Explorer window and delete the files. It offers to save any changes, but I didn't save any.
12. Save TorqueDemo as mygame.vcproj and close VC++
13. Go back into the VC7 folder and delete the corresponding project files.
buildWad.vcproj
dtsSDK.vcproj
fonttool.vcproj
langc.vcproj
map2dif plus.vcproj
map2dif.vcproj
max2dtsExporter_Max3.vcproj
max2dtsExporter_Max4.vcproj
ms2dtsExporter.vcproj
Torque Tool Lib.vcproj
14. Go up one folder to the "C:\mygame" directory, and delete these folders
vc6
pb
tools
Remember, the originals are still in the C:\Torque\SDK folder.
15. Go into the C:|mygame\lib folder and delete
Going down to the "lib" directory, you can now delete the folders:
dtsSDK
maxsdk31
maxsdk40
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. and 19. Open mygame.sln with VC++
20. Rename the TorqueDemo project to mygame.
21. Back in the .\vc7 folder, you can now delete the files Torque Demo.vcproj
22. rename "TorqueDemo.rc" to "mygame.rc"
23. In the solution explorer, expand your project (+) and right-click on the "Source Files" folder, select "Add --> Existing Item" and add your mygame.rc
24. Remove the TorqueDemo.rc (not Delete, just Remove)
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 to mygame
27. Edit TORQUE_GAME_VERSION_STRING to mygame
28. Save and close TorqueConfig.h
29. Scroll-up to the top of the solution explorer and highlight the Solution'mygame'
30. From the build menu, select "Configuration Manager" and set your solution to "DEBUG". I think we need to set it to "RELEASE" when we're ready to Beta Test.
31. We're going to use this set-up as a template for future game builds, so BEFORE you build your solution, close VC++ (SAVE the changes). COPY your entire mygame directory to c:\Torque (so you should have c:\Torque\mygame).
Now rename this "mygame" folder to "template" , it will now be C:\Torque\Template -- now, you won't have to do all these steps all over for your next game or next attempt.
32. Open VC++2005EE again. Open the mygame project (it should be at the top of "Recent Projects", just double click it). I may have done something wrong, because it lists the ten project files (that we removed) as "unavailable". Just click OK. From the build menu, select clean solution.
33. From the build menu, select build solution. It takes a couple minutes to build.
If we did absolutely everything correct, we should now have mygame.exe in our c:\mygame folder along with glu2d3d.dll and opengl2d3d.dll
well, my VC++ output screen says "Build: 4 succeeded, 3 failed, 0 up-to-date, 0 skipped"
Let's check the MyGame folder. I don't have MyGame.exe or either of the other two files in C:\MyGame\
VC++ says that a Build log was saved at "file://c:\MyGame\engine\out.VC6.DEBUG\BuildLog.htm"
Now, I'm no programmer, but the error is pretty clear. There were 24 errors, and the following was listed 24 times.
"
c:\mygame\engine\platformwin32\platformwin32.h(21) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory"
So my configuration is incorrect somewhere. This didn't work!!!
11/11/2006 (1:12 pm)
11072006 Torque 101 ____________________________________________________
READ THROUGH THE ENTIRE POST BUT DON'T TRY ANYTHING. I'VE MESSED UP, AND I HAVE TO START OVER FROM SCRATCH
____________________________________________________
It's OK, though. It all turns out OK in the end.
So now my game consists of a blue character (default), a lake, a volcano, a very simple village (empty), annoying background music, annoying rainfall (snowfall?), and five torque logos that I can run into to make disappear. Oh yeah, and a scoreboard that increments everytime I collide with a torque logo.
It's really starting to shape up. But it's still nowhere near being good. If our demo version will be released as v1.0, then I'd say we are at v0.005 Just 995 improvements and we're ready for beta testing :)
OK, I've registered VS2005. I'm going to try to compile my project. I'm using the tutorial from TDN called Code/Visual C Project SDK. Note: This tutorial is for v1.4 not 1.5, but I don't think it matters. We'll find out. EDIT: This did NOT work for me. You can read it, or skip ahead to the other tutorial which DID work for me.
Step 1. and 2. I've already dl'd and installed the TorqueGameEngineSDK-1-4.exe, run it, and installed it to C:\Torque\SDK.
3. The tutorial says to register the .cc and .cp files with VC7 by right-clicking the file VC7 .cc compiling.reg and selecting "Merge" then answering "Yes".
I'm not using VC7, I'm using Microsoft Visual C++ 2005 Express Edition. I'm hoping the steps are the same. After all, both are acceptible C++ compilers, right? NOTE: This doesn't work for VS2005EE (Read it, but don't bother trying it.)
OK, so I merged the file into the registry. Next step.
4. and 5. Make a new folder in C:\ called C:\mygame
6. Copy everything from the SDK into C:\mygame
7. and 8. Delete the unneccessary files uninst-tsdk.exe and ReadMe.html
9. Open VC++, and open the file .\vc7\Torque SDK.sln
The .sln file was created in an earlier version of Visual Studio, so a Conversion Wizard opens to convert the file to the current format. I created a backup of the .sln file at the request of the Conversion Wizard. It says the file has been successfully converted with warnings.
If TorqueDemo is not highlighted, click it to highlight it.
10. Right click and select Project Dependencies
In the Project Dependencies pop-up window, note the names of any unchecked dependencies. The unchecked dependencies can be deleted.
In mine, the unchecked dependencies were;
buildWad
dtsSDK
fonttool
langc
map2dif
map2dif plus
max2dtsExporter Max3
max2dtsExporter Max4
ms2dtsExplorer
Torque Tool Lib
11. Click OK to close the Project Dependencies window. Go into the Solutions Explorer window and delete the files. It offers to save any changes, but I didn't save any.
12. Save TorqueDemo as mygame.vcproj and close VC++
13. Go back into the VC7 folder and delete the corresponding project files.
buildWad.vcproj
dtsSDK.vcproj
fonttool.vcproj
langc.vcproj
map2dif plus.vcproj
map2dif.vcproj
max2dtsExporter_Max3.vcproj
max2dtsExporter_Max4.vcproj
ms2dtsExporter.vcproj
Torque Tool Lib.vcproj
14. Go up one folder to the "C:\mygame" directory, and delete these folders
vc6
pb
tools
Remember, the originals are still in the C:\Torque\SDK folder.
15. Go into the C:|mygame\lib folder and delete
Going down to the "lib" directory, you can now delete the folders:
dtsSDK
maxsdk31
maxsdk40
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. and 19. Open mygame.sln with VC++
20. Rename the TorqueDemo project to mygame.
21. Back in the .\vc7 folder, you can now delete the files Torque Demo.vcproj
22. rename "TorqueDemo.rc" to "mygame.rc"
23. In the solution explorer, expand your project (+) and right-click on the "Source Files" folder, select "Add --> Existing Item" and add your mygame.rc
24. Remove the TorqueDemo.rc (not Delete, just Remove)
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 to mygame
27. Edit TORQUE_GAME_VERSION_STRING to mygame
28. Save and close TorqueConfig.h
29. Scroll-up to the top of the solution explorer and highlight the Solution'mygame'
30. From the build menu, select "Configuration Manager" and set your solution to "DEBUG". I think we need to set it to "RELEASE" when we're ready to Beta Test.
31. We're going to use this set-up as a template for future game builds, so BEFORE you build your solution, close VC++ (SAVE the changes). COPY your entire mygame directory to c:\Torque (so you should have c:\Torque\mygame).
Now rename this "mygame" folder to "template" , it will now be C:\Torque\Template -- now, you won't have to do all these steps all over for your next game or next attempt.
32. Open VC++2005EE again. Open the mygame project (it should be at the top of "Recent Projects", just double click it). I may have done something wrong, because it lists the ten project files (that we removed) as "unavailable". Just click OK. From the build menu, select clean solution.
33. From the build menu, select build solution. It takes a couple minutes to build.
If we did absolutely everything correct, we should now have mygame.exe in our c:\mygame folder along with glu2d3d.dll and opengl2d3d.dll
well, my VC++ output screen says "Build: 4 succeeded, 3 failed, 0 up-to-date, 0 skipped"
Let's check the MyGame folder. I don't have MyGame.exe or either of the other two files in C:\MyGame\
VC++ says that a Build log was saved at "file://c:\MyGame\engine\out.VC6.DEBUG\BuildLog.htm"
Now, I'm no programmer, but the error is pretty clear. There were 24 errors, and the following was listed 24 times.
"
c:\mygame\engine\platformwin32\platformwin32.h(21) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory"
So my configuration is incorrect somewhere. This didn't work!!!
#48
I really screwed up everything. Read this, but DO NOT DO IT!!!
//------------------------------------------
OK, turns out, this is a better tutorial
//-------------------------------------------
I have a better tutorial from TDN called Torque/vs2k5
Guide to Compiling TGE 1.4 with Visual Studio 2005 Express
So let's start over, following "New Directions".
1. Download and install VS2005Express. (Already done)
2. Download the patch for Torque Game Engine from this link:
tdn.garagegames.com/wiki/images/e/e8/TGE_VS2005.zip
Or the VS2005 Express Edition update for the Torque Lighting Kit (TLK):
tdn.garagegames.com/wiki/images/1/1d/TLK_VS2005.zip
Note: I'm using TGE_VS2005.zip (The first patch, NOT the lighting patch)
Extract toC:\Torque. 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\lib\MSPlatformSDK.
It doesn't, because vc6 and vc7 are in the C:|Torque\SDK folder. Let's try again, by extracting into the C:\Torque\SDK folder.
OK, That works. It will prompt you to overwrite the following files which is OK (they needed to be updated to work with VS2005):
\lib\directx8\basetsd.h
\lib\maxsdk40\imtl.h
\tools\max2dtsExporter\exporter.rc
\tools\ms2dtsExporter\DTSPlugin.cpp
\tools\ms2dtsExporter\resource.rc
Step 3. We have to prepare Torque. Open VC++.
File->
Open->
Project/Solution
Then browse to C:\Torque\SDK\VS2005\Torque SDK.sln
4) Now right-click on Torque Demo (to Highlight it) in the Solution Explorer and choose "Properties" (at the bottom). Under "Configuration Properties" on the left click on "Debugging". On the right put C:\Torque\SDK\example in the "Working Directory" property (you can Browse to it).
Next, choose "Release" from the "Configuration" drop down at the top left. Put in C:\Torque\SDK\example in the "Working Directory" property here also (again, you can Browse to it). It will prompt you to save changes. Accept. Then click Apply, and OK.
Now to compile:
5) In the menu goto Build->Build Torque Demo. It will start compiling the project. This takes awhile.
6) According to the tutorial, if we did it right, we'll end up with:
Torque Demo - 0 error(s), 8 warning(s)
========== Rebuild All: 7 succeeded, 0 failed, 0 skipped ==========
This worked for me.
That's exactly what mine did.
Running Torque:
12) Since we set the "Working Directory" above all we have to do is click the green Start button (the little green triangle next to "Debug") in the middle of the upper menu. You can also hit F5 or goto Debug->Start. Torque should start up! Torque DOES start up.
Almost. Everything works except the TorqueDemo.exe. The Torque Tutorial Base opens (the GUI with the GameOne background), however when I click Start to run it, it hangs when loading. The screen opens with the F World box, and it says WAITING FOR SERVER in the progress bar at the bottom. Same thing with TorqueDemo_DEBUG.exe.
If I hit cancel to go back to the "GameOne" GUI, then hit World Editor on the toolbar at the top, it loads, but it's not my GameOneMission.mis file that I've been working on. Instead, it's the flat.mis. I can go up to File>Open Mission>GameOne>data>missions>GameOneMission.mis but I get a fatal error
[Fatal: (c:\torque\sdk\engine\gui\core\guicontrol.cc@505)
GuiControl::awaken:failed onWake[/b]
with two option button, Retry or Cancel.
Retry pops-up another error:
torqueDemo_DEBUG.exe has triggered a breakpoint
If I was a programmer, I might understand, but I'm not.
I have three option buttons;
Break, Continue, and (grayed out) Ignore.
Continue gives me the same error
torqueDemo_DEBUG.exe has triggered a breakpoint
Continue again brings up a new Fatal Error;
Fatal: (c:\torque\sdk\engine\gui\core\guicontrol.cc @191)
GuiControl::removeObject: child control wake state is bad
again, two options, Retry or Cancel.
Retry again gives the Breakpoint error
Continue again, twice.
New fatal error @ 522
GuiControl::sleep:child control is already asleep
Retry or Cancel
Retry triggers a breakpoint.
Continue twice more, and the F World window comes up and hangs WAITING FOR SERVER
sigh...
Do I start from scratch, using VC++ to start a new Torque Demo? Or do I try to fix the problem. I exit the hanging TorqueDemo, and try to close VC++, but it prompts me to Save changes to torqueDemo_DEBUG.sln
Since things aren't working anyways, I click Yes.
A Save File As window pops-up, defaulted to the example directory, with the file name torqueDemo_DEBUG.sln
I cancel and try to close VC++ again. This time I click No when prompted to save, and it closes.
Since I haven't really gotten very far with my demo program yet, I'm going to go ahead and start over using VC++ to open the project.
This means I'm starting over from scratch, and creating an entirely new project.
I'm not going to run through the GettingStarted.pdf again. I'm starting new with a blank game, using the flat.mis as my starting point.
Oh, just for the record, from the other tutorial (the one that DIDN'T work for me), I learned that we need an installer to package our application when we're ready to "beta test". The tutorial recommends "INNO_Setup for this (don't forget to grab the ispack as well).", but there are other installers available. Some are free, some are cheap, and some are not.
We'll try an installer at another time. Once we've got something worth compiling ;)
As always, good luck!
Tony
11/11/2006 (1:13 pm)
Just a noteI really screwed up everything. Read this, but DO NOT DO IT!!!
//------------------------------------------
OK, turns out, this is a better tutorial
//-------------------------------------------
I have a better tutorial from TDN called Torque/vs2k5
Guide to Compiling TGE 1.4 with Visual Studio 2005 Express
So let's start over, following "New Directions".
1. Download and install VS2005Express. (Already done)
2. Download the patch for Torque Game Engine from this link:
tdn.garagegames.com/wiki/images/e/e8/TGE_VS2005.zip
Or the VS2005 Express Edition update for the Torque Lighting Kit (TLK):
tdn.garagegames.com/wiki/images/1/1d/TLK_VS2005.zip
Note: I'm using TGE_VS2005.zip (The first patch, NOT the lighting patch)
Extract toC:\Torque. 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
It doesn't, because vc6 and vc7 are in the C:|Torque\SDK folder. Let's try again, by extracting into the C:\Torque\SDK folder.
OK, That works. It will prompt you to overwrite the following files which is OK (they needed to be updated to work with VS2005):
Step 3. We have to prepare Torque. Open VC++.
File->
Open->
Project/Solution
Then browse to C:\Torque\SDK\VS2005\Torque SDK.sln
4) Now right-click on Torque Demo (to Highlight it) in the Solution Explorer and choose "Properties" (at the bottom). Under "Configuration Properties" on the left click on "Debugging". On the right put C:\Torque\SDK\example in the "Working Directory" property (you can Browse to it).
Next, choose "Release" from the "Configuration" drop down at the top left. Put in C:\Torque\SDK\example in the "Working Directory" property here also (again, you can Browse to it). It will prompt you to save changes. Accept. Then click Apply, and OK.
Now to compile:
5) In the menu goto Build->Build Torque Demo. It will start compiling the project. This takes awhile.
6) According to the tutorial, if we did it right, we'll end up with:
Torque Demo - 0 error(s), 8 warning(s)
========== Rebuild All: 7 succeeded, 0 failed, 0 skipped ==========
This worked for me.
That's exactly what mine did.
Running Torque:
12) Since we set the "Working Directory" above all we have to do is click the green Start button (the little green triangle next to "Debug") in the middle of the upper menu. You can also hit F5 or goto Debug->Start. Torque should start up! Torque DOES start up.
Almost. Everything works except the TorqueDemo.exe. The Torque Tutorial Base opens (the GUI with the GameOne background), however when I click Start to run it, it hangs when loading. The screen opens with the F World box, and it says WAITING FOR SERVER in the progress bar at the bottom. Same thing with TorqueDemo_DEBUG.exe.
If I hit cancel to go back to the "GameOne" GUI, then hit World Editor on the toolbar at the top, it loads, but it's not my GameOneMission.mis file that I've been working on. Instead, it's the flat.mis. I can go up to File>Open Mission>GameOne>data>missions>GameOneMission.mis but I get a fatal error
[Fatal: (c:\torque\sdk\engine\gui\core\guicontrol.cc@505)
GuiControl::awaken:failed onWake[/b]
with two option button, Retry or Cancel.
Retry pops-up another error:
torqueDemo_DEBUG.exe has triggered a breakpoint
If I was a programmer, I might understand, but I'm not.
I have three option buttons;
Break, Continue, and (grayed out) Ignore.
Continue gives me the same error
torqueDemo_DEBUG.exe has triggered a breakpoint
Continue again brings up a new Fatal Error;
Fatal: (c:\torque\sdk\engine\gui\core\guicontrol.cc @191)
GuiControl::removeObject: child control wake state is bad
again, two options, Retry or Cancel.
Retry again gives the Breakpoint error
Continue again, twice.
New fatal error @ 522
GuiControl::sleep:child control is already asleep
Retry or Cancel
Retry triggers a breakpoint.
Continue twice more, and the F World window comes up and hangs WAITING FOR SERVER
sigh...
Do I start from scratch, using VC++ to start a new Torque Demo? Or do I try to fix the problem. I exit the hanging TorqueDemo, and try to close VC++, but it prompts me to Save changes to torqueDemo_DEBUG.sln
Since things aren't working anyways, I click Yes.
A Save File As window pops-up, defaulted to the example directory, with the file name torqueDemo_DEBUG.sln
I cancel and try to close VC++ again. This time I click No when prompted to save, and it closes.
Since I haven't really gotten very far with my demo program yet, I'm going to go ahead and start over using VC++ to open the project.
This means I'm starting over from scratch, and creating an entirely new project.
I'm not going to run through the GettingStarted.pdf again. I'm starting new with a blank game, using the flat.mis as my starting point.
Oh, just for the record, from the other tutorial (the one that DIDN'T work for me), I learned that we need an installer to package our application when we're ready to "beta test". The tutorial recommends "INNO_Setup for this (don't forget to grab the ispack as well).", but there are other installers available. Some are free, some are cheap, and some are not.
We'll try an installer at another time. Once we've got something worth compiling ;)
As always, good luck!
Tony
#49
I've uninstalled Torque 1.4. I've also uninstalled VC++2005EE.
I've reinstalled VC++2005EE.
Instead of re-installing Torque 1.4, I've installed TorqueGameEngineSDK-1-5-0.exe
And since I forgot to backup my GameOneMission.mis file, it's been deleted, so I'm literally starting over from scratch. It will be faster this time though, since we've been through it before.
I have to remember to keep a backup copy of GameOneMission.mis on my desktop or in My Documents or somewhere else that's safe.
Now, we have to install the Platform SDK for the x86 system (PSDK-x86.exe). Instructions are at msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
I couldn't do this yet, since my copy was corrupted and I don't have an internet signal here at work to dl a clean copy. We'll try that in another post.
Ok, I did a quick run-through of the GettingStarted.pdf for Torque1.5
It's basically the same as 1.4 so I just skipped the TorqueScript part about the Torque Logos, since we don't want to use Torque Logos in our game anyway.
NOTE: If you still have your old GameOneMission.mis file, try copying it into the new datamissions folder. You may be able to load it. I wouldn't know, since I lost it when I uninstalled Torque1.4
I changed the GUI background to the Realm Wars background. I know it's cheating, but it's only temporary. I was just tired of looking at the giant "GAMEONE" every time I started up. I also added the Start button, but instead of using the GuiButtonCtrl I used the GuiBitmapButtonCtrl, with a custom StartButton.png that I made in Paint Shop Pro.
I made a 32x32 Start.png file with a little green arrow and the word START, and saved this in the ..GameOneclientUIbuttons folder. Then to apply it, in the Gui Inspector treeview, Under "General" next to "bitmap" click the ... and browse to the start.png file.
Under "Parent", next to "Profile", select GuiBorderButtonProfile, and next to "Command" type in
loadMyMission();
Under "ToolTip", next to "tooltipprofile" select GuiToolTipProfile
and next to "ToolTip" I typed in Start GameOneDemo.exe
Click Apply
In the upper tree-view, drag the GuiButtonBitmapCtrl up into the GuiChunkedBitmapCtrl folder so that it is with all the other buttons. I deleted out the "tutorial" button and replaced it with my new button.
When it's time to compile a Demo v1.0 we'll delete out the other buttons. Actually, we'll do a custom Background image, and our own set of buttons for Start, Options, whatever.
One thing I notice is that the lighting looks better in 1.5 or at least it seems that way to me. It just "looks" better, like it's brighter, or clearer, or cleaner or something.
Anyways, I like v1.5 so far.
I still have to go back in and add background music, a lake, a volcano, and a particle emitter for smoke, and the rain environment.
More to come.
Next post will be Installing the Platform SDK.
Tony
11/11/2006 (1:14 pm)
Torque 101 11102006 - ReinstallingI've uninstalled Torque 1.4. I've also uninstalled VC++2005EE.
I've reinstalled VC++2005EE.
Instead of re-installing Torque 1.4, I've installed TorqueGameEngineSDK-1-5-0.exe
And since I forgot to backup my GameOneMission.mis file, it's been deleted, so I'm literally starting over from scratch. It will be faster this time though, since we've been through it before.
I have to remember to keep a backup copy of GameOneMission.mis on my desktop or in My Documents or somewhere else that's safe.
Now, we have to install the Platform SDK for the x86 system (PSDK-x86.exe). Instructions are at msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
I couldn't do this yet, since my copy was corrupted and I don't have an internet signal here at work to dl a clean copy. We'll try that in another post.
Ok, I did a quick run-through of the GettingStarted.pdf for Torque1.5
It's basically the same as 1.4 so I just skipped the TorqueScript part about the Torque Logos, since we don't want to use Torque Logos in our game anyway.
NOTE: If you still have your old GameOneMission.mis file, try copying it into the new datamissions folder. You may be able to load it. I wouldn't know, since I lost it when I uninstalled Torque1.4
I changed the GUI background to the Realm Wars background. I know it's cheating, but it's only temporary. I was just tired of looking at the giant "GAMEONE" every time I started up. I also added the Start button, but instead of using the GuiButtonCtrl I used the GuiBitmapButtonCtrl, with a custom StartButton.png that I made in Paint Shop Pro.
I made a 32x32 Start.png file with a little green arrow and the word START, and saved this in the ..GameOneclientUIbuttons folder. Then to apply it, in the Gui Inspector treeview, Under "General" next to "bitmap" click the ... and browse to the start.png file.
Under "Parent", next to "Profile", select GuiBorderButtonProfile, and next to "Command" type in
loadMyMission();
Under "ToolTip", next to "tooltipprofile" select GuiToolTipProfile
and next to "ToolTip" I typed in Start GameOneDemo.exe
Click Apply
In the upper tree-view, drag the GuiButtonBitmapCtrl up into the GuiChunkedBitmapCtrl folder so that it is with all the other buttons. I deleted out the "tutorial" button and replaced it with my new button.
When it's time to compile a Demo v1.0 we'll delete out the other buttons. Actually, we'll do a custom Background image, and our own set of buttons for Start, Options, whatever.
One thing I notice is that the lighting looks better in 1.5 or at least it seems that way to me. It just "looks" better, like it's brighter, or clearer, or cleaner or something.
Anyways, I like v1.5 so far.
I still have to go back in and add background music, a lake, a volcano, and a particle emitter for smoke, and the rain environment.
More to come.
Next post will be Installing the Platform SDK.
Tony
#50
Using this link for the tutorial:
msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
1. Download and install VC++2005
msdn.microsoft.com/vstudio/express/visualc/download/
2. Download and install Platform SDK for the x86 platform
www.microsoft.com/downloads/details.aspx?FamilyId=0BAF2B35-C656-4969-ACE8-E4C0C0...
3. Update the Visual C++ directories
Open VC++ and go to Tools>Options
Click the (+) next to Projects and Solutions, then click on VC++ Directories
Platform is "Win32" (it should be that way already) Top right has a drop-down box titled Show directories for: and it should say "Executable files".
Add the paths to the appropriate subsection:
Executable files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin
Click the folder icon for a "new line".
Add this line
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin
Now change the drop-down from "Executable files" to "Include files" and add this line
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include
then change to "Library" and add this line
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib
Then click OK. Close VC++.
4. Update the corewin_express.vsprops file.
The corewin_express.vsprops file is located in the C:\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults)
Open it with Notepad (or any text editor)
Change this line
AdditionalDependencies="kernel32.lib"
to this
AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib"
Save the file and close it.
5. Generate and build a Win32 application to test your paths.
In Visual C++ Express, the Win32 Windows Application type is disabled in the Win32 Application Wizard. To enable that type, you need to edit the file
AppSettings.htm file located in the folder C:\ProgramFiles\Microsoft Visual Studio 8\VC\VCWizards\AppWiz\Generic\Application\html\1033\.
In Notepad (or any text editor) comment out lines 441 - 444 by putting a // in front of them as shown here:
// WIN_APP.disabled = true;
// WIN_APP_LABEL.disabled = true;
// DLL_APP.disabled = true;
// DLL_APP_LABEL.disabled = true;
These lines were found in the if (window.external.FindSymbol("IS_EXPRESS_SKU")) section.
Save and close AppSettings.htm
Open VC++ again. Go to File>New>Project.
In the New Project dialog box, expand the Visual C++ node in the Product Types tree that means click the (+) next to Visual C++ and then click Win32. Click on the Win32 Console Application template and then name your project TESTING and click OK. In the Win32 Application Wizard dialog box click Application Settings.
Make sure that Windows application is selected as the Application type (mine had Console application selected as the default).
Make sure the ATL is not selected. Click the Finish button to generate the project.
As a final step, test your project by clicking the Start button in the IDE or by pressing F5. Your Win32 application should build and run.
When I did this it said "This project is out of date. Would you like to build it?"
I clicked "Yes" and it worked. It took about 10 seconds to build and run. Of course it didn't do anything since it was an empty project, but it did compile and run correctly.
Hooray!!! Something worked :)
Now back to Torque for more...
Tony
11/12/2006 (7:09 am)
Torque 101 11122006 - Installing the Platform SDKUsing this link for the tutorial:
msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
1. Download and install VC++2005
msdn.microsoft.com/vstudio/express/visualc/download/
2. Download and install Platform SDK for the x86 platform
www.microsoft.com/downloads/details.aspx?FamilyId=0BAF2B35-C656-4969-ACE8-E4C0C0...
3. Update the Visual C++ directories
Open VC++ and go to Tools>Options
Click the (+) next to Projects and Solutions, then click on VC++ Directories
Platform is "Win32" (it should be that way already) Top right has a drop-down box titled Show directories for: and it should say "Executable files".
Add the paths to the appropriate subsection:
Executable files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin
Click the folder icon for a "new line".
Add this line
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin
Now change the drop-down from "Executable files" to "Include files" and add this line
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include
then change to "Library" and add this line
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib
Then click OK. Close VC++.
4. Update the corewin_express.vsprops file.
The corewin_express.vsprops file is located in the C:\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults)
Open it with Notepad (or any text editor)
Change this line
AdditionalDependencies="kernel32.lib"
to this
AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib"
Save the file and close it.
5. Generate and build a Win32 application to test your paths.
In Visual C++ Express, the Win32 Windows Application type is disabled in the Win32 Application Wizard. To enable that type, you need to edit the file
AppSettings.htm file located in the folder C:\ProgramFiles\Microsoft Visual Studio 8\VC\VCWizards\AppWiz\Generic\Application\html\1033\.
In Notepad (or any text editor) comment out lines 441 - 444 by putting a // in front of them as shown here:
// WIN_APP.disabled = true;
// WIN_APP_LABEL.disabled = true;
// DLL_APP.disabled = true;
// DLL_APP_LABEL.disabled = true;
These lines were found in the if (window.external.FindSymbol("IS_EXPRESS_SKU")) section.
Save and close AppSettings.htm
Open VC++ again. Go to File>New>Project.
In the New Project dialog box, expand the Visual C++ node in the Product Types tree that means click the (+) next to Visual C++ and then click Win32. Click on the Win32 Console Application template and then name your project TESTING and click OK. In the Win32 Application Wizard dialog box click Application Settings.
Make sure that Windows application is selected as the Application type (mine had Console application selected as the default).
Make sure the ATL is not selected. Click the Finish button to generate the project.
As a final step, test your project by clicking the Start button in the IDE or by pressing F5. Your Win32 application should build and run.
When I did this it said "This project is out of date. Would you like to build it?"
I clicked "Yes" and it worked. It took about 10 seconds to build and run. Of course it didn't do anything since it was an empty project, but it did compile and run correctly.
Hooray!!! Something worked :)
Now back to Torque for more...
Tony
#51
My world consists of terrain with hills and valleys, the default blue guy, and nothing else. To catch up to where I was, I have to add background music, precipitation, smoke, and a few DIF buildings. Once I get caught up, I'll start posting again.
I wasn't able to figure out the CVS, but I'll keep trying. Once I get it working,I'll post it here also.
Tony
Update I found some free/royalty free .mp3's at incompetech.com/m/c/royalty-free/
Just be sure to credit the author;
If your project has only one piece in it; you can credit it as "Music: Kevin MacLeod".
If your project has many pieces, you can credit as "Piece Title Kevin MacLeod (incompetech.com)".
Here's another. you can also buy professional sound effects and music here.
www.partnersinrhyme.com/
Partners In Rhyme - Your audio resource for multimedia projects with free royalty free music, sound effects, midi files, audio tutorials, audio software and sound advice.
And one more;
www.royaltyfreemusic.com/free-music-loops.html
11/12/2006 (7:19 am)
OK, so I now have VC++2005 set up for Torque using the Platform SDK for the x86 system.My world consists of terrain with hills and valleys, the default blue guy, and nothing else. To catch up to where I was, I have to add background music, precipitation, smoke, and a few DIF buildings. Once I get caught up, I'll start posting again.
I wasn't able to figure out the CVS, but I'll keep trying. Once I get it working,I'll post it here also.
Tony
Update I found some free/royalty free .mp3's at incompetech.com/m/c/royalty-free/
Just be sure to credit the author;
If your project has only one piece in it; you can credit it as "Music: Kevin MacLeod".
If your project has many pieces, you can credit as "Piece Title Kevin MacLeod (incompetech.com)".
Here's another. you can also buy professional sound effects and music here.
www.partnersinrhyme.com/
Partners In Rhyme - Your audio resource for multimedia projects with free royalty free music, sound effects, midi files, audio tutorials, audio software and sound advice.
And one more;
www.royaltyfreemusic.com/free-music-loops.html
#52
11-17-2006 Torque 101 - Changing the "Score" to "Gold"
The gettingStarted.pdf explained how to add a "Score" feature to the game, and every time you collide with a torqueLogoItem your score increments by one.
I'm going to change this to something more useful in a Fantasy RolePlaying game.
Start Torque. For me this means double-click the GameOne.ece shortcut on my desktop. The Torque GUI loads. Mine has a "Realm Wars III - The Infinitum3D Project" background, and a "Start" button in the center. I'd load a screenshot, but I never have time to upload any to the website. Maybe next week. Anyways, I click Start and "F-World" loads. I have to remember to change that loading text also. OK so nowI hit (F10) to switch to Mission Editor.
My world consists of the default blue-guy, some terrain, and that's all right now.
So, going back to the gettingStarted.pdf, oh wait, I almost forgot. I created a very simple .DTS file using StudioMax. It's a small lump of gold, called "goldNugget.dts" VERY boring, but it suits our purpose for now.
I've placed a few gold nuggets for our player to collect. Make sure to place them in a SimGroup called Gold. Also, I've named the gold nuggets, Gold001, Gold002, up to Gold005.
In the GUI editor, select GuiTextCtrl. Name our control GoldCounter, and change the PROFILE to GuiBigTextProfile (just like the gettingStarted.pdf) and in the TEXT field, type in Gold: 0. Move the control to the middle of the screen, somewhere near the bottom. And finally, I always set the HorizSizing and VertSizing to relative.
Save the GUI as GameOne/client/ui/playGui.gui
1. In the Server folder, create a new file called goldNugget.cs
Type in (don't cut/paste, you learn more typing it in line by line) this code:
//-------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//----------------------------------------------------------------
datablock StaticShapeData(GoldNugget)
{
category = "Items";
shapeFile = "~/data/shapes/gold/goldNugget.dts";
};
function GoldNugget::onCollision(%this, %obj, %col)
{
if(%col.getClassName() $= "Player")
{
%client = %col.client;
%client.gold++;
commandToClient(%client, 'SetGoldCounter', %client.gold);
%obj.delete();
return;
}
}
Save the file in the SERVER folder.
2. Open the CLIENT folder and create a new file called clientGame.cs
Type in this code:
function clientCmdSetGoldCounter(%gold)
{
GoldCounter.setText("Gold:" SPC %gold);
}
Save this file in the CLIENT folder.
3. Open up GameOne/main.cs and find the // Client scripts
section of the function called initClient. At the bottom of that list, add the following line, which will load our file:
exec("./client/clientGame.cs");
4. Open game.cs and in the "onServerCreated() function, add the line exec("./goldNugget.cs");
Save everything, load Torque and run into your gold nugget. Did it work?
Not for me. I did it again. It hangs while WAITING FOR SERVER. I can't figure out my mistake, so I've screwed up again, and I guess I have to start over. I don't know enough about programming to do my own thing, so I'm going to follow tutorials step-by-step from now on.
I know part of the problem The TorqueLogoItem in the gettingStarted.pdf is located in SHAPES>ITEMS, whereas my goldNugget.dts is located in STATIC SHAPES. I need to figure out how to put my DTS files in SHAPES>ITEMS
I'm going to try to back track here, following my notes, and go back to where things were before I started today.
...
Didn't work. I've got to start over again. Well, I still think I'm learning.
Starting Over AGAIN
Open flat.mis
Save as GameOneMission.mis
Recreating terrain... Repainting terrain... Moving SpawnSphere closer to the ground... Saving as GameOneMission.mis, and GameOneMission_bkup.mis
Starting Torque. OK. What can I try to mess up next :)
Well, here's something annoying. When I double-click GameOne.exe, Torque loads my GUI. If I click START, the F-World loading screen comes up, but it hangs on LIGHTING MISSION. If I cancel and try again, it hangs on LOADING OBJECTS. If I cancel and double-click WORLD EDITOR, it loads flat.mis. From there I can FILE>OPEN MISSION>GameOneMission.mis, but it shouldn't hang while LOADING OBJECTS.
I've noticed in the Forums that this seems to be a common problem, but I don't know what the solution is for this. Is this a Torque problem? a bug? or something I did to the TGE?
I've got to start over entirely. I'm copying the TUTORIAL.BASE folder over my GAMEONE folder and re-doing the .pdf again.
Like I said, I'm going to simply follow tutorials, step by step, until I understand things better. I re-did the gettingStarted.pdf, and the only change I made was to use the brown colored TORQUE background from the Realm Wars dl. I just couldn't look at the GAMEONEBG background anymore.
On the bright side, I'm getting pretty good at the gettingStarted.pdf tutorial :)
As of 6:22am EST Saturday 11-18-2006 all I have is the completed gettingStarted.pdf
More useless drivel to come.
Tony
11/18/2006 (3:19 am)
I've tried a few new things. Again, I screwed up major. Read this, but don't try it. I had to start over again, from scratch. I can't seem to get things to work, like running torque through VC++. 11-17-2006 Torque 101 - Changing the "Score" to "Gold"
The gettingStarted.pdf explained how to add a "Score" feature to the game, and every time you collide with a torqueLogoItem your score increments by one.
I'm going to change this to something more useful in a Fantasy RolePlaying game.
Start Torque. For me this means double-click the GameOne.ece shortcut on my desktop. The Torque GUI loads. Mine has a "Realm Wars III - The Infinitum3D Project" background, and a "Start" button in the center. I'd load a screenshot, but I never have time to upload any to the website. Maybe next week. Anyways, I click Start and "F-World" loads. I have to remember to change that loading text also. OK so nowI hit (F10) to switch to Mission Editor.
My world consists of the default blue-guy, some terrain, and that's all right now.
So, going back to the gettingStarted.pdf, oh wait, I almost forgot. I created a very simple .DTS file using StudioMax. It's a small lump of gold, called "goldNugget.dts" VERY boring, but it suits our purpose for now.
I've placed a few gold nuggets for our player to collect. Make sure to place them in a SimGroup called Gold. Also, I've named the gold nuggets, Gold001, Gold002, up to Gold005.
In the GUI editor, select GuiTextCtrl. Name our control GoldCounter, and change the PROFILE to GuiBigTextProfile (just like the gettingStarted.pdf) and in the TEXT field, type in Gold: 0. Move the control to the middle of the screen, somewhere near the bottom. And finally, I always set the HorizSizing and VertSizing to relative.
Save the GUI as GameOne/client/ui/playGui.gui
1. In the Server folder, create a new file called goldNugget.cs
Type in (don't cut/paste, you learn more typing it in line by line) this code:
//-------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//----------------------------------------------------------------
datablock StaticShapeData(GoldNugget)
{
category = "Items";
shapeFile = "~/data/shapes/gold/goldNugget.dts";
};
function GoldNugget::onCollision(%this, %obj, %col)
{
if(%col.getClassName() $= "Player")
{
%client = %col.client;
%client.gold++;
commandToClient(%client, 'SetGoldCounter', %client.gold);
%obj.delete();
return;
}
}
Save the file in the SERVER folder.
2. Open the CLIENT folder and create a new file called clientGame.cs
Type in this code:
function clientCmdSetGoldCounter(%gold)
{
GoldCounter.setText("Gold:" SPC %gold);
}
Save this file in the CLIENT folder.
3. Open up GameOne/main.cs and find the // Client scripts
section of the function called initClient. At the bottom of that list, add the following line, which will load our file:
exec("./client/clientGame.cs");
4. Open game.cs and in the "onServerCreated() function, add the line exec("./goldNugget.cs");
Save everything, load Torque and run into your gold nugget. Did it work?
Not for me. I did it again. It hangs while WAITING FOR SERVER. I can't figure out my mistake, so I've screwed up again, and I guess I have to start over. I don't know enough about programming to do my own thing, so I'm going to follow tutorials step-by-step from now on.
I know part of the problem The TorqueLogoItem in the gettingStarted.pdf is located in SHAPES>ITEMS, whereas my goldNugget.dts is located in STATIC SHAPES. I need to figure out how to put my DTS files in SHAPES>ITEMS
I'm going to try to back track here, following my notes, and go back to where things were before I started today.
...
Didn't work. I've got to start over again. Well, I still think I'm learning.
Starting Over AGAIN
Open flat.mis
Save as GameOneMission.mis
Recreating terrain... Repainting terrain... Moving SpawnSphere closer to the ground... Saving as GameOneMission.mis, and GameOneMission_bkup.mis
Starting Torque. OK. What can I try to mess up next :)
Well, here's something annoying. When I double-click GameOne.exe, Torque loads my GUI. If I click START, the F-World loading screen comes up, but it hangs on LIGHTING MISSION. If I cancel and try again, it hangs on LOADING OBJECTS. If I cancel and double-click WORLD EDITOR, it loads flat.mis. From there I can FILE>OPEN MISSION>GameOneMission.mis, but it shouldn't hang while LOADING OBJECTS.
I've noticed in the Forums that this seems to be a common problem, but I don't know what the solution is for this. Is this a Torque problem? a bug? or something I did to the TGE?
I've got to start over entirely. I'm copying the TUTORIAL.BASE folder over my GAMEONE folder and re-doing the .pdf again.
Like I said, I'm going to simply follow tutorials, step by step, until I understand things better. I re-did the gettingStarted.pdf, and the only change I made was to use the brown colored TORQUE background from the Realm Wars dl. I just couldn't look at the GAMEONEBG background anymore.
On the bright side, I'm getting pretty good at the gettingStarted.pdf tutorial :)
As of 6:22am EST Saturday 11-18-2006 all I have is the completed gettingStarted.pdf
More useless drivel to come.
Tony
#53
Thanks again!
11/18/2006 (6:36 am)
Tony, I just wanted to say thanks for this thread. It's well written and interesting to read - I like to see how other people approach TGE and it's interesting how similar it is, too. I.e. I'd have done the same thing as you regarding turning score into gold.Thanks again!
#54
11/19/2006 (1:27 pm)
Thanks Don. I know it can be done, i just have to figure out how to place .dts files into the Shapes>Items directory.
#55
So I have to go back and fix the datablock script.
Tony
11/20/2006 (4:16 pm)
OK, It turns out that there is no Shapes>Items folder. Items is a category in the Datablock of a .cs file.So I have to go back and fix the datablock script.
Tony
#56
GameOne.
Every time something works, I'm going to save it as a backup.
So my game consists of a new Gui startup screen (Torque), a start button that loads GameOneMission.mis, a terrain that I modified and painted, and the default blue guy. I'm not going to put in background music until I get a custom looping .wav file.
I'm going to have to go back to the gettingStarted.pdf tutorial and try to change the Torque Logos into Gold, and change the Score to Gold.
I know I said I was only going to follow tutorial word-for-word and step-by-step, but where's the fun in that. I learn from my mistakes, so let's go make some more :)
I start Torque, and go into Mission Editor. In gettingStarted.pdf, page 7 of 16, PLACING OBJECTS, it says to "expand the Shapes list by clicking on the plus sign, then expand Items. Inside, you'll find the TorqueLogo object."
That's great, but we need goldNugget.dts, not TorqueLogoItem.
To get the goldNugget.dts listed here, we need to create a datablock for it. But where to we do that? Do I need to create a new goldNugget.cs file, or simply add it to an existing .cs.
Well, in the server folder there is a .cs file called logoitem.cs That .cs file was created by someone at Garage Games specifically for the gettingStarted.pdf tutorial. We need to do the same thing. Open the logoitem.cs and you'll see this datablock
So let's create a new .cs file called goldNugget.cs and save it in the server folder.
I made a goldNugget.dts using StudioMax, so I have to place it's files in data>Shapes>goldNugget. Be sure to include the texture files.
Now, back in goldNugget.cs, create this datablock
Next go into the game.cs file and add the line
exec("./goldNugget.cs");
Place it directly under the exec("./logoitem.cs"); line.
Now, start Torque and go into the Mission Editor, World Editor creator. In the tree-view, click Shapes>Items.
HOORAY! The goldNugget is there. If you click it, it will place your gold nugget in the world. Unfortunately, it doesn't have any collision detection. Is that because I exported the .DTS file wrong, or am I missing some code somewhere. It must be because I did the DTS wrong, because the Torque Logo has collision, and there is no collision code in the logoitem.cs file.
OK, I'm going to try loading several DTS files into the ITEMS category using multiple datablocks in a single .cs file.
Let's see if it works.
1. Open goldNugget.cs
2. Add this datablock
Note: You must have a .dts file called crate001.dts for this to work.
3. Save the file, run torque, open Mission Editor, World Editor Creator, and in the tree-view Hooray! It lists my goldNugget AND my crate. So you can load multiple DTS datablocks in a single .CS file. HOWEVER, when you start adding scripts that affect these DTS files, it will get messy quickly. At this point in my programming career I suggest creating a new .CS file for each object, or at least place similar items in similar files. Don't try to lump them all into a single .cs.
Still no collison detection in my crate either.
I'm going to try to load a Realm Wars dts called statue.dts
Yep, the blue-guy bounces off the Realm Wars statue, but passes right through MY .dts files. My exporting isn't working, or maybe my bounding box is incorrect.
Hey, if anyone wants to donate some .DTS files, I'd really appreciate it.
Right now you're thinking "Didn't this guy say he was a 3D artist, but he can't make .DTS files?"
Well, yes I do 3D art, but I'm better at interiors (DIF's) with Quark, and NO I never said I was an artist :)
Anyways, at least I learned how to create "non-static" shapes with Datablocks.
I hope this helps!!! I'll finish changing the Score feature to Gold once I find an acceptible .DTS file.
Remember to save all the working files into your backup directory!!!
EDIT: UPDATE Just remembered. I forgot to add Col-1. Let me go back and create my collision mesh.
AHA!!! It works. I can't believe I forgot to add a collision mesh, but it works now.
OK, so now I have a collidable gold nugget. I have to add the scoreboard feature. Backup your playGui.gui file before editing it.
Going back to gettingStarted.pdf page 12 of 16, from the mission editor, click F10 to open the GUI editor.
Select GuiTextCtrl from the New Control button. In the Inspector window, name the control goldCounter in the text box next to APPLY. In the General section, in the text box, type in Gold: 0
In the Parent section, change HorizSizing and VertSizing to Relative then move it to somewhere you can see it well. I dragged it down to the lower left corner of the screen.
Save it as GameOne/client/ui/playGui.gui.
Now let's code the script. Open goldNugget.cs
Remember to backup your goldNugget.cs file before editing
Add this code
OK, now we create a new .cs file in the client folder called clientGame.cs. Add this code
Save the clientGame.cs file in the client folder.
To load the clientGame.cs file, open up GameOne/main.cs and in the Client scripts
section of the initClient add this line
exec("./client/clientGame.cs");"
Let's run it and see what happens. Naturally, it hangs on loading. AAAARRRRGGGHHHHH!!!!!!!!!!!!
But if I cancel, and go into the World Editor, and load GameOneMission.mis, it loads. But without the Score Counter [GuiTextCtrl]. Did I somehow save the Gui wrong? Let me try again. It IS a problem with my Gui. From the World Editor, I load GameOneMission.mis, which loads without any problems. Then I toggle to Gui Editor (F10) and add my GuiTextCtrl for GoldCounter, make all the needed changes, and save as playGui.gui and toggle back to World Editor. So far so good. When I collide the blue guy with the goldNugget, the nugget disappears and my Gold: 0 becomes Gold: 1.
It works correctly. But when I exit, and try again from the Start button, it hangs. If I go back into the World Editor and load GameOneMission.mis, hey my GoldCounter GuiTextCtrl isn't there anymore. Why? I don't understand. I clicked APPLY, and saved the Gui. Why didn't it save the changes?
I had to copy the playGui.gui from tutorial.base over the playgui.gui in client\ui and then I had to delete out all the .dso files to force a recompile. The i had to go back in and redo the score counter code and save playGui.gui again. It works now. Turns out, I wasn't editing the playGui.gui, I was editing the editorGui.gui. Forcing a recompile allowed me to change the EditorGui to the PlayGui to make my changes then resave.
Tony
11/22/2006 (9:51 pm)
OK, so I've made a backup of my entire (working) C:\Torque\SDK\example\GameOne folder called Copy of GameOne.
Every time something works, I'm going to save it as a backup.
So my game consists of a new Gui startup screen (Torque), a start button that loads GameOneMission.mis, a terrain that I modified and painted, and the default blue guy. I'm not going to put in background music until I get a custom looping .wav file.
I'm going to have to go back to the gettingStarted.pdf tutorial and try to change the Torque Logos into Gold, and change the Score to Gold.
I know I said I was only going to follow tutorial word-for-word and step-by-step, but where's the fun in that. I learn from my mistakes, so let's go make some more :)
I start Torque, and go into Mission Editor. In gettingStarted.pdf, page 7 of 16, PLACING OBJECTS, it says to "expand the Shapes list by clicking on the plus sign, then expand Items. Inside, you'll find the TorqueLogo object."
That's great, but we need goldNugget.dts, not TorqueLogoItem.
To get the goldNugget.dts listed here, we need to create a datablock for it. But where to we do that? Do I need to create a new goldNugget.cs file, or simply add it to an existing .cs.
Well, in the server folder there is a .cs file called logoitem.cs That .cs file was created by someone at Garage Games specifically for the gettingStarted.pdf tutorial. We need to do the same thing. Open the logoitem.cs and you'll see this datablock
Quote:
datablock StaticShapeData(TorqueLogoItem)
{
category = "Items";
shapeFile = "~/data/shapes/3dtorquelogo/torque_logo.dts";
};
So let's create a new .cs file called goldNugget.cs and save it in the server folder.
I made a goldNugget.dts using StudioMax, so I have to place it's files in data>Shapes>goldNugget. Be sure to include the texture files.
Now, back in goldNugget.cs, create this datablock
Quote:
datablock StaticShapeData(goldNugget)
{
category = "Items";
shapeFile = "~/data/shapes/goldNugget/goldNugget.dts";
};
Next go into the game.cs file and add the line
exec("./goldNugget.cs");
Place it directly under the exec("./logoitem.cs"); line.
Now, start Torque and go into the Mission Editor, World Editor creator. In the tree-view, click Shapes>Items.
HOORAY! The goldNugget is there. If you click it, it will place your gold nugget in the world. Unfortunately, it doesn't have any collision detection. Is that because I exported the .DTS file wrong, or am I missing some code somewhere. It must be because I did the DTS wrong, because the Torque Logo has collision, and there is no collision code in the logoitem.cs file.
OK, I'm going to try loading several DTS files into the ITEMS category using multiple datablocks in a single .cs file.
Let's see if it works.
1. Open goldNugget.cs
2. Add this datablock
Quote:
datablock StaticShapeData(crate)
{
category = "Items";
shapeFile = "~/data/shapes/crate/crate001.dts";
};
Note: You must have a .dts file called crate001.dts for this to work.
3. Save the file, run torque, open Mission Editor, World Editor Creator, and in the tree-view Hooray! It lists my goldNugget AND my crate. So you can load multiple DTS datablocks in a single .CS file. HOWEVER, when you start adding scripts that affect these DTS files, it will get messy quickly. At this point in my programming career I suggest creating a new .CS file for each object, or at least place similar items in similar files. Don't try to lump them all into a single .cs.
Still no collison detection in my crate either.
I'm going to try to load a Realm Wars dts called statue.dts
Yep, the blue-guy bounces off the Realm Wars statue, but passes right through MY .dts files. My exporting isn't working, or maybe my bounding box is incorrect.
Hey, if anyone wants to donate some .DTS files, I'd really appreciate it.
Right now you're thinking "Didn't this guy say he was a 3D artist, but he can't make .DTS files?"
Well, yes I do 3D art, but I'm better at interiors (DIF's) with Quark, and NO I never said I was an artist :)
Anyways, at least I learned how to create "non-static" shapes with Datablocks.
I hope this helps!!! I'll finish changing the Score feature to Gold once I find an acceptible .DTS file.
Remember to save all the working files into your backup directory!!!
EDIT: UPDATE Just remembered. I forgot to add Col-1. Let me go back and create my collision mesh.
AHA!!! It works. I can't believe I forgot to add a collision mesh, but it works now.
OK, so now I have a collidable gold nugget. I have to add the scoreboard feature. Backup your playGui.gui file before editing it.
Going back to gettingStarted.pdf page 12 of 16, from the mission editor, click F10 to open the GUI editor.
Select GuiTextCtrl from the New Control button. In the Inspector window, name the control goldCounter in the text box next to APPLY. In the General section, in the text box, type in Gold: 0
In the Parent section, change HorizSizing and VertSizing to Relative then move it to somewhere you can see it well. I dragged it down to the lower left corner of the screen.
Save it as GameOne/client/ui/playGui.gui.
Now let's code the script. Open goldNugget.cs
Remember to backup your goldNugget.cs file before editing
Add this code
Quote:
//--collision detection to increase gold count
function goldNugget::onCollision(%this, %obj, %col)
{
if(%col.getClassName() $= "Player")
{
%client = %col.client;
%client.gold++;
commandToClient(%client, 'SetGoldCounter', %client.gold);
%obj.delete();
}
}
OK, now we create a new .cs file in the client folder called clientGame.cs. Add this code
Quote:
function clientCmdSetGoldCounter(%gold)
{
GoldCounter.setText("Gold:" SPC %gold);
}
Save the clientGame.cs file in the client folder.
To load the clientGame.cs file, open up GameOne/main.cs and in the Client scripts
section of the initClient add this line
exec("./client/clientGame.cs");"
Let's run it and see what happens. Naturally, it hangs on loading. AAAARRRRGGGHHHHH!!!!!!!!!!!!
But if I cancel, and go into the World Editor, and load GameOneMission.mis, it loads. But without the Score Counter [GuiTextCtrl]. Did I somehow save the Gui wrong? Let me try again. It IS a problem with my Gui. From the World Editor, I load GameOneMission.mis, which loads without any problems. Then I toggle to Gui Editor (F10) and add my GuiTextCtrl for GoldCounter, make all the needed changes, and save as playGui.gui and toggle back to World Editor. So far so good. When I collide the blue guy with the goldNugget, the nugget disappears and my Gold: 0 becomes Gold: 1.
It works correctly. But when I exit, and try again from the Start button, it hangs. If I go back into the World Editor and load GameOneMission.mis, hey my GoldCounter GuiTextCtrl isn't there anymore. Why? I don't understand. I clicked APPLY, and saved the Gui. Why didn't it save the changes?
I had to copy the playGui.gui from tutorial.base over the playgui.gui in client\ui and then I had to delete out all the .dso files to force a recompile. The i had to go back in and redo the score counter code and save playGui.gui again. It works now. Turns out, I wasn't editing the playGui.gui, I was editing the editorGui.gui. Forcing a recompile allowed me to change the EditorGui to the PlayGui to make my changes then resave.
Tony
#57
thank you very much!!!
11/25/2006 (1:30 am)
I just started to follow your progress; very nice and helpful for other beginners!thank you very much!!!
#58
Today I'm going to do some minor edits. I'm going to change the "F-World" loading screen, and limit the character's ability to climb steep slopes.
1. I make a back-up copy of the GameOne folder.
2. I start VC2005, File>Open>Project/Solution. Browse to VS2005\Torque SDK.sln and Start Debugging (F5).
3. Start the game, then go into the Mission Editor.
4. Changing "F World".
In the tree-view, under 1522: SimGroup - MissionGroup the number (1522) is irrelevant you should see 1523: ScriptObject - MissionInfo again, the number (1523) is irrelevant. Click the ScriptObject. Now, in the lower window, you should see "Classes" and "Dynamic Fields". "Dynamic Fields" has two properties, "name" and "desc0".
"name" says "F World", so change that. I changed mine to Veterinarian's Hospital.
"desc0" says "The tutorial base example mission. This mission contains a minimal set of example art and textures." I changed mine to Our continuing stooory of a quack who's gone to the dogs. Just a little tribute to Jim Henson's "The Muppet Show"
I'll change it to something more interesting once the game progresses. I just wanted to find out how to change it.
5. Changing the slopes.
Open server/player.cs
Add these lines to datablock PlayerData(PlayerBody)
runSurfaceAngle = 45; // The lower the number, the harder it is to walk/run up the hill
jumpSurfaceAngle = 45;
This means a character can climb up hills with a 45 degree slope. Later on we'll figure out how to modify this number at run time, so that a skilled character can climb slopes of 60 degrees, and an expert can climb 75 degree slopes. Maybe a spider climb potion changes the angle to 60 or 75 for sixty seconds. But more on that at another time.
//------------------------
Background Music
I'm going to go back in and add a looping background wav. I'll probably get sick of hearing it, but the silence is just wierd.
I'm not going to post the steps again. Just go back a few posts to 11-02-2006 and re-read it.
Tony
11/29/2006 (7:23 pm)
As it stands, my game is now a "pseudo-custom" background on the start-up screen, simple terrain, the default blue guy, a gold nugget, and a Gold counter.Today I'm going to do some minor edits. I'm going to change the "F-World" loading screen, and limit the character's ability to climb steep slopes.
1. I make a back-up copy of the GameOne folder.
2. I start VC2005, File>Open>Project/Solution. Browse to VS2005\Torque SDK.sln and Start Debugging (F5).
3. Start the game, then go into the Mission Editor.
4. Changing "F World".
In the tree-view, under 1522: SimGroup - MissionGroup the number (1522) is irrelevant you should see 1523: ScriptObject - MissionInfo again, the number (1523) is irrelevant. Click the ScriptObject. Now, in the lower window, you should see "Classes" and "Dynamic Fields". "Dynamic Fields" has two properties, "name" and "desc0".
"name" says "F World", so change that. I changed mine to Veterinarian's Hospital.
"desc0" says "The tutorial base example mission. This mission contains a minimal set of example art and textures." I changed mine to Our continuing stooory of a quack who's gone to the dogs. Just a little tribute to Jim Henson's "The Muppet Show"
I'll change it to something more interesting once the game progresses. I just wanted to find out how to change it.
5. Changing the slopes.
Open server/player.cs
Add these lines to datablock PlayerData(PlayerBody)
runSurfaceAngle = 45; // The lower the number, the harder it is to walk/run up the hill
jumpSurfaceAngle = 45;
This means a character can climb up hills with a 45 degree slope. Later on we'll figure out how to modify this number at run time, so that a skilled character can climb slopes of 60 degrees, and an expert can climb 75 degree slopes. Maybe a spider climb potion changes the angle to 60 or 75 for sixty seconds. But more on that at another time.
//------------------------
Background Music
I'm going to go back in and add a looping background wav. I'll probably get sick of hearing it, but the silence is just wierd.
I'm not going to post the steps again. Just go back a few posts to 11-02-2006 and re-read it.
Tony
#59
OK, so now we've come up with a few things that work, but our game is seriously limited. We can save alot of time by using one of the "pre-made" starter kits. This isn't cheating. It's called "getting a prototype out quickly". This will still be an original game.
Let's look at starter.fps
First off, make a copy of starter.fps and name it GameOneFPS. Keep this folder in the c:TorqueSDKexample folder.
Now, open C:TorqueSDKexamplemain.cs and cjange the line
$defaultGame = "GameOne"; to $defaultGame = "GameOneFPS";
Save the file.
Now when you run Torque, it will look for the game files in GameOneFPS rather than the GameOne folder.
Why am I doing this? Well, in my opinion, all RPG's and FPS games are the same. They all share elements of both first-person shooters AND role-playing games. By using the starter.fps kit, we can save time and effort. I know many people will be saying, this isn't programming, this is modding. Well, yes and no. Anything we do with Torque is technically "modding", since we aren't actually writing the engine. But why re-invent the wheel. Besides, we're going to change so many things that the starter.fps won't even be recognizable. So, with that said, let's start our game.
Run Torque. I always open VC++ and load the TorqueSDK.sln file to do my editing/debugging.
When Torque starts, it now brings up the FPS Starter Kit. Actually, it displays a GarageGames splashscreen, then loads the FPS Starter Kit page.
So the game has six buttons pre-loaded.
Start Mission ...
Join Server ...
Options ...
About ...
Recordings ...
Quit!
Let's focus on Start Mission ... for now. Start Mission ... brings up an options screen. You can enter your screen name at the top (it defaults to Fresh Meat). If you check the box for Host Multiplayer, well I think it makes you a server. You can go <<Back to the main menu or Launch Mission! and you have four choices for Missions.
1. A Stonghold - a winter mission with snow recipitation effect, and an orc (named Kork) following a path.
2. Content Pack Demo 1 - a jungle mission template with lots of plants and greenery, and a rainstorm precipitation effect. A major resource hog on my system.
3. Content Pack Demo 2 - a desert mission template with a duststorm effect.
4. Lighting System Feature Demonstration - a demo of advanced lighting features.
I'm going to copy all of the files in the GameOnedatamissions folder into the GameOneFPSdatamissions folder. mow, when we run Torque, we can get our GameOneMission.mis to load, but with the added features of starter.fps
Run Torque. I select the mission called Veterinarians Hospital (the last mission I edited) and Launch Mission.
Cool. My world loads with the terrain I created and painted, but now the blue-guy has been replaced by an orc holding a crossbow. I have no background music, or gold counter, but I have gained health and magic bars, and ...
let's do it this way;
Gains: blue-guy replaced by orc
orc has crossbow
crossbow shoots arrows
arrows explode on collsion
orc leves footprints on ground
footprints fade over time
orc creates puffs of dust when running
footsteps sound effect
chat window (says "Welcome to the Torque demo app Fresh Meat."
Lost: background music
gold counter
I think it was worth the trade off.
One thing that needs fixed is the detailTexture of the terrain. In the mission editor we go to the Inspector, click TerrainBlock in the upper tree-view, and in the lower tree-view look for Media>detailTexture. Click the ... to bring up a browse menu. The dataterrainsdetails folder has lots of detail textures to choose from. I use detail_demo.jpg but try them all and find one you like, or ideally you can PhotoShop your own original.
OK, so I'm going to place a few buildings, and some other detail objects to create a simple village, and then we'll we where we go from there.
More to come...
Tony
11/29/2006 (7:23 pm)
11-27-2006 Torque 101 - Starter.FPSOK, so now we've come up with a few things that work, but our game is seriously limited. We can save alot of time by using one of the "pre-made" starter kits. This isn't cheating. It's called "getting a prototype out quickly". This will still be an original game.
Let's look at starter.fps
First off, make a copy of starter.fps and name it GameOneFPS. Keep this folder in the c:TorqueSDKexample folder.
Now, open C:TorqueSDKexamplemain.cs and cjange the line
$defaultGame = "GameOne"; to $defaultGame = "GameOneFPS";
Save the file.
Now when you run Torque, it will look for the game files in GameOneFPS rather than the GameOne folder.
Why am I doing this? Well, in my opinion, all RPG's and FPS games are the same. They all share elements of both first-person shooters AND role-playing games. By using the starter.fps kit, we can save time and effort. I know many people will be saying, this isn't programming, this is modding. Well, yes and no. Anything we do with Torque is technically "modding", since we aren't actually writing the engine. But why re-invent the wheel. Besides, we're going to change so many things that the starter.fps won't even be recognizable. So, with that said, let's start our game.
Run Torque. I always open VC++ and load the TorqueSDK.sln file to do my editing/debugging.
When Torque starts, it now brings up the FPS Starter Kit. Actually, it displays a GarageGames splashscreen, then loads the FPS Starter Kit page.
So the game has six buttons pre-loaded.
Start Mission ...
Join Server ...
Options ...
About ...
Recordings ...
Quit!
Let's focus on Start Mission ... for now. Start Mission ... brings up an options screen. You can enter your screen name at the top (it defaults to Fresh Meat). If you check the box for Host Multiplayer, well I think it makes you a server. You can go <<Back to the main menu or Launch Mission! and you have four choices for Missions.
1. A Stonghold - a winter mission with snow recipitation effect, and an orc (named Kork) following a path.
2. Content Pack Demo 1 - a jungle mission template with lots of plants and greenery, and a rainstorm precipitation effect. A major resource hog on my system.
3. Content Pack Demo 2 - a desert mission template with a duststorm effect.
4. Lighting System Feature Demonstration - a demo of advanced lighting features.
I'm going to copy all of the files in the GameOnedatamissions folder into the GameOneFPSdatamissions folder. mow, when we run Torque, we can get our GameOneMission.mis to load, but with the added features of starter.fps
Run Torque. I select the mission called Veterinarians Hospital (the last mission I edited) and Launch Mission.
Cool. My world loads with the terrain I created and painted, but now the blue-guy has been replaced by an orc holding a crossbow. I have no background music, or gold counter, but I have gained health and magic bars, and ...
let's do it this way;
Gains: blue-guy replaced by orc
orc has crossbow
crossbow shoots arrows
arrows explode on collsion
orc leves footprints on ground
footprints fade over time
orc creates puffs of dust when running
footsteps sound effect
chat window (says "Welcome to the Torque demo app Fresh Meat."
Lost: background music
gold counter
I think it was worth the trade off.
One thing that needs fixed is the detailTexture of the terrain. In the mission editor we go to the Inspector, click TerrainBlock in the upper tree-view, and in the lower tree-view look for Media>detailTexture. Click the ... to bring up a browse menu. The dataterrainsdetails folder has lots of detail textures to choose from. I use detail_demo.jpg but try them all and find one you like, or ideally you can PhotoShop your own original.
OK, so I'm going to place a few buildings, and some other detail objects to create a simple village, and then we'll we where we go from there.
More to come...
Tony
#60
I'm going to try to create a trigger that will send a message to the screen. My plan is to place a roadSign.dts in the world and whenever the character approaches the sign, a message will pop-up showing the information on the road sign. Rather than have a different .DTS file for every road sign (like Main St., 1st Ave., 2nd Ave, etc.), I'll have a generic blank road sign and triggers to explain what the sign says.
1. Create a new signTriggers.cs file and save it in the Clients\Scripts folder.
2. We need to create a datablock for our trigger.
and we have to apply this datablock to a function. Place this after the datablock,
3. Open Client\init.cs and scroll down to the //Client scripts section. We have to activate our signTriggers.cs file, so add this line,
4. Start Torque and go into the Mission Editor.
In the World Editor Creator, look at the lower tree-view for Mission Objects>Mission>trigger.
Click this and a window pops up Building Object: Trigger
Type in a name, signYorkville and click next to defaultTrigger. Darn. Our signYorkville trigger should be there, but it isn't. Why? All I see is DefaultTrigger and sgParticleEmitterTriggerDataBlock. I have to find these datablocks and see how they differ from mine.
First thing I see is a triggers.cs file in the server\scripts folder. Maybe our signTriggers.cs file needs to be in this folder. Let's move the file from client\scripts to server\scripts.
Restart Torque and go to Mission Editor. Try to place a trigger. Nope, our datablock is still not listed. Let's look in the server\scripts folder again. There is no signTriggers.cs.dso
Let's delete all the .dso files to force a recompile.
Restart Torque and go to mission editor again. Nope still not listed.
OK I'm going to open Triggers.cs and signTriggers.cs side by side to compare.
There's my mistake. The function signYorkvilleTrigger does not match my datablock signYorkville.
So correct the datablock to this
I've added the word Trigger after signYorkvilleTrigger.
Save the file and restart Torque and go to the mission editor again. Darn, the datablock still isn't listed.
Let's look at the .cs files again. Maybe we need the onLeaveTrigger and onTickTrigger commands.
Let's add this
Save, go to Torque Mission Editor again... Still not listed.
Let's move the signTriggers.cs file back to client\scripts.
signTriggers.cs still isn't getting it's .dso.
I guess I need to place the exec command somewhere else, or else I'm still not coding it correctly.
I'm adding
OK in server\scripts\game.cs there is the exec command for triggers.cs so let's add the line
Make sure to put the signTriggers.cs file back into server\scripts
back to the mission editor... Nope, still not loading the signTriggers.cs file.
Let me ask in the forums and come back later.
Tony
12/01/2006 (3:57 am)
11-30-2006 Torque 101 - Triggers 001I'm going to try to create a trigger that will send a message to the screen. My plan is to place a roadSign.dts in the world and whenever the character approaches the sign, a message will pop-up showing the information on the road sign. Rather than have a different .DTS file for every road sign (like Main St., 1st Ave., 2nd Ave, etc.), I'll have a generic blank road sign and triggers to explain what the sign says.
1. Create a new signTriggers.cs file and save it in the Clients\Scripts folder.
2. We need to create a datablock for our trigger.
Quote:
datablock TriggerData(signYorkville)
{
tickPeriodMS = 1000;
}
and we have to apply this datablock to a function. Place this after the datablock,
Quote:
function signYorkvilleTrigger::onEnterTrigger(%this,%trigger,%obj)
{
//echo sends a message to the console
echo("This road leads to Yorkville.");
//print message to client
centerPrint(%obj.client, "This road leads to Yorkville.", 1, 1);
Parent::onTriggerEnter
}
3. Open Client\init.cs and scroll down to the //Client scripts section. We have to activate our signTriggers.cs file, so add this line,
Quote:
exec("./scripts/signTriggers.cs");
4. Start Torque and go into the Mission Editor.
In the World Editor Creator, look at the lower tree-view for Mission Objects>Mission>trigger.
Click this and a window pops up Building Object: Trigger
Type in a name, signYorkville and click next to defaultTrigger. Darn. Our signYorkville trigger should be there, but it isn't. Why? All I see is DefaultTrigger and sgParticleEmitterTriggerDataBlock. I have to find these datablocks and see how they differ from mine.
First thing I see is a triggers.cs file in the server\scripts folder. Maybe our signTriggers.cs file needs to be in this folder. Let's move the file from client\scripts to server\scripts.
Restart Torque and go to Mission Editor. Try to place a trigger. Nope, our datablock is still not listed. Let's look in the server\scripts folder again. There is no signTriggers.cs.dso
Let's delete all the .dso files to force a recompile.
Restart Torque and go to mission editor again. Nope still not listed.
OK I'm going to open Triggers.cs and signTriggers.cs side by side to compare.
There's my mistake. The function signYorkvilleTrigger does not match my datablock signYorkville.
So correct the datablock to this
Quote:
datablock TriggerData(signYorkvilleTrigger)
{
tickPeriodMS = 1000;
}
I've added the word Trigger after signYorkvilleTrigger.
Save the file and restart Torque and go to the mission editor again. Darn, the datablock still isn't listed.
Let's look at the .cs files again. Maybe we need the onLeaveTrigger and onTickTrigger commands.
Let's add this
Quote:
function signYorkvilleTrigger::onLeaveTrigger(%this,%trigger,%obj)
{
// This method is called whenever an object leaves the %trigger
// area, the object is passed as %obj. The default onLeaveTrigger
// method (in the C++ code) invokes the ::onTrigger(%trigger,0) method on
// every object (whatever it's type) in the same group as the trigger.
Parent::onLeaveTrigger(%this,%trigger,%obj);
}
function signYorkvilleTrigger::onTickTrigger(%this,%trigger)
{
// This method is called every tickPerioMS, as long as any
// objects intersect the trigger. The default onTriggerTick
// method (in the C++ code) invokes the ::onTriggerTick(%trigger) method on
// every object (whatever it's type) in the same group as the trigger.
// You can iterate through the objects in the list by using these
// methods:
// %this.getNumObjects();
// %this.getObject(n);
Parent::onTickTrigger(%this,%trigger);
}
Save, go to Torque Mission Editor again... Still not listed.
Let's move the signTriggers.cs file back to client\scripts.
signTriggers.cs still isn't getting it's .dso.
I guess I need to place the exec command somewhere else, or else I'm still not coding it correctly.
I'm adding
Quote:to onLeaveTrigger and also to onTickTrigger, so that they are the same as onEnterTrigger.
echo("This road leads to Yorkville.");
OK in server\scripts\game.cs there is the exec command for triggers.cs so let's add the line
Quote:
exec("./signTriggers.cs");
Make sure to put the signTriggers.cs file back into server\scripts
back to the mission editor... Nope, still not loading the signTriggers.cs file.
Let me ask in the forums and come back later.
Tony
Torque Owner Infinitum3D
I'm going to add some mood music playing in the background. Why now? Why not :)
Ok, so...
Torque 101: adding a background sound
This is based on another Desmond Fletcher tutorial. I also have tutorials from Buffy, PerlMonkey, and Code Sampler, but I'll do those later.
In the C:\Torque\SDK\example\GameOne\data folder create a new folder called Music and place your looping wav file there. Mine is called background.wav/ Real original.
Next open the C:\Torque\SDK\example\common\Client\mission.cs file. Mine currently has two functions,
clientCmdMissionStart(%seq) and clientCmdMissionEnd(%seq)
add this line to the CmdMissionStart
alxPlay("Background_Music"); so that it reads like this
function clientCmdMissionStart(%seq)
{
// The client receives a mission start right before being dropped into the game.
alxPlay("Background_Music"); //add this line
}
This activates the sound player (alxPlay).
Next, open C:\Torque\SDK\example\GameOne\client\audioProfiles.cs
There are two AudioDescriptions already. We will create a new description called AudioDefaultLoop and set the isLooping parameter to "true".
new AudioDescription(AudioDefaultLoop)
{
volume = 1.0;
isLooping = true;
is3D = false;
type = $DefaultAudioType;
};
Just cut and paste the above function to the bottom of the audioProfiles.cs