Game Development Community

No Torque Script?

by matt hilgers · in Torque Game Engine Advanced · 03/13/2012 (8:33 pm) · 8 replies

Hey All,

I realize garagegames has gone to great lengths to gives an easy to use scripting language to make our games. However as I work with it, and considering the idea I want to prototype, I continually find myself wondering if there is a C++ API that will allow me to talk directly to the networking, graphics, physics and audio engines?

Some the objects I want to add require quite a bit of AI interaction and I haven't been able to do all I want to try in TorqueScript.

THX!
-Matt

About the author

Played music since 1st grade and graduated with a B.A. in Music and a B.S in Computer Science. I currently work as a Computer Systems Administrator. I hope to graduate from someone else's start-up to my own start-up, keeping it as grass roots as possible.


#1
03/14/2012 (9:04 am)
Hopefully I'm not misunderstanding your question, but the answer is "yes". There is a C++ API because there would not be any TorqueScript equivalents. The only difference is that you have to instantiate objects differently in C++. Outside of that, all the functions (plus a few others) that are in TS are in the C++ codebase.
#2
03/14/2012 (6:24 pm)
Ah very cool!

Is there a section of the Documentation and/or Tutorials that introduce me to the C++ API as there is for the ToolBox and TorqueScript?

I have found a few things about TSShapeConstrutor and high level overviews of the codebase architecture. However I was hoping there were some sections that point users in the right direction for getting to know the C++ codebase directly.
#3
03/16/2012 (7:04 am)
@matt - So we do not have an actual doc that covers the C++ side like our TorqueScript manual. However, it is possible to connect the dots if you follow some TorqueScript examples. If you look at our FPS game, you can see examples of creating objects (Items, turrets, etc). You can see how a server is set up via GameConnection. I could keep going, but those are starting points. Try to port a game into C++, then you will have the knowledge to do what you are talking about.
#4
03/18/2012 (10:38 am)
@michael - Thx for the help! At this point, I am looking at code in the FPS Example DLL drop down of the FPS Example Solution file in Visual C++ 2008 Express.

However I am not really seeing where the item and turret object creation occurs. I did find GameConnection in the Solution Files using Find, and have come up with a great many places where the term is used. Long story short - head is spinning....

Can you give me more advice on how I can tackle getting to know this code base? If I modify the FPS Example, can you tell me where various types of modifications would appear in the Solution files? (adding a static mesh, changing the avatar, etc..)

Thx Again!
#5
03/18/2012 (12:28 pm)
Look in Torque3d/source/t3d/examples/

That will give you a start.
Look in Torque3d/source/t3d/turret/ for the actual turret code. As for learning the codebase, I find it easier to just browse the source folder. That's where all the code is.
#6
03/18/2012 (3:06 pm)
@Mike R - I am unable to find either. I have Torque3D Pro 1.1 installed in C:\Torque
#7
03/18/2012 (5:49 pm)
1.1 doesn't have the turret code, that's a feature of 1.2

Most object creation actually occurs in script which refers back to the C++ source of the various classes for details. Objects can be instantiated through C++ but I don't believe there is any documentation or guides that explain how to do so. The actual game code itself (rules, conditions, goals, scoring, etc), setting/changing of the player's avatar, weapons and item description and handling, etc, is also handled in script (mostly datablocks with some script logic). Most of the modifications you mention is something that by default is all delegated to script. Converting script to C++ can be done, but you'll have to recompile for every small change you make thereafter.
#8
03/18/2012 (8:48 pm)
@Michael Hall - I looks like Michael Perrys suggestion is making more and more sense. If I take an Example Game and look at the C++ generated by TorqueScript, I'll be able to see where and how the generated code calls the base engine code.

I'd like to get to the point where I can code up C++ exclusively, calling Torque engine code - Looks like I am in for quite a bit or work.

@All - Thx for your help guys. Any other assistance is greatly appreciated as well.