Learning the source code (not TorqueScript)
by Dallin Smith · in Torque Game Engine Advanced · 08/22/2007 (1:01 pm) · 8 replies
Hi,
I was wondering if anyone knew of any good resources to help someone learn the ins and outs of the Torque source code and how the engine is structured. I've read many sources on how to use TorqueScript and fell comfortable with the scripting language, but I'm looking into doing quite a bit of modding of the engine itself. I've looked at the books surrounding Torque and they focus on TorqueScript too. All I've found on the source code is the little bit of documentation GarageGames has here:
http://www.garagegames.com/docs/tge/general/pt04.php
It would sure be nice to have an overview somewhere of program flow and structure of the source code, but I've yet to find anything like that. You know, just something to help the newcomer get his feet wet in the code. Any suggestions?
Thanks.
I was wondering if anyone knew of any good resources to help someone learn the ins and outs of the Torque source code and how the engine is structured. I've read many sources on how to use TorqueScript and fell comfortable with the scripting language, but I'm looking into doing quite a bit of modding of the engine itself. I've looked at the books surrounding Torque and they focus on TorqueScript too. All I've found on the source code is the little bit of documentation GarageGames has here:
http://www.garagegames.com/docs/tge/general/pt04.php
It would sure be nice to have an overview somewhere of program flow and structure of the source code, but I've yet to find anything like that. You know, just something to help the newcomer get his feet wet in the code. Any suggestions?
Thanks.
About the author
#2
Profiler on TDN:
tdn.garagegames.com/wiki/Torque/Profiler
08/22/2007 (1:38 pm)
If you have a look at the output of the profiler. This may give you some idea of the basic flow of engine during the game loop.Profiler on TDN:
tdn.garagegames.com/wiki/Torque/Profiler
#3
Use dOxygen to navigate the "core object hierarchy", following the base classes:
ConsoleObject -- provides the ability to instantiate objects from TorqueScript, remotely instantiate objects on clients in an OS-agnostic manner, and provides the ability for C++ classes to interact with the TorqueScript console.
Related Systems: Con::
SimObject -- provides the ability for objects to participate in a simulation, including unique identification (ObjectID's), "smart referencing" (safe pointer management through event driven deletion events, basically), object registration, and other low level functionalities.
Related Systems: Sim::
NetObject -- provides the ability to "stream updates" of registered objects to clients. Implements ::packUpdate and ::unpackUpdate methods which provide optimized mechanisms for manipulating an OS-agnostic networked bitstream.
Related Systems: Object Ghosting through a subset of the NetInterface::, NetConnection::, GameConnection::, and DemoGame:: classes.
SceneObject -- provides scene participation, basic rendering, and positional locality.
Related Systems: Container (binning system), Render Manager, Materials System, Resource System.
Related topics: batch based rendering, collision sets and collision detection, proximity (raycast) testing, bounding boxes, world and local transforms, render transforms.
GameBase -- provides the ability to process objects over time, the ability to have datablocks (a network optimization mechanism, as well as an implementation that provides for end user "modding"), and the ability to act as a control object for a client.
Related Systems: Simulation ::process() loops, the Move struct, process based physics, process based collision detection and collision event management, (many additional).
Related topics: networked simulation synchronization, client/server architecture, networked interpolation, extrapolation, and client side prediction, move management, control object high fidelity network updates, many more.
Everything below Gamebase in the core hierarchy is reference implementation--in other words, game specific functionality that is by definition dependent on your game designs. For example, complex multi-threaded animation, procedurally controlled animation threads, more advanced (but still networkable) physics, game object states (enabled/destroyed/damaged, cloaked/visible, health/energy, etc.), and dozens of other gameplay specific concepts and implementations.
08/23/2007 (11:55 am)
As has been stated in many threads, this isn't a trivial task, but if you want to get a good feel for the fundamental "nature" of core Torque Technology, here is a very brief study guide (that may result in months of study!):Use dOxygen to navigate the "core object hierarchy", following the base classes:
ConsoleObject -- provides the ability to instantiate objects from TorqueScript, remotely instantiate objects on clients in an OS-agnostic manner, and provides the ability for C++ classes to interact with the TorqueScript console.
Related Systems: Con::
SimObject -- provides the ability for objects to participate in a simulation, including unique identification (ObjectID's), "smart referencing" (safe pointer management through event driven deletion events, basically), object registration, and other low level functionalities.
Related Systems: Sim::
NetObject -- provides the ability to "stream updates" of registered objects to clients. Implements ::packUpdate and ::unpackUpdate methods which provide optimized mechanisms for manipulating an OS-agnostic networked bitstream.
Related Systems: Object Ghosting through a subset of the NetInterface::, NetConnection::, GameConnection::, and DemoGame:: classes.
SceneObject -- provides scene participation, basic rendering, and positional locality.
Related Systems: Container (binning system), Render Manager, Materials System, Resource System.
Related topics: batch based rendering, collision sets and collision detection, proximity (raycast) testing, bounding boxes, world and local transforms, render transforms.
GameBase -- provides the ability to process objects over time, the ability to have datablocks (a network optimization mechanism, as well as an implementation that provides for end user "modding"), and the ability to act as a control object for a client.
Related Systems: Simulation ::process() loops, the Move struct, process based physics, process based collision detection and collision event management, (many additional).
Related topics: networked simulation synchronization, client/server architecture, networked interpolation, extrapolation, and client side prediction, move management, control object high fidelity network updates, many more.
Everything below Gamebase in the core hierarchy is reference implementation--in other words, game specific functionality that is by definition dependent on your game designs. For example, complex multi-threaded animation, procedurally controlled animation threads, more advanced (but still networkable) physics, game object states (enabled/destroyed/damaged, cloaked/visible, health/energy, etc.), and dozens of other gameplay specific concepts and implementations.
#4
08/23/2007 (12:23 pm)
Quote:Everything below Gamebase in the core hierarchy is reference implementationThis is a very important sentence so take note. Basically everything in the object hierarchy below GameBase should be examined and most likely changed to suit the needs of your specific game. It is not GG's job to "fix" the Player class or WheeledVehicle class, it is your job to change them for your game's requirements.
#5
Thanks everyone!
11/04/2007 (10:47 am)
Hey, I never really thanked everybody for your comments. You guys had some really great comments and gave me a clear direction where to get started. I still wish there was a tutorial for this made. Obviously, it's too huge to do it all in detail, but just a few pages on the program flow and structure, etc.Thanks everyone!
#6
11/06/2007 (7:11 am)
Try the Documentation link on the yellow bar of the GG page now. The docs are written for TGE but the general "program flow" as well as the object hierarchy are largely unchanged.
#7
11/06/2007 (12:13 pm)
Great tips Stephen, really thanks!
#8
01/06/2008 (10:59 am)
And just because nobody said it, in the TGEA_1_0_3/engine folder theres a text file called engine.overview.txt ... you might want to look at that.
Employee David Montgomery-Blake
David MontgomeryBlake