Game Development Community

How to get from beginner to intermediate TGE level?

by Sergei Eliseev · in Torque Game Engine · 05/28/2003 (11:17 am) · 20 replies

Hi,

Just simple question: how to start creating something using TGE? I've read lot of tutorials (most of them are intended to beginners), understood scripting principles but I do not understand: HOW IT WORKS TOGETHER? And how to get from beginner level to intermediate and then to advanced? Could you please share with your experience? And how much time did it take from you?

#1
05/28/2003 (11:24 am)
I'd quite like to know the answer to this one too.

I mean, people say "copy the FPS example and rename it", but surely there's 100's of references to "fps"...

Anyway, just thought I'd chip that in ^^

--Ed
#2
05/28/2003 (12:29 pm)
That's when you start learning to code and start looking at things on your own. Sure there are references to fps, do a search on where does references are and change them. Start reading all the scripts and seeing where it goes.
It's up to you and your personal effort, no one will, or can, do a "tutorial" to make you a professional game maker.
#3
05/28/2003 (12:31 pm)
really?
aww crap..
guess I better stop filling this Wordpad/Tutorial huh?

*grin*
#4
05/28/2003 (1:28 pm)
A good place to start would be looking around for other Torque projects that you could help out on, under the guidance of more experienced people.
#5
05/28/2003 (4:57 pm)
lots of these three things:

caffeine
sugar
time

with caffeine and sugar optional :)
#6
05/28/2003 (9:15 pm)
Here's my attempt at a good answer.

Torque is a pretty big engine. It's massive to a beginner, no doubt, but after some time you'll get the hang of it. Having a debugger is a must for learning, because one of the greatest learning tools I've found so far, is by setting a breakpoint in a function and following the function call list, back up to the windows main function. You get a good idea of how it loops.

More or less the game loops within the windows main, and it creates events. These events are network events, and time events. The game measures the time between the time events, and breaks it up into tics, which are 32 milliseconds. So, if 64 milliseconds pass between the two time events, we need to process 2 tics. The engine then runs down the updating of everything based upon these 2 tics that pass. It filters down through the list of objects that are within the game, be it ShapeBase, GameBase, Item, Vehicle, etc, and processes the 2 tics. The GUI is also updated in between these time events, as well as the handling of the network events.

Each class is in control of it's network updating. So, if we're inside the player class, and the health of the player changes on the server because it was shot by a missile, it's the player classes responsibilty (server side) to tell the network event that it needs to send some information across. If the player's health changes, it most likely sets the HealthBitMask defined within the player class. Then when it's time to process the net events, the engine notices that the HealthBitMask is set, so it grabs the Player's Health and sends it across the network to all the clients that need this player's information.
(For more information look in the functions: packUpdate, unpackUpdate, writePacket, readPacket)

The console is just an extension of the C++ source code. The console has to have a representation in the C++ code. The advantage of using the console(read, script files), is that you dont have to recompile the engine to make changes. The script will use functions, such as %player.getHealth(); The getHealth function has to have a representation in the C++ code, so you'll see something like:
Con::addCommand("Vehicle", "getVehicleHealth", cGetVehicleHealth, "obj.getVehicleHealth())", 2, 2);

Then you'll see the C++ representation cGetVehicleHealth

static const char* cGetVehicleHealth(SimObject *ptr, S32, const char **argv)
{
   Vehicle* obj = static_cast<Vehicle*>(ptr);
   return obj->getHealth();
}

Which actually accesses the C++ object sharply named "obj", and returns the health for that object, but of course there must be a function that actually returns the health, such as

Vehicle::getHealth()
{
  return mHealth;
}

Now, you know how the console and the C++ engine interact. There is also the ability within the console to operate independent of the C++ side of things. You are able, within the console, to create and destroy variables that the C++ does not know about. Every object type in the engine is a string, so both of the following are identical.

%thisVar = "1";
%thisVar2 = 1;

If you pass in an additional variable from script to C++, you'll notice that it has to convert this from a string to either an int, bool, or float. For example, if you do this:

%player.setHealth(100, true);

When you examine the C++ function which most likely is named cSetHealth, you'll see something like:
static const char* cSetHealth(SimObject *ptr, S32, const char **argv)
{
   Player* obj = static_cast<Player*>(ptr);
   S32 amount = dAtoi(argv[2]);
   bool setNow = dAtob(argv[3]);

   obj->setHealth(amount, setNow);
}

