Game Development Community

New to torque, Torque Script/C++ quick enquiry

by Junior b · in Torque Game Engine · 01/26/2009 (6:24 pm) · 4 replies

Hi, i recently purchased the TGE Indie license as theres a game i wish to start working on with some friends, its very basic/strategy.

I just wondered as i spent 15minutes on the tutorial and using torque script (was kool) and I had previously heard about scripting from university but i'm still a bit confused/unsure as would i be programming from a C++ perspective when i'm building a full game or just using the Torque Script?<< (or both?? and how?) if someone could explain how games can be built exaclty as i would have loved to just program in C++ and work with the engine directly somehow.

I.E do i program classes in C++ or in Torque Script?? or both??, i find it very confusing as its first time dealing with this and i just want someone to clear it up for me.... sorry if i sound like a big n00b but i must know so i can move on. :(

i can program c++/c/c# and REALLY was just assuming i'd just use this as i did with XNA, >>> program in C#, add the engine's libraries/functions, etc then just compile lol but i have no major issues with the script language as i feel il pick it up quickly after playing with the tutorial.

#1
01/26/2009 (8:26 pm)
You will most likely be using both script and C++.

With script alone you can do quite a bit, particularly regarding the overall flow, structure, and rules of your game. For example, the difference between game types such as a simple Deathmatch, Capture-the-flag, or single player campaign, will usually be determined entirely by scripts.

Within the game however, the things that you see and interact with are all C++ classes. They all have a script interface, so they can be manipulated and controlled to some extent with script functions, but the most important aspects of their behaviors are hard coded. If the classes that are shipped with the engine do not suit your needs, then you will need to modify or replace them in C++.

Realistically, you will almost certainly need to modify or create at least a few classes for anything that is not a first or third person shooter game. However, you will probably find that many of the changes you will need to make have been done before by other people. Have a good look through the Resources section on this site, and you will find many cool modifications to the stock engine.
#2
01/27/2009 (9:13 am)
Tony's right. To oversimplify it a bit, here's a generde mainly deals with the instant-by-instant behaviour of obejcts; scripts deal with the properties of objects and their high-level interactions (plus, like Tony said, your game structure).
If you look through script files, you'll see that they're mainly composed of datablocks (defining object properties) and callbacks (deciding what to do when a given action happens). The C++ determines what those properties affect, and when callbacks are fired.
#3
01/27/2009 (9:39 am)
Hmm thanx for the quick replies :D, if you know any good resource/code snippets or something to help let me know but i get the overall idea as i cant use the resouces keeps sayin "page not found" and similar result with TDN.

But i must SEE some sort of code or just snippets/example that illustrates this as all the examples/tutorials i'm using are 100% script lol so i can completely understand because at it stands i'll just be doing this with torque script as thats all i can find.

but THANX tho, really appreciated it, i may just play around and see if certain things work but would love to see an example.

P.S > y are the coded files for all the tutorials iv'e in .cs <<< any particular reason?
#4
01/27/2009 (12:19 pm)
Yeah, unfortunately the resources section is a bit broken right now. Give it time. In the meantime, just dig around in the source code and see how things work. If you want a suggestion on where to start, I would recommend the Projectile class. It is a relatively simple class, yet it demonstrates many of the principles you will need to know, and it is easy to experiment with.

By the way, on this forum, and most other forums related to programming that I've seen, people tend to get more helpful responses when they make an effort to use correct spelling and grammar. It makes it easier to understand your questions, for one, but it also says something about your attitude. When coding, your spelling and syntax need to be perfect, and there is really no excuse for not being just as careful when communicating with people.
Just an observation.