Torque 3D RTS prototype Documentation
by Mark Rogotowicz · in Torque 3D Beginner · 09/29/2009 (10:43 am) · 23 replies
Hi guys,
This could be a noob question, but I am having difficulty completing the RTS prototype tutorial in the Torque scripting documentation.
Please be aware that I am using the DEMO version.
I have downloaded the zip file containing the sample assets as the documentation states, but the following error still occurs:

Also, after editing all the scripts, the game would not run in a 3rd person/top down perspective when I changed the camera angles.
I then proceeded to just copy the referenced script files (from the documentation links) into the relevant directories, and still no luck.
When adding in the code manually, I did find a few reference errors.
Eg.
The documentation states at the beginning of the RTS section -
Open game/scripts/server/game.cs. In function GameConnection::onClientEnterGame(%this), locate the following line:
%this.spawnPlayer(%playerSpawnPoint);
However, this line or GameConnection function do not exist. I found them in the game.cs file in the gamecorescriptsserver directory, but I do not believe this to be the correct file.
Also, I did create a new project - with the FULL template.
Is there a limit on what can be done in the DEMO version?
Can anyone help me?
Thanks.
This could be a noob question, but I am having difficulty completing the RTS prototype tutorial in the Torque scripting documentation.
Please be aware that I am using the DEMO version.
I have downloaded the zip file containing the sample assets as the documentation states, but the following error still occurs:

