Game Development Community

the quick coding tour

by Roger D Vargas · in Torque 3D Beginner · 09/19/2013 (8:04 am) · 1 replies

Im trying to underestand how the engine works, but so far all I can see is a bunch of scripts that requires hours of reading. Can somebody give me a quick explanation about the structure and what each thing does? Where is the main loop, the input management? What would be the best approach to implement game states? Where do I put the AI?

#1
09/19/2013 (8:14 am)
So, the thing about the scripts is that they don't have a main loop. Scripts only really define callbacks, functions that happen in response to some event. So, I dunno, you have an onCollision callback in scripts. When the engine detects two objects colliding, the onCallback script runs, does something like damage or sound effects, and then finishes.

Most of the 'looping' stuff in the engine is done in methods like processTick and advanceTime. These methods are called once every engine tick (~30Hz) and once every frame, respectively.

Trust me, you don't want to see the actual main loop. It's not cool. Don't go there.