Game Development Community

Going from C++ to Torque Script?

by Ozi · in Torque 2D Beginner · 06/23/2013 (5:32 pm) · 6 replies

Well, I've gotten a pretty awesome understanding of C++. I've made a few programs lately and now I think I'm finally ready to make a simple 2D game, though, since it will be my first, I want to use an engine, and Torque seems like the best right now.

The only issue is I don't think Torque really uses C++. I'm willing to learn TorqueScript, I just want to know what the learning curve is if I already have C++ understanding down pact (most of it, I know classes, arrays, objects, functions, etc.)


#1
06/23/2013 (5:59 pm)
Torque is entirely C++ based, TorqueScript is simply a scripting language built over it! A T2D game's logic is usually built using TorqueScript, while the C++ engine is meant to handle the heavy lifting.

If you look at The official Torque2d repository, you'll find the C++ engine, ready to compile with your favorite compiler.

Any function accessible from TorqueScript is defined in a ConsoleFunction or ConsoleMethod, which you will find in files which end in _ScriptBinding.h.

For all script functions related to the SceneObject, for instance, you'd look in SceneObject_Scriptbinding.h.

Take a look at thewiki for a quick rundown of how TorqueScript works.

If you're strong in C++, you should have no problem leveraging the engine's scripting system.
#2
06/23/2013 (6:00 pm)
Of course Torque uses C++. It's written in C++.

Most of the things you want to do are done through scripts. TorqueScript is more like C than C++, really. You should do fine. If you look at the existing scripts and follow along you should be able to pick it up quickly.
#3
06/24/2013 (4:59 am)
Like Simon and Richard, I encourage you to take a look at TorqueScript. It's quite easy to pick up, especially if you are experienced in C++. The scripting language is C-like in nature, though not entirely. We have some extensive guides on TorqueScript that will help.

Still, you can write your game play in C++. You simply need to know where to inject your code.
#4
06/24/2013 (8:12 am)
So what would be more beneficial for me? Mostly C++, mosty TS, or a bit of both?

Also, where would I start to gain an understanding of TS and how to use C++ in Torque? Thanks for the replies guys. I honestly didn't know that ++ and Torque were so much alike.
#5
06/24/2013 (8:22 am)
Due to Torque 2D's architecture, I would say mix the two evenly. Use C++ to add new functionality, use TorqueScript to build your levels and game play.

As Simon pointed out, check out the Torque 2D Wiki. On that page, there are four very useful links: TorqueScript Overview, TorqueScript Syntax, Scripting Tutorial, and Behavior Tutorial.
#6
06/24/2013 (8:34 am)
@Michael
I'll check it out right now, really can't wait to get started, heard some great things about Torque 2D's engine.

@Simon
Thanks for the tip man! They really are similar, I can probably pick this up quickly. xD