Problem understanding the torque engine
by someone · in Torque Game Engine · 08/24/2003 (3:27 am) · 2 replies
Im having some trouble understanding how the torque engine works exactly. i dont understand how the .h and .cc part that makes the .exe works with the .cs files. is it that some game files are in the .exe then the rest comes from the .cs files? if so why not put all the code in the .cc files?
About the author
Associate Melv May
I would suggest that you take a step back and do some background reading. This would help you understand all the concepts much better.
You should have a development environment that will compile the .CC/.H ( which is the C++ code for the engine itself ) into an executable. This executables' job is to initialise the engine and start loading/compiling the .CS ( games scripts ) which themselves define and initialise your game. The scripts only require a standard text editor and are therefore easy to change.
You can add your own C++ code (which gets folded into the executable) in areas where you need as much speed as possible but as a rule, you would normally use the scripts as they are easy to change and don't need a manual compile step.
Designing C++ engine objects and recompiling the engine can take considerable time and effort and so having scripts that are compiled each time you run your executable is preferable. The scripts are a subset of the C++ language and offer Torque-specific methods to speed-up your game development.
You will find that the main executable is hard-wired to load the "main.cs" in the executables' directory. It's this script file that executes all the other script files. The scripts are not permanently running, they simply tell the engine to do certain tasks like configure the server or initialise the player/camera or start the mission etc.
Hope this helps,
- Melv.