In the above function we turned the strings into something that the C++ engine would understand.

I hope this little explination is what you were looking for. The best thing to do is find something you dont understand, insert a breakpoint, and debug it. This way you see _exactly_ what is going on in the engine, and you can trace the calls to and from it.
#7
05/29/2003 (2:54 am)
Jared, thanks for taking the time to write that.

And Xavier, a condescending attitude doesn't help anyone.

--Ed
#8
05/29/2003 (12:34 pm)
Neither does being spoonfed. Just be realistic, if you don't put your own effort no one will put it for you.
#9
05/29/2003 (12:48 pm)
@Jared: Thanks, there was some good info there. I didn't know everything was converted to strings. :)

@Xavier: No one asked to be fed. And the reality is that the fastest way to learn is by example and explanation, that's why there are schools. Blindly stumbling along through code is *not* the best way to learn.

-Jeff
#10
05/29/2003 (4:50 pm)
Dang, again my post was deleted. I'll make the short version.

If you are blindingly stambling against code, then I suggest, get a C++ book first and learn to code, game making isn't for kids, for those you get lego or other kind of toys.
With that set, my personal experience tells me that reading code yourself and finding how things are done and set up and knowing what you are looking at makes your designs or prototypes of ideas much better, robust and well founded. If you keep asking how I do this and that you will always be depending on the knowledge of the whoever answers your question. Now I wouldn't mind helping when there's obvious need of help, for example in the networking of objects, or other stuff, and if you hang on IRC you will notice I always help people that has trouble with advanced stuff. If not just ask Josh :) well... he'll understand if he reads this post :P
What I mean is that I don't mind helping someone that has been working his ass off to get the job done, but just needs some help on some complex stuff that not everyone is prepared to take. I've been in that situation before too. But I get really pissed off when the forums start getting full of basic questions that don't need an answer but just a look at what you just bought... an SDK.
Most of the TGE code is already commented by the usage of the code itself, you just need to read existing code and most of the questions are answered. Quoting the same question as before... it's not hard to do a stupid search in files for "fps" or just a "grep fps ./ -R"
And I'm not starting a flame war here, so don't start getting agressive and end like most of the threads around here.

Regards,
Xavier
#11
05/29/2003 (5:16 pm)
Quote:
Jarrod Said :

lots of these three things:

caffeine
sugar
time

with caffeine and sugar optional :)



and repeat...always repeat :)
#12
05/29/2003 (6:06 pm)
i think it's "lather, rinse, repeat". pretty sure.
#13
05/29/2003 (8:19 pm)
yeah..from the simpson's episode..about homer's middle name... good catch :)
#14
05/29/2003 (8:51 pm)
@Xavier:
I do see your point. But I think your problem is that you are so wound up in your frustrations that you mistake those who are legitimately *needing* help or just wanting a learning boost, with those "give me code and hold my hand" kind of people.

I have seen you help, so I am not questioning that... heck you have helped me when I needed it. But you need to separate your frustration and view the community members here as individuals, and try not to be so harsh on them.

Personally the best method of learning for me is to:
1) Pick a feature I want in my game.
2) Dissect that feature into pseudo code.
3) Scour the code, GG's forums (yuck!), the resources, the links here and the internet for tutorials that will help me bring my pseudo code into something tangible. I find that starting with the manual results in confusion since they mostly read like you already know what they are talking about.
4) Use the manual to look up code in the tutorials you don't understand (since I want to learn after all :) )
5) Ask on the forums if all else fails.
6) Rinse repeat.

I have to admit that #5 is the most painful. I view coding as a big puzzle game, I feel like I am cheating when I ask for the code directly, so I usually just ask for the rules.

@Badguy: Keep that tutorial rolling! :)

@Sergei and Ed: Have you tried looking on the internet for Tribes2 coding sites? There are a lot of dead ones, but they still have some great examples of coding structure for various tasks in this engine.


