How well do you understand TGE?
by D B · in General Discussion · 08/28/2005 (1:31 pm) · 21 replies
I've been using TGE for a couple of months now, and I am curious as to how everyone manages to use it (has a hard time, can do almost anything, etc.).
I have a lot of experience with coding, but TGE seems to cause me a lot of problems. Every time I try to add something new, I am unsure of where to look. I search through many of the files, look at the forums, look through the documentation, search through other sites, but I can't get anywhere most of the time. Every time I think I'm onto something, I usually come across an empty function where I believe the answer would lie. I keep hitting dead ends here.
Many of the files seem to be the same within client, data and server. I'm never sure what it is I should be editting out of those three. Also, I'm not sure what exactly I should be staying away from (not editting) when I try to make something new, and it usually leads to many problems.
My question is, what were some of your earliest problems with TGE, as well as what you did well with early on. I'm looking for some feedback, because I seem to be getting nowhere with the programming portion of my game.
I have a lot of experience with coding, but TGE seems to cause me a lot of problems. Every time I try to add something new, I am unsure of where to look. I search through many of the files, look at the forums, look through the documentation, search through other sites, but I can't get anywhere most of the time. Every time I think I'm onto something, I usually come across an empty function where I believe the answer would lie. I keep hitting dead ends here.
Many of the files seem to be the same within client, data and server. I'm never sure what it is I should be editting out of those three. Also, I'm not sure what exactly I should be staying away from (not editting) when I try to make something new, and it usually leads to many problems.
My question is, what were some of your earliest problems with TGE, as well as what you did well with early on. I'm looking for some feedback, because I seem to be getting nowhere with the programming portion of my game.
About the author
#2
08/28/2005 (1:59 pm)
I just recently purchased the book, 3D Programming All-In-One from Ken Finney 2 days ago. I have not even typed in any code yet. Tomorrow, I'll start chapter 1.
#3
Although not directly related, the link below does show some methods used to determine where to put your new code, and how to figure out what is going on.
torque.smdlabs.com/media/freeTutorials/introTScript/page5.htm
B--
08/28/2005 (2:05 pm)
@Danny: Have you installed the 'Enhanced Debugger' and used Torsion, or TDEV to step through sections of script during runtime?Although not directly related, the link below does show some methods used to determine where to put your new code, and how to figure out what is going on.
torque.smdlabs.com/media/freeTutorials/introTScript/page5.htm
B--
#4
08/28/2005 (2:10 pm)
I am having the hardest time with Torque right now. I have had/ played around with it for about a year now, but haven't really been able to go anywhere with it. I'm starting to finally figure it out, but it's still really frustrating.
#5
08/28/2005 (2:22 pm)
They are working on some new education solutions.
#6
Also, I am making my game single-player, but I have noticed that the client/server folders have very different files there. How did you determine what to use and what not to?
@Brandon: I'll take a look at the link and keep the Enhanced Debugger and Torsion in mind; it's more about knowing where to go and where not to when I decide I want to implement something. I don't mean to criticize others, but most advice I've seen/heard was to play around with the engine to see what you can do; it really seemed to me that some things were missing or unexplained. I'm really unsure as to how deep I go for creating certain functions (i.e. the engine folder or the starter.fps folder).
Are most of the modifications for the content done in the starter.fps folder (or whatever the game's name is for it), and most modifications for the technical parts (physics, movement and such) done in the engine?
08/28/2005 (3:14 pm)
@Jacob: I'll give tracing it a try; the biggest problem I have is not knowing where to go when I want to add a new function, as when I think I do, I hit dead ends. For me, it's probably more not being aware of what I can or can't do, as well as where to go for it all.Also, I am making my game single-player, but I have noticed that the client/server folders have very different files there. How did you determine what to use and what not to?
@Brandon: I'll take a look at the link and keep the Enhanced Debugger and Torsion in mind; it's more about knowing where to go and where not to when I decide I want to implement something. I don't mean to criticize others, but most advice I've seen/heard was to play around with the engine to see what you can do; it really seemed to me that some things were missing or unexplained. I'm really unsure as to how deep I go for creating certain functions (i.e. the engine folder or the starter.fps folder).
Are most of the modifications for the content done in the starter.fps folder (or whatever the game's name is for it), and most modifications for the technical parts (physics, movement and such) done in the engine?
#7
Honestly, as far as scripting goes, you can create the file structure and code any way you like. Don't think of the 'starter.fps' as the only way to do things, but more a technology preview that shows you one way the engine can be used. Look over the code, and use it to help you figure out how to do certain things. You can either build around the existing example frameworks (ie:starter.fps or racing), or use it as a guide, and start your project from the 'tutorial' project, or even a more stripped down version of it.
B--
08/28/2005 (3:38 pm)
@Danny: You will like the 'Intro to scripting' video series, it is targeted at getting you up and running inside the Torque engine. It assumes you are starting at ground zero, and walks you slowly through a method of discovery that will be very useful to you in your development goals.Honestly, as far as scripting goes, you can create the file structure and code any way you like. Don't think of the 'starter.fps' as the only way to do things, but more a technology preview that shows you one way the engine can be used. Look over the code, and use it to help you figure out how to do certain things. You can either build around the existing example frameworks (ie:starter.fps or racing), or use it as a guide, and start your project from the 'tutorial' project, or even a more stripped down version of it.
B--
#8
As far as adding script functions goes, if it's a new functionality you can always create a new .cs file and put it in there. I have created many new .cs files that way. It may be different for you, but the thing that has been a big help to me was to organize the script files and the dir structure as it made the most sense to me. As I mentioned, I merged many files, especially after all the multiplayer functionality was out of the way.
To figure out what I needed and what I didn't as far as the networking goes, I printed out the console.log after running with the trace option. I went through every call made and determined whether it had to do with multiplayer/network or not. If I wasn't sure, I tried commenting it out to see if something that was needed got affected.
I also remember going through the SimpleTorqueDemo and MinApp tutorials, which can help one to see the minimum required to actually start up the app. Once I figured out the minimum required, I expanded on it with whatever functionality I needed. One of the first things was of course to actually load a mission file. Again, that was figured out by following the calls made during mission load in the stock demo.
08/28/2005 (3:40 pm)
@Danny, As far as adding script functions goes, if it's a new functionality you can always create a new .cs file and put it in there. I have created many new .cs files that way. It may be different for you, but the thing that has been a big help to me was to organize the script files and the dir structure as it made the most sense to me. As I mentioned, I merged many files, especially after all the multiplayer functionality was out of the way.
To figure out what I needed and what I didn't as far as the networking goes, I printed out the console.log after running with the trace option. I went through every call made and determined whether it had to do with multiplayer/network or not. If I wasn't sure, I tried commenting it out to see if something that was needed got affected.
I also remember going through the SimpleTorqueDemo and MinApp tutorials, which can help one to see the minimum required to actually start up the app. Once I figured out the minimum required, I expanded on it with whatever functionality I needed. One of the first things was of course to actually load a mission file. Again, that was figured out by following the calls made during mission load in the stock demo.
#9
08/28/2005 (4:14 pm)
Try to look at the documentation and use tutorials for the first part. find things you think you need for your game and search them and try to implement them. Make sure the tutorials are based on script and not c++ so you can learn. If you can try to change the tutorial a little so you can try to finUse the documentation a lot! Where I am... I've used torque for about 2 years so I'm pretty good at script not c++ but thats not my thing I know where to find most things. I'm not good at online stuff however but I'm very good at stuff like %this %obj %client and console commands. oh yeah and use the console to find problems. console is "~"
#10
Also I don't see how anyone can really understand the script without also understading at least he big picture of the C++ code as well...at least was true for me. It's a single game engine - part of which is C++ and part of which is script. To understand the whole of it is to understand both parts.
I find that the problem most people make is they set goals for the game they want to make and try to go right for those goals. I find it is more productive if you remove all that from the table and make understanding the engine your first and only goal. Break that down into smaller sub goals and go from there.
Good luck.
08/28/2005 (5:25 pm)
Also don't be so quick to dismiss the suggestion Brandon made. Stepping through code to see the execution flow really is a great way to get oriented. Just don't do it in one big massive go...do it like a detective to answer questions like: how does hitting a key make the player move forward?Also I don't see how anyone can really understand the script without also understading at least he big picture of the C++ code as well...at least was true for me. It's a single game engine - part of which is C++ and part of which is script. To understand the whole of it is to understand both parts.
I find that the problem most people make is they set goals for the game they want to make and try to go right for those goals. I find it is more productive if you remove all that from the table and make understanding the engine your first and only goal. Break that down into smaller sub goals and go from there.
Good luck.
#11
Ken Finney's book helped a lot, and I feel that Brandon's approach to be very beneficial coming from someone who knows C++ coding. Reading my profile will indicate that I've been away from constructing code for some time...and feel ready to delve into the deep end once again. The network connection and server/client scripting throws me into a spin, I wish there was a document that really describes the approaches between the two.
At first I blindly inserted bits of scripting to see what happened and what someone else had developed, now after Ken's book[and subsequent volII] and visiting Brandon's superb site devoted to the topic, I feel a lot more confident about proceeding. I actually managed to utilize Mark Holcomb's AI resource to become my basic bot behavior without resorting to doing anything C++, and it works very fine. Can't wait for the arrival of Ken's second book....;).
I started with the basics(Art) and am now working thru the next logical progression of scripting and gameplay...hope all goes well. I do think that what GG and Torque are doing is very worthwhile and accessable to most anyone; even this 40+ old tymer. Good luck and keep pluggin'.
Rex
08/28/2005 (5:36 pm)
It took me a year of learning the Art pipeline before I even began to delve into scripting...and after a year of that; I purchased the SDK Indy license.Ken Finney's book helped a lot, and I feel that Brandon's approach to be very beneficial coming from someone who knows C++ coding. Reading my profile will indicate that I've been away from constructing code for some time...and feel ready to delve into the deep end once again. The network connection and server/client scripting throws me into a spin, I wish there was a document that really describes the approaches between the two.
At first I blindly inserted bits of scripting to see what happened and what someone else had developed, now after Ken's book[and subsequent volII] and visiting Brandon's superb site devoted to the topic, I feel a lot more confident about proceeding. I actually managed to utilize Mark Holcomb's AI resource to become my basic bot behavior without resorting to doing anything C++, and it works very fine. Can't wait for the arrival of Ken's second book....;).
I started with the basics(Art) and am now working thru the next logical progression of scripting and gameplay...hope all goes well. I do think that what GG and Torque are doing is very worthwhile and accessable to most anyone; even this 40+ old tymer. Good luck and keep pluggin'.
Rex
#12
I agree with Paul in developing your game, understand your engine first before you start developing. Then start setting your goals accordingly.
If your having problems understanding the engine (or anything Torque related for that matter), don't worry, TDN is on it's way to save you ;).
- Eric
08/28/2005 (5:38 pm)
I must say I've learned a great deal about Torque and its inner workings these past few months. It wasn't easy - I learned a lot on my own, and lot from what I could scrounge around here on the GG website.I agree with Paul in developing your game, understand your engine first before you start developing. Then start setting your goals accordingly.
If your having problems understanding the engine (or anything Torque related for that matter), don't worry, TDN is on it's way to save you ;).
- Eric
#13
@Jacob: I have actually made a few new .cs files, but in terms of directory structures, I've been having some problems. I tried renaming the starter.fps folder, and after I redirected everything (or, at least, I believe it was everything), all the textures and sequences would not appear ingame. Also, when I added a new folder, TBE (the programming environment I use) would freeze whenever I tried opening the folder.
That folder that would keep freezing everything consisted of my own directory set-up, but I had to get rid of it and stick with the starter.fps instead due to the problem, and since I haven't got much assistance for it, I haven't been able to focus a whole lot upon directory structures and tried to at least get something working for starter.fps.
@Treb: I have been searching through the documentation and tutorials, but it hasn't really been giving me anything too helpful. It's not so much the language/scripting itself as it is finding out what does what for the engine, what i should/shouldn't edit and how I should set up my files. However, as I said to Jacob just now, I've been running into directory problems, among other problems with it.
@Paul: I don't plan on dismissing any of Brandon's suggestions; I do plan to both read through the Intro to Scripting and trace the code; though your saying of "how does hitting a key make the player move forward?" helped me put tracing into perspective and re-realise its fuller potential.
I do have a plan going and have every aspect divided into small goals for each part, so I know what I am aiming for; it's more pulling it off and dealing with, to me, unexpected problems whenever I try to implement the tiniest thing.
08/28/2005 (5:43 pm)
@Brandon: I know that starter.fps is not the only way to go; it's just what I was using as a base, so I used that as my example, as it generally has a fair bit of what I'm looking for for starting off.@Jacob: I have actually made a few new .cs files, but in terms of directory structures, I've been having some problems. I tried renaming the starter.fps folder, and after I redirected everything (or, at least, I believe it was everything), all the textures and sequences would not appear ingame. Also, when I added a new folder, TBE (the programming environment I use) would freeze whenever I tried opening the folder.
That folder that would keep freezing everything consisted of my own directory set-up, but I had to get rid of it and stick with the starter.fps instead due to the problem, and since I haven't got much assistance for it, I haven't been able to focus a whole lot upon directory structures and tried to at least get something working for starter.fps.
@Treb: I have been searching through the documentation and tutorials, but it hasn't really been giving me anything too helpful. It's not so much the language/scripting itself as it is finding out what does what for the engine, what i should/shouldn't edit and how I should set up my files. However, as I said to Jacob just now, I've been running into directory problems, among other problems with it.
@Paul: I don't plan on dismissing any of Brandon's suggestions; I do plan to both read through the Intro to Scripting and trace the code; though your saying of "how does hitting a key make the player move forward?" helped me put tracing into perspective and re-realise its fuller potential.
I do have a plan going and have every aspect divided into small goals for each part, so I know what I am aiming for; it's more pulling it off and dealing with, to me, unexpected problems whenever I try to implement the tiniest thing.
#14
@Eric: I do realise the importance of understanding the engine; I'll be utilising some of these tips a little later to get some more understanding of the engine.
Also, what exactly is TDN? I've heard of it, but I don't think I know the details behind it.
08/28/2005 (5:48 pm)
@Rex: I have heard many good things about Ken Finney's book. Also, I'm sure I can work out TGE after a while; I'm actually starting to get the hang of gameSpace's quirks (though I have had experience with 3DS Max/gmax long before it), and I can actually work with it and exporting with few errors now. If I can handle gameSpace, I'm sure I'll get TGE down eventually. ;P@Eric: I do realise the importance of understanding the engine; I'll be utilising some of these tips a little later to get some more understanding of the engine.
Also, what exactly is TDN? I've heard of it, but I don't think I know the details behind it.
#15
08/28/2005 (6:35 pm)
Danny, I know what you mean about changing the names of directories...if you do that, you should also search all of the scripts to see what calls rely on that particular dir name and change it there as well. There are even some hard coded directories in the engine code that may need to be changed like the locations of the bitmaps that appear in the world editor (the different cursors) for example.
#16
first of all download this resource. this is quite possibly the most useful torque resource ive downloaded.
second, like others have suggested, trace the source. however, youll find that tracing the source with the previously mentioned resource makes it MUCH easier. but dont just trace the scripts, comment them extensively as you trace them. for instance,
when i trace this function, i look at the first function call: createserver. i figure out whether this is an engine function or a script function. its not an engine function so it must be a script function. i run a search through the script resource i mentioned earlier and find out where this function is declared. i open this file and confirm that its declared there and make a note of it in the script file. make alot of notes of everything you notice while tracing. dont expect to remember anything later on. believe me taking note of where a function is declared will save you a boatload of time later on.
lastly, create a copy of the script directory for modifying and running tests. IMO, if you plan to make a game you should have 3 copies of the engine. the first is the original, unaltered version you downloaded. personally, this is the version i chose to trace through and comment extensively. the second version is a test directory for testing scripts and functionality. the last version is the alpha build of your game.
"the biggest problem I have is not knowing where to go when I want to add a new function, as when I think I do, I hit dead ends."
danny understand that you can add functionality whenever and wherever you want. if you wanted, you could load all functionality when the game is first initialized. you could even load functionality while the game is running. open the console and type
exec("file")
youll feel more comfortable about when and how to add scripts once youve traced them.
08/28/2005 (7:15 pm)
Danny i also have been learning the scripts for the last few months. its not easy but you can make things easier for yourself by taking a few preliminary steps before you really start developing. here are some things i did that made learning the scripts easier:first of all download this resource. this is quite possibly the most useful torque resource ive downloaded.
second, like others have suggested, trace the source. however, youll find that tracing the source with the previously mentioned resource makes it MUCH easier. but dont just trace the scripts, comment them extensively as you trace them. for instance,
function StartMissionGui::startServer(%this)
{
createServer(%serverType, %mission);
//defined in common/server/server.cs
%conn = new GameConnection(ServerConnection);
//new game connection
RootGroup.add(ServerConnection); //add to rootgroup
%conn.setConnectArgs($pref::Player::Name);
%conn.setJoinPassword($Client::Password);
%conn.connectLocal();//connect game connection to local server
}when i trace this function, i look at the first function call: createserver. i figure out whether this is an engine function or a script function. its not an engine function so it must be a script function. i run a search through the script resource i mentioned earlier and find out where this function is declared. i open this file and confirm that its declared there and make a note of it in the script file. make alot of notes of everything you notice while tracing. dont expect to remember anything later on. believe me taking note of where a function is declared will save you a boatload of time later on.
lastly, create a copy of the script directory for modifying and running tests. IMO, if you plan to make a game you should have 3 copies of the engine. the first is the original, unaltered version you downloaded. personally, this is the version i chose to trace through and comment extensively. the second version is a test directory for testing scripts and functionality. the last version is the alpha build of your game.
"the biggest problem I have is not knowing where to go when I want to add a new function, as when I think I do, I hit dead ends."
danny understand that you can add functionality whenever and wherever you want. if you wanted, you could load all functionality when the game is first initialized. you could even load functionality while the game is running. open the console and type
exec("file")
youll feel more comfortable about when and how to add scripts once youve traced them.
#17
08/28/2005 (10:19 pm)
You have to spend *a lot* of time first getting to know the system and even then you run into little issues. These forums usually serve as the only way to get answer though ...
#18
After using it for 1 year, I have a pretty good understanding of where things happen and what needs to be done.
I can do pretty much what I want in script now but C++ is still corny. Especially when you bring in physics into the equation :p
08/28/2005 (11:44 pm)
Being that I don't have a programmer background, TGE proved to be very difficult when I first looked at it. (of course).After using it for 1 year, I have a pretty good understanding of where things happen and what needs to be done.
I can do pretty much what I want in script now but C++ is still corny. Especially when you bring in physics into the equation :p
#19
All of the ideas listed above are very good ones, and should be taken seriously. I personally spent 8 months digging into various subsystems of TGE before I honestly got a lick of "worthy" functionality that was important to my project put in place, and what I basically did was to pick a particular subsytem or functionality for the current week, and then spend a couple of hours of each day in that week studying it through. I would first search for resources that may affect that particular functionality I wanted to study, since many of the resources also include how the base system works, and then use those and forums posts as my start for researching through the code itself to learn what was affected in both code and script to do whatever the current topic was.
At times it really seemed like I wasn't getting to far, because there was always something new I didn't understand, but it actually worked out extremely well...after 8 months I kicked out a pretty major mod to the RTS-SK within 2 weeks of it coming out (along with a lot of contributions from others in the community), and that led pretty much directly to be being brought on board GarageGames as a full time employee!
To answer a couple of other questions brought up:
"TDN" is the Torque Developers Network, a wiki based documentation site that we have been working on to handle many of the frustrations people are having here. It consists of both techincal references for code, script, and resources, as well as dozens and dozens of articles (and more every day) that give in depth discussions of various systems, subsystems, techniques and example implementations to help everyone learn torque as efficiently as possible.
In addition, we've put together the Torque Boot Camps to provide both new users as well as experienced ones insights and functional understanding of critical concepts required for effective Torque development. There is a Torque Boot Camp designed specifically for Indie developers immediately after IGC (see the recent news article on the Community page), and we are also working on rolling out additional ways of distributing these lessons to the community, so keep your chin up and keep on working through the code...it will pay off for you in the end!
08/28/2005 (11:59 pm)
First of all, good post! Torque can be a complex beast, because it does so many things for you.All of the ideas listed above are very good ones, and should be taken seriously. I personally spent 8 months digging into various subsystems of TGE before I honestly got a lick of "worthy" functionality that was important to my project put in place, and what I basically did was to pick a particular subsytem or functionality for the current week, and then spend a couple of hours of each day in that week studying it through. I would first search for resources that may affect that particular functionality I wanted to study, since many of the resources also include how the base system works, and then use those and forums posts as my start for researching through the code itself to learn what was affected in both code and script to do whatever the current topic was.
At times it really seemed like I wasn't getting to far, because there was always something new I didn't understand, but it actually worked out extremely well...after 8 months I kicked out a pretty major mod to the RTS-SK within 2 weeks of it coming out (along with a lot of contributions from others in the community), and that led pretty much directly to be being brought on board GarageGames as a full time employee!
To answer a couple of other questions brought up:
"TDN" is the Torque Developers Network, a wiki based documentation site that we have been working on to handle many of the frustrations people are having here. It consists of both techincal references for code, script, and resources, as well as dozens and dozens of articles (and more every day) that give in depth discussions of various systems, subsystems, techniques and example implementations to help everyone learn torque as efficiently as possible.
In addition, we've put together the Torque Boot Camps to provide both new users as well as experienced ones insights and functional understanding of critical concepts required for effective Torque development. There is a Torque Boot Camp designed specifically for Indie developers immediately after IGC (see the recent news article on the Community page), and we are also working on rolling out additional ways of distributing these lessons to the community, so keep your chin up and keep on working through the code...it will pay off for you in the end!
#20
It's easy to be able to tell what's an engine function and what is not because of keyword highlighting and autocomplete.
If you import the starter.fps project, you can learn a lot from how it works. You can easily navigate to called functions by right-clicking on the function name and selecting "go to definition". You can also step through the code and find out a lot more.
Best thing to do is look at Brandon's videos. They're a great resource for anyone that wants to learn.
08/29/2005 (6:43 am)
The best learning tool to utilize would probably be TorqueDev.It's easy to be able to tell what's an engine function and what is not because of keyword highlighting and autocomplete.
If you import the starter.fps project, you can learn a lot from how it works. You can easily navigate to called functions by right-clicking on the function name and selecting "go to definition". You can also step through the code and find out a lot more.
Best thing to do is look at Brandon's videos. They're a great resource for anyone that wants to learn.
Torque 3D Owner Jacob