How to script using the CONSOLE for Torque Game Engine?
by Shane09 · in General Discussion · 01/10/2009 (6:59 am) · 1 replies
First off, I will state that I have a Torque Game Engine before 1.5.
Up to this point, I know you can use the CONSOLE function in Torque to add players. I have heard the term "AI", and if it stands for anything, I have no clue. I am currently reading a simple AI tutorial on the TDN. Is it faster to do a lot of the work using the CONSOLE? Will it save more time? I have a few questions:
1) Is using the CONSOLE going to save time while coding on the Torque Game Engine?
2) I know you can add players, and up XYZ locations and even name them using the CONSOLE, but can you edit other things such as terrain textures? Really, I don't even know exactly how many things can be created/edited using the CONSOLE.
3) What does AI stand for, and what does it have to do with the CONSOLE?
Thanks.
P.S. If another question comes up, I will make a note on this forumn. Thanks.
4) Can you change the camera view using the CONSOLE? I am trying to make it so the camera follows the player from a "god-view" as seen in RTS games. I am taking this out of GPGT (page 207). Here is the script:
Is this even the right code I am looking for, or is it written collectly? I had to take it out of GPGT (page 207) and it was kind of hard to tell where some spaces go, so I tried the best I could. Also, if this is the right code, would I add this under "camera.cs"? If this is not what I am looking for, does anyone know a resource on how I can accomplish what I want to achieve? I have looked at the RTS Starter Kit, but I am not sure I want to get for just this one feature.
Up to this point, I know you can use the CONSOLE function in Torque to add players. I have heard the term "AI", and if it stands for anything, I have no clue. I am currently reading a simple AI tutorial on the TDN. Is it faster to do a lot of the work using the CONSOLE? Will it save more time? I have a few questions:
1) Is using the CONSOLE going to save time while coding on the Torque Game Engine?
2) I know you can add players, and up XYZ locations and even name them using the CONSOLE, but can you edit other things such as terrain textures? Really, I don't even know exactly how many things can be created/edited using the CONSOLE.
3) What does AI stand for, and what does it have to do with the CONSOLE?
Thanks.
P.S. If another question comes up, I will make a note on this forumn. Thanks.
4) Can you change the camera view using the CONSOLE? I am trying to make it so the camera follows the player from a "god-view" as seen in RTS games. I am taking this out of GPGT (page 207). Here is the script:
%client.setControlObject(%camera);
%camera.setFlyMode();
$camera::movementSpeed = 25;
// limit camera velocity to 25 world units/s
%client.setControlObject(%camera);
%camera.setOrbitMode( %player , %player.getTransform() , 10.0 , 15.0 , 10.0 );Is this even the right code I am looking for, or is it written collectly? I had to take it out of GPGT (page 207) and it was kind of hard to tell where some spaces go, so I tried the best I could. Also, if this is the right code, would I add this under "camera.cs"? If this is not what I am looking for, does anyone know a resource on how I can accomplish what I want to achieve? I have looked at the RTS Starter Kit, but I am not sure I want to get for just this one feature.
Torque Owner Jacob Williams
1)Using the console is primarily for debugging your script. You can do almost anything in the console that you can do in TorqueScript, but the console does not save any of your script to file. Because of this, the proper way to use the console would be to test functions and once satisfied with results, hardcode the function in a appropriate script file.
2)To edit terrain, shape location, etc, your best bet is to use the built in World Editor. You can access it by starting a mission and once loaded, press the "f11" key. You can also edit the GUI (Graphical User Interface) by using the "f10" key.
3)AI is an acronym for "Artificial Intelligence," and in Torque, refers to the "bots" (computer controlled enemies). How to edit AI behavior from script is beyond the scope of this post, but you can find many resources here on the site by using the search.
4)To create an RTS style camera, your best bet would be to implement the Advanced Camera Resource. However, the resource requires a TGE license, and a bit of C++ knowledge. The code you mentioned above should go in server/scripts/game.cs towards the end of the GameConnection::createPlayer function, although the TGE built in Orbit Camera has a bit of performance issues.
I know this is alot to tackle, but the best advice I can give is just to play with the engine, break it, fix it, and take lots of notes. Hope this helps!