-Jeff
#15
05/29/2003 (10:21 pm)
Jeff, The real point is that I've been so long helping people, one year here at GG with torque and like 5 years on linux before this, that I already know what kind of person is the one that's asking. We get newbs/trolls on the GG irc channel a lot, I recognize them almost instantly and then everyone see's i was right when they start getting annoying or start swearing or insultin you while you help. So yes, I'm harsh because I've seen many people do what I just described, so I only try to help people that I see they show some interest and respect, and that in general formulate sane questions and not something like "im a n00b and i need to work my @$$ off taht, i need to learn c++ or visual basic... maybe even java script, not sure what you recommend to make games? And where can i read about making a bump mapping effect and normal maps ?"
... If you know what I mean.

And I'm sorry, I always have terrible formatting on my forum posts :) Just look at em... damn they are ugly :P

Regards,
Xavier
#16
05/30/2003 (12:23 pm)
I think your problem, Xavier, is that you're too quick to pidgeonhole people into these pre-determined categories of yours. My intentions were certainly not as you describe, I certainly would not consider myself a "newb/troll" - I just was asking for a slightly less throwaway-answer than I had previously seen.

I'm not going to get into how I've been programming for x years, or that I have experience with "y", because it's just pure willy-waving. If you consider yourself too high-and-mighty to answer less advanced topics, then there's a very simple lesson that my mother taught me - if you haven't got anything nice to say, don't say anything at all.

--Ed
#17
05/30/2003 (5:42 pm)
Ed,

Dont know if it's much use anymore, but just thought I'd throw my 2 cents in.

I got Torque a week or so ago. I've been playing around with it in my spair time (of which I have quite a lot during the day, since I work evenings). I'm now at a stage where I'm comfortable modifying the engine code. I'm slightly less comfortable with the scripts, but I'm getting there. Will waving aside (i love that term), I am a pretty experienced C/C++ programmer, which has helped a *lot* to the speed of which I picked Torque up. The other thing that helped was time and messing around under the debugger (tip: remote debugging helps a lot, since it's easier to relate what's on screen and what the debugger is telling you). I'm just concentrating on the bits I need to know for our project as dictated by our design doc. Having a direction helps, even if that direction changes drastically once you have a better understanding.

As for TGE level? I suppose I consider my self roughly intermediate. It's really quite hard to say, since the engine is so huge and I've barely scratched the surface.
#18
05/30/2003 (8:52 pm)
Ed: your problem is that you are thinking im condenscending (now i know what the word means :P) you, and that's not right. But if everyone looked at things for themselves before asking there would be less threads overwelming the forums and less bandwith waste. And of course would save many people lots of time than could be put into making more games :)
That's all, and just ask anyone doing games how they learnt torque, by looking for themselves.. ask bravetree, ask 21-6, ask doyoon kim... they've released games already.
#19
05/31/2003 (8:21 pm)
Sergei,

OK
1. Learn how to download and compile the engine
2. Run the program using the FPS demo and learn how to use the actual editor (F10, F11).
3. Play around with the scripts , don't try making new scripts at this point just play around with the existing one
4. Attempt to make some new scripts (which involves learn the scripting language)
5. Create your own mini (SUPER SIMPLE) game, probably only one mission, Remember SUPER simple.
6. When your confident you can now either start your full game or begin modifying engine code.

How long it will take I don't really know, I was writting up my tutorials as I was learning myself so it took 5X longer than it should have.

Hope that helps
#20
06/09/2003 (1:21 pm)
hi guys,
just wanted to throw my 2cents (more or less) in. I must agree with Sergei and Ed - I am one class away from a Bachelors in Computer Science, and would consider myself an intermediate level programmer, and I've had Torque for a couple of months now, playing around here and there when I can. But most of the "tutorials" out there are of the kind given by Devon - although I sort of understand the editors, and have somewhat of a grasp of the scripting language, I don't know how to bring it all together to make the simple game - and what I do know comes from many long hours of struggle. When a tutorial involves someone else directing us "noobs" to play around with scripts, or learn to use the actual editor, it doesn't really tell us the why or the how.

I'm not trying to flame anyone, and this community has been nothing but great, and I realize there is a lot to learn for anyone, but a beginners tutorial of sorts that would describe what exactly all the different parts do and how they fit together would be excellent. I don't want you to hold my hand or write the code for me, but just point me in the right direction - tell my the why, and how it all fits together.

thank you for your time,
and sorry if I upset anyone,
joel