Super Simple Torque Demo
by Danner Jones · 02/03/2004 (10:28 am) · 13 comments
Download Code File
First, a huge thanks go out to James Yong for creating the SimpleTorqueDemo resource, which this is loosely based on. I've attempted to boil down that "simple" demo into something even more simple, something with even less "clutter" of packages and script files something that leaves virtually no ambiguity about what is being done, when, and why. Hopefully this sample will help with that. I like to call it the "Super Simple Torque Demo".
I've also included an intro to some key Torque objects and concepts, mostly those related to scripts but useful to anyone starting out with Torque.
Combined, the sample app and discussion of Torque objects provide a thorough introduction to Torque scripting using the very minimum of script code.
I would strongly recommend reading Joel Baxter's Scripting Language Reference, both before AND after going through this demo app.
02/06/2004 edit: After this tutorial, why not try out the new Super Simple Torque Demo with Console?
02/05/2004 edit: Updated both demos to call "setNetPort(0);". Removed the demo package from TinyDemo as the setNetPort(0) fixed the need for that.
02/04/2004 edit: Updated zip to include one new folder, TinyDemo. This demo consolidates all the scripts into ONE file - the ultimate in a tiny demo. The code and comments are mostly the same so you can still follow along with the document included in the SuperSimpleTorqueDemo folder.
02/03/2004 edit: Updated doc to remove bad info about "Parent::" and namespaces. Small typos and added link to Joel Baxter's excellent resource
First, a huge thanks go out to James Yong for creating the SimpleTorqueDemo resource, which this is loosely based on. I've attempted to boil down that "simple" demo into something even more simple, something with even less "clutter" of packages and script files something that leaves virtually no ambiguity about what is being done, when, and why. Hopefully this sample will help with that. I like to call it the "Super Simple Torque Demo".
I've also included an intro to some key Torque objects and concepts, mostly those related to scripts but useful to anyone starting out with Torque.
Combined, the sample app and discussion of Torque objects provide a thorough introduction to Torque scripting using the very minimum of script code.
I would strongly recommend reading Joel Baxter's Scripting Language Reference, both before AND after going through this demo app.
02/06/2004 edit: After this tutorial, why not try out the new Super Simple Torque Demo with Console?
02/05/2004 edit: Updated both demos to call "setNetPort(0);". Removed the demo package from TinyDemo as the setNetPort(0) fixed the need for that.
02/04/2004 edit: Updated zip to include one new folder, TinyDemo. This demo consolidates all the scripts into ONE file - the ultimate in a tiny demo. The code and comments are mostly the same so you can still follow along with the document included in the SuperSimpleTorqueDemo folder.
02/03/2004 edit: Updated doc to remove bad info about "Parent::" and namespaces. Small typos and added link to Joel Baxter's excellent resource
About the author
#2
Also, ignore my comments about "Parent::" - I'm a bit off with my term "package" and namespace. I hope to have that corrected in a new version of the doc very soon.
02/03/2004 (12:04 pm)
I should have mentioned this in the doc, but please read the Scripting Language Reference before (and after) going through this sample app.Also, ignore my comments about "Parent::" - I'm a bit off with my term "package" and namespace. I hope to have that corrected in a new version of the doc very soon.
#3
02/04/2004 (4:16 am)
This is the best beginner resource I have read yet. You have a great writing style and I actually look forward to reading through your doc and scripts again. You cleared up a lot of confusion for me. Thank you for this resource.
#4
02/07/2004 (11:53 pm)
just downloaded it and it seems to help a lot. Thanks Dan, we noobs need exactly what you've done!
#5
02/10/2004 (11:05 pm)
I like the TinyDemo very much. Thank you.
#6
This is what I've been looking for ever since acquiring Torque. Most "tutorials" take the whole-kitchen-sink approach, throwing everything at you at once. This tutorial, on the other hand, defines the bare-bones minimum required to simply get your Torque game/application to display a game window.
My only comment on the code is that it isn't necessary to use global $temp variables to create new GUI elements. I removed all of these and everything still works fine, even if the GUI elements are created inside functions. (You can still reference these inline elements from outside their creator functions.)
Thanks!
05/20/2004 (9:45 am)
Thanks for the tutorial.This is what I've been looking for ever since acquiring Torque. Most "tutorials" take the whole-kitchen-sink approach, throwing everything at you at once. This tutorial, on the other hand, defines the bare-bones minimum required to simply get your Torque game/application to display a game window.
My only comment on the code is that it isn't necessary to use global $temp variables to create new GUI elements. I removed all of these and everything still works fine, even if the GUI elements are created inside functions. (You can still reference these inline elements from outside their creator functions.)
Thanks!
#7
Fatal-ISV:engine\game\main.cc @ 88
cCreateCanvas: canvas has already been instantiated
06/20/2004 (4:35 am)
I get error message:-Fatal-ISV:engine\game\main.cc @ 88
cCreateCanvas: canvas has already been instantiated
#8
If you changed some scripts, you'd have to show me what your scripts look like now so that I might help.
06/20/2004 (7:35 pm)
Have you tweaked the scripts at all? I have a fresh copy of Torque as of 6-19-2004 and both the SuperSimple and Tiny demos work fine on a plain-Jane compile of Torque. If you changed some scripts, you'd have to show me what your scripts look like now so that I might help.
#9
Here is my version of your code cca 100kb , it's separated to client and server part.
http:\\torque.intelligentdevelopment.sk\files\startup_0.01.zip
and
here is code with common, but don't work.
http:\\torque.intelligentdevelopment.sk\files\startup_0.03.zip
07/14/2004 (11:20 pm)
Hi, very good resource. I now trying assign common part (editor) to your simple torque resource. No inside, I can make switcheable option -> i.e. -devmode or $use_common = true/false :) for assign common script to game for editing level/gui/ etc., but all without result :(. Can you help me?Here is my version of your code cca 100kb , it's separated to client and server part.
http:\\torque.intelligentdevelopment.sk\files\startup_0.01.zip
and
here is code with common, but don't work.
http:\\torque.intelligentdevelopment.sk\files\startup_0.03.zip
#10
The purpose of the super simple demo was only to introduce someone into scripting where it was very easy to see exactly what was going on (lots of extra descriptions to aid the torque-newbie).
Once you get past this sample app, I think the MinApp tutorials are your best bet.
07/15/2004 (12:15 pm)
If you're trying to add "common" support, you'd probably do better to start with the MinApp tutorials.The purpose of the super simple demo was only to introduce someone into scripting where it was very easy to see exactly what was going on (lots of extra descriptions to aid the torque-newbie).
Once you get past this sample app, I think the MinApp tutorials are your best bet.
#11
07/15/2004 (1:03 pm)
OK. I go try it :) Thanks.
#12
Now, instead of a Gui background and button, what would I need to have a simple (static) camera, and a plain static DTS model in the middle of the screen?
02/16/2006 (3:06 am)
this is a very good demo, I finally got something to work with!Now, instead of a Gui background and button, what would I need to have a simple (static) camera, and a plain static DTS model in the middle of the screen?
#13
good job.. finally something simple to start building on top.. instead of dissecting and modifying the starter kits..and getting a mess
for those who wonders.. this currently works with TGE 1.5.2 out of the box
TGEA will work.. if you rewrite the video related scripts ( they refer to opengl )..
Cheers!!
06/24/2007 (12:04 pm)
niiiceee!!..good job.. finally something simple to start building on top.. instead of dissecting and modifying the starter kits..and getting a mess
for those who wonders.. this currently works with TGE 1.5.2 out of the box
TGEA will work.. if you rewrite the video related scripts ( they refer to opengl )..
Cheers!!

Associate Canon