Game Development Community

Why no ProcessTick or Simstep callback?

by Jonathan Brockman · in Torque 2D Beginner · 09/08/2013 (5:45 am) · 3 replies

I've working on a reasonably simple project, so I decided to take the opportunity to look at Torque2D. While the engine itself seems quite good, I find it tremendously odd that there is no Process Tick, or SimStep callback in torque script.

This seems like a pretty glaring hole. I get that Torque is more event driven, and I could simply modify the source to add it, but is there a reason that this pretty cornerstone function is missing, out-of-the-box? The only other real game engine I have used is Unity, so maybe I am incorrect in assuming it would be visible.

#1
09/08/2013 (7:01 am)
I don't use T2D but did you try this callback?:
t2dSceneGraph::onUpdateSceneTick()
Also you can create it using schedules:
function updateSceneTick() {
    cancel($sceneTicker); // Clean up the schedule object

    // Your code here

    $sceneTicker = schedule(10, 0, updateSceneTick); // update it every 10 milliseconds  
}

To stop the ticking just call:
cancel($sceneTicker);
To start ticking just call updateSceneTick once.

Edit: also have a look at the tip #4 in Melv May's thread
#2
09/08/2013 (7:11 am)
...
%banana.setUpdateCallback(true);
...
function class_banana::onUpdate(%this)
....
#3
09/08/2013 (7:13 am)
Thanks guys! I'll give these a try.