Game Development Community

Confused how much you are forced to use TorqueScript

by d000hg · in General Discussion · 10/27/2008 (2:32 pm) · 7 replies

I read this page: http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=8797

I can see it would make sense to use scripting for game logic, but that article seemed to suggest I'd have to port loads of functionality to C++ to make a game in C++? For an experienced C++ coder, isn't it possible to write a C++ layer on top of Torque?

Specifically, what about a non-game project, involving complex calculations and image manipulation? Apart from loading models and positioning cameras, the custom functionality would need to be in C++... is it not easy to do basic things in C++? Surely the TorqueScript layer actually translates to calling C++ functionality?

#1
10/27/2008 (3:32 pm)
Sure you could. Many examples are already implemented in reusable Torquescript. How to connect to a multiplayer server. How to show a loading screen. The sequence to initialize missions including client side foliage. ... Why rewrite and retest everything the basic scripts provide when Torquescript is very similar to C-ish syntax. (Just the notation between global and local variables looks odd when you are just starting out.)

The answer to these questions is always, "yes you could, but why?"
Thats' because it would take weeks less time to just spend a couple learning Torquescript than to rewrite everything already implemented in Torquescript.

It would take months to train a "designer/producer" type to use C++, when they could be productive in Torquescript in, what, a week or less? Much less "change this please, change that please" when they can just do it themselves. Saves a lot of programmer time in a multi-discipline project.

Last paragraph: Yes, exactly as you stated.
#2
10/27/2008 (3:49 pm)
@John - Let me address something you mentioned in your 3rd paragraph. Custom functionality, can be integrated at both levels. For instance, let's look at a timer.

You can use TorqueScript's schedule(...) function to handle a timer, or you could create a high resolution timer in C++. If you implement the C++ timer properly, you can use it in various parts of the engine. You can even expose it to TorqueScript.

You can develop a Torque game completely in C++. However, some Torque veterans can tell you that sometimes it's better to use Torque Script. Further more, you would be hard pressed to find a finished TGE or TGEA game that did not utilize modification of both C++ and TS.
#3
10/28/2008 (5:37 am)
Quote:is it not easy to do basic things in C++? Surely the TorqueScript layer actually translates to calling C++ functionality?

It's VERY easy to add custom c++ methods that you can invoke from script to perform heavy calculations that would not be suitable for doing in script. It's also pretty simple to add new c++ classes that can be created as objects from within torque script performing all the calculations engine side in c++ and expose results or other information to script.

It's possible to avoid torque script and do most things in the engine, but once you've used the scripting side for a while you'll probably see the advantages and realise that using a combination of script and engine code is the way to go.
#4
10/28/2008 (10:17 am)
You're not so much as forced to used Torque Script as in most cases it's easier to take advantage of it. It's an underlying means of directing and controlling your game without all of the underlying hassle of direct coding. You use it to make things easier for you or your programmers, your artists, or your world builders. Once your C++ code is properly exposed to Torque Script it's a great way of seeing your changes immediately without having to compile for a change in a single line of code. Use it (TS) for quickly prototyping and validating your game ideas. You can then port the code directly into C++ if you think it needs that optimization, but leave "hooks" so can you manipulate it.
#5
11/06/2008 (12:21 am)
Thanks for the replies guys. I can definitely appreciate that for a typical game project, scripting is a very sensible idea.
However I want to use torque for a standard application, which includes 3D views of models. I suppose it's sort of comparable to a model editor in the way it works.
Basically there is very little in the way of 'game logic' so I don't think scripting is very useful - especially since I am already a very experienced C++ programmer but don't know TS. This is a more traditional kind of app, no need for artists or other people to be involved with development.
My experience with other engines is I can create a new C++ project for all my custom functionality, and either this builds against the engine itself or produces a DLL which is loaded by the engine. If I wanted to create an application purely in C++, would it be similar with TGEA?
#6
11/08/2008 (5:43 am)
Is there any tutorial on how to start working on a Torque (TGEA) project from a C++ perspective?
#7
11/08/2008 (6:00 am)
www.garagegames.com/products/298/ is your best choice for learning the engine side of torque.