Also, after editing all the scripts, the game would not run in a 3rd person/top down perspective when I changed the camera angles.
I then proceeded to just copy the referenced script files (from the documentation links) into the relevant directories, and still no luck.
When adding in the code manually, I did find a few reference errors.
Eg.
The documentation states at the beginning of the RTS section -
Open game/scripts/server/game.cs. In function GameConnection::onClientEnterGame(%this), locate the following line:
%this.spawnPlayer(%playerSpawnPoint);
However, this line or GameConnection function do not exist. I found them in the game.cs file in the gamecorescriptsserver directory, but I do not believe this to be the correct file.
Also, I did create a new project - with the FULL template.
Is there a limit on what can be done in the DEMO version?
Can anyone help me?
Thanks.
#2
09/29/2009 (1:17 pm)
Yes. The tutorial is out dated, since things were changing all the way up until yesterday. It will be updated this week.
#3
09/30/2009 (11:48 pm)
I also had the same problem glad to see im not going crazy. i look forward to the updated tutorial.
#4
I could give a hand in making sure the tutorials are up to date with the current Template since I did help (some) in setting it up -- if you need some help that is, sounds like a simple problem (and solution) to me :D
10/01/2009 (1:34 am)
@Michael:I could give a hand in making sure the tutorials are up to date with the current Template since I did help (some) in setting it up -- if you need some help that is, sounds like a simple problem (and solution) to me :D
#5
10/01/2009 (2:07 pm)
@Michael - That would be fantastic to get some help. Shoot me an e-mail to see what we can work out. You should already have it.
#6
"Orbit Camera
Add the following to the Spawn Script of the spawn sphere... "
10/02/2009 (7:10 am)
i found another confusing part in this tutorial, something like, add the following to the spawn script of the spawn sphere, i don't know witch .cs file i need to add this :(."Orbit Camera
Add the following to the Spawn Script of the spawn sphere... "
#7
This thread covers the most obvious differences in regards to the new GameType script object and a necessary change for the camera -- this will make the new Template behave pretty much like the old Template for purposes of the tutorial.
There are some other minor little details in regards to datablocks and assets to watch out for -- so be careful about overwriting the existing (new) script files -- but for the time being it should be fairly simple to tell when or if you need to use the sample assets. The weapon shapes and datablocks are not needed -- the Swarmgun is now called Rocketlauncher, but it is the same weapon.
It looks like Michael had the Tutorial written up for Template in Beta5 (as I'm almost certain I didn't add the Blaster/SpaceRifle until then), but for the new GameType system it may actually be preferable to write a RTSGame gametype that will simply just drop in instead of having to modify the GameCore in order to make it work. No promises due to other responsibilities, but I'll see about setting one of those up. Alternatively it may even be a good idea to re-work the tutorial to use the Empty Project.
10/05/2009 (1:17 pm)
I didn't realize there are about three of these threads now. Sickness and other things have caused me not to be able to give as much attention to this as I thought I would have. This thread covers the most obvious differences in regards to the new GameType script object and a necessary change for the camera -- this will make the new Template behave pretty much like the old Template for purposes of the tutorial.
There are some other minor little details in regards to datablocks and assets to watch out for -- so be careful about overwriting the existing (new) script files -- but for the time being it should be fairly simple to tell when or if you need to use the sample assets. The weapon shapes and datablocks are not needed -- the Swarmgun is now called Rocketlauncher, but it is the same weapon.
It looks like Michael had the Tutorial written up for Template in Beta5 (as I'm almost certain I didn't add the Blaster/SpaceRifle until then), but for the new GameType system it may actually be preferable to write a RTSGame gametype that will simply just drop in instead of having to modify the GameCore in order to make it work. No promises due to other responsibilities, but I'll see about setting one of those up. Alternatively it may even be a good idea to re-work the tutorial to use the Empty Project.
#9
Here's a little backstory (quoted from Brett Williams)
Make these changes to /scripts/server/gameCore.cs to get a behavior similar to the old.
1) Update GameCore::SpawnPlayer
Locate:
2) Add conditional, scroll to the bottom of the SpawnPlayer function
Locate:
3) Update the GameCore::PreparePlayer..
Locate:
And thanks to Brett for posting his findings before I could get to it! :D
10/05/2009 (7:05 pm)
Ooops, I tend not to notice that some threads are public and others are private.Here's a little backstory (quoted from Brett Williams)
Quote:
Okay, so it appears that the game object gets set to the class of DeathMatchGame, because DM is the default. This is done by GameCore.cs and gameDM.cs
DeathMatchGame::PreparePlayer has replaced SpawnPlayer in most cases. This allows you to customize the player preparation prior to spawn by game type.
The GameConnection::SpawnPlayer doesn't appear to be used from spawn.cs in core/scripts/server.
GameCore::SpawnPlayer is your new spawn function for the game type. Alternatively you can override this using the GameDM or make a new game type class.
The issue is that GameCore::SpawnPlayer does not have a %noControl.
If you look at GameCore::SpawnPlayer, toward the end you will see: %this.setControlObject(%control); Commenting out this line will get the desired behavior.
Alternatively you could add a new %noControl parameter to the SpawnPlayer function, and then in PreparePlayer, have it pass false as the final parameter, to get the old behavior back.
In my opinion that's the way to go, because then you can have different game types have different control behavior. Like a Lobby game type that triggers in between matches where everyone has no control, for example, but can fly around the level.
Make these changes to /scripts/server/gameCore.cs to get a behavior similar to the old.
1) Update GameCore::SpawnPlayer
Locate:
function GameCore::spawnPlayer(%game, %this, %spawnPoint)And replace it with:
function GameCore::spawnPlayer(%game, %this, %spawnPoint, %noControl)
2) Add conditional, scroll to the bottom of the SpawnPlayer function
Locate:
%this.setControlObject(%control);And replace it with:
if (!isDefined("%noControl"))
%this.setControlObject(%control); 3) Update the GameCore::PreparePlayer..
Locate:
%game.spawnPlayer(%client, %playerSpawnPoint);Replace it with:
%game.spawnPlayer(%client, %playerSpawnPoint, false);That will pretty much make GameCore::SpawnPlayer behave like the old GameConnection::SpawnPlayer method, for the purposes of the tutorial.
And thanks to Brett for posting his findings before I could get to it! :D
#10
10/05/2009 (7:09 pm)
... and the camera:Quote:
One more thing about the tutorial that doesn't seem to work straight away with 1.0 is the overhead camera. Just adding the script fields to the spawn sphere wont work, you still start the map with a regular free fly camera, switching to mouse look and movign the mouse a bit actually fixes that but then you have to adjust the camera height using the console. Looking at GameCore::spawnPlayer I noticed this piece of code at the bottom of the function
// Update the default camera to start with the player
if (isObject(%this.camera))
{
if (%player.getClassname() $= "Player")
%this.camera.setTransform(%player.getEyeTransform());
else
%this.camera.setTransform(%player.getTransform());
// If we ended up spawning a second camera with the same
// type as the default camera then defer to the default instead
if (%player.getClassname() $= %this.camera.getClassname() &&
%player.getDatablock() == %this.camera.getDatablock())
{
%player.delete();
%this.setControlObject(%this.camera);
return;
}Quote:Thanks to Oswaldo Grassioto.
commenting out the set transform lines fixed the overhead camera start up problem
#11
BTW. The tutorial is GREAT! I think I am starting to believe that I can make a game with T3D :D
10/06/2009 (8:32 pm)
It Works! Thank you Michael :DBTW. The tutorial is GREAT! I think I am starting to believe that I can make a game with T3D :D
#12
10/08/2009 (6:22 am)
You guys should at least add a disclaimer to the online documentation.
#13
If adjusting the height of the camera using the mouse wheel is not working that is because the binding of the mouseZoom function is missing.
To correct this add the following line after the mouseZoom function in scripts/client/default.bind.cs
moveMap.bind( mouse, zaxis, mouseZoom );
10/08/2009 (5:44 pm)
One last note for Overhead Camera section: If adjusting the height of the camera using the mouse wheel is not working that is because the binding of the mouseZoom function is missing.
To correct this add the following line after the mouseZoom function in scripts/client/default.bind.cs
moveMap.bind( mouse, zaxis, mouseZoom );
#14
http://docs.garagegames.com/torque-3d/official/index.html?content/documentation/Introduction/Introduction.html
I am hacking through trying to get the rts_prototype.zip going and it just indicates its loading the DATABLOCKS and sits there with a full bar.
On another note I have to say this engine is awesome and an excellent job you guys have done. Looking forward to doing some serious stuff.
My console shows this BTW towards the end.
*** Sending mission load to client: levels/Empty Room.mis
Mapping string: ServerMessage to index: 0
Mapping string: MsgConnectionError to index: 1
Mapping string: MsgLoadInfo to index: 2
Mapping string: MsgLoadDescripition to index: 3
Mapping string: MsgLoadInfoDone to index: 4
Mapping string: MsgClientJoin to index: 5
Mapping string: Welcome to the Torque demo app %1. to index: 6
Mapping string: Visitor to index: 7
Mapping string: MissionStartPhase1 to index: 8
*** New Mission: levels/Empty Room.mis
*** Phase 1: Download Datablocks & Targets
Mapping string: MissionStartPhase1Ack to index: 0
[MaterialList::mapMaterials] Creating missing material for texture: art/shapes/weapons/SwarmGun/guide
[MaterialList::mapMaterials] Creating missing material for texture: art/shapes/weapons/SwarmGun/energy
Validation required for shape: art/shapes/players/BoomBot/BoomBot.dts
Validation required for shape: art/shapes/players/BoomBot/BoomBot.dts
Validation required for shape: art/shapes/players/Spacesuit/Spacesuit.dts
Client 3249 packet error: Missing particle texture: art/shapes/particles/fire.
CDROP: 3249 local
[FileSystemChangeNotifier::internalNotifyDirChanged] : [/shaders/procedural]
[FileSystemChangeNotifier::internalNotifyDirChanged] : [/shaders/procedural]
Window focus status changed: focus: 0
Using background sleep time: 200
Window focus status changed: focus: 1
Exporting Gui preferences.
*** ENDING MISSION
Exporting server prefs...
Exporting client prefs
Exporting server prefs
Cur. D3DDevice ref count=1
10/12/2009 (7:27 am)
Hi Michael I was wondering when the rts_prototype.zip file will be updated and the tutorial doco on this page.http://docs.garagegames.com/torque-3d/official/index.html?content/documentation/Introduction/Introduction.html
I am hacking through trying to get the rts_prototype.zip going and it just indicates its loading the DATABLOCKS and sits there with a full bar.
On another note I have to say this engine is awesome and an excellent job you guys have done. Looking forward to doing some serious stuff.
My console shows this BTW towards the end.
*** Sending mission load to client: levels/Empty Room.mis
Mapping string: ServerMessage to index: 0
Mapping string: MsgConnectionError to index: 1
Mapping string: MsgLoadInfo to index: 2
Mapping string: MsgLoadDescripition to index: 3
Mapping string: MsgLoadInfoDone to index: 4
Mapping string: MsgClientJoin to index: 5
Mapping string: Welcome to the Torque demo app %1. to index: 6
Mapping string: Visitor to index: 7
Mapping string: MissionStartPhase1 to index: 8
*** New Mission: levels/Empty Room.mis
*** Phase 1: Download Datablocks & Targets
Mapping string: MissionStartPhase1Ack to index: 0
[MaterialList::mapMaterials] Creating missing material for texture: art/shapes/weapons/SwarmGun/guide
[MaterialList::mapMaterials] Creating missing material for texture: art/shapes/weapons/SwarmGun/energy
Validation required for shape: art/shapes/players/BoomBot/BoomBot.dts
Validation required for shape: art/shapes/players/BoomBot/BoomBot.dts
Validation required for shape: art/shapes/players/Spacesuit/Spacesuit.dts
Client 3249 packet error: Missing particle texture: art/shapes/particles/fire.
CDROP: 3249 local
[FileSystemChangeNotifier::internalNotifyDirChanged] : [/shaders/procedural]
[FileSystemChangeNotifier::internalNotifyDirChanged] : [/shaders/procedural]
Window focus status changed: focus: 0
Using background sleep time: 200
Window focus status changed: focus: 1
Exporting Gui preferences.
*** ENDING MISSION
Exporting server prefs...
Exporting client prefs
Exporting server prefs
Cur. D3DDevice ref count=1
#15
I was having the same problem, but after tinkering with the files a bit I managed to get it working.
Download the .zip file and Copy the markers folder into your game/art folder. Then copy the shapes/players and shapes/building folder into your game/art/shapes folder. You don't have to copy the weapons folder since the same one already exists.
Copy the datablocks/players folder into the game/art/datablocks folder
Then add the following lines to the end of the game/art/datablocks/datablockExec.cs file:
I haven't finished the tutorial yet, but it's been working so far.
10/14/2009 (5:19 am)
@MichaelI was having the same problem, but after tinkering with the files a bit I managed to get it working.
Download the .zip file and Copy the markers folder into your game/art folder. Then copy the shapes/players and shapes/building folder into your game/art/shapes folder. You don't have to copy the weapons folder since the same one already exists.
Copy the datablocks/players folder into the game/art/datablocks folder
Then add the following lines to the end of the game/art/datablocks/datablockExec.cs file:
exec("./players/player.cs");
exec("./players/BoomBot.cs");
exec("./players/Spacesuit.cs");I haven't finished the tutorial yet, but it's been working so far.
#17
Thanks guys.
I'll keep you updated when I have more stuff to show that is not here.
10/14/2009 (6:57 am)
Yep I'm Rockin....Thanks guys.
I'll keep you updated when I have more stuff to show that is not here.
#18
10/14/2009 (12:26 pm)
I'm uploading an updated version of the tutorial when I get to the office. It is 1.0 compatible, OOB.
#19
Me on the otherhand is another issue entirely. ;)
10/15/2009 (8:13 am)
IMO if you guys can fix the RTS tutorial by tinkering with files, you probably don't need to go through it. lolMe on the otherhand is another issue entirely. ;)
#20
10/15/2009 (3:22 pm)
I'm going out of town for 4 or 5 days. There will not be any updates from me while I'm gone, since I will have little to no computer access. I should be back in the office around Tuesday.
Associate Michael Hall
Distracted...
I haven't checked out that tutorial, but if you're needing to spawn into the game it is called initially (when you enter the game) by GameConnection::spawnPlayer() which is part of the GameCore package. All subsequent spawns are handled by GameCore::preparePlayer() which calls an overridden spawnPlayer function.
Your sound preload errors: check that the paths are correct for the sound profiles in question.
The sequence errors: are harmless and result from a "named" sequence being used more than once... truthfully I had thought that was fixed already.
The missing xxxx.cs errors: a lot of these files were removed and/or no longer relevant.
EDIT: apparently the tutorial is just simply outdated.