Scheduling Recurring Event
by Dumbledore · in Torque Game Engine · 07/17/2008 (2:17 pm) · 2 replies
Sheesh I don't seem to have much luck with the search engine here. Figure I better ask...
Is there a built-in way to schedule a recurring event, because this way isn't efficient because it needlessly deletes and reclaims memory.
Is there a built-in way to schedule a recurring event, because this way isn't efficient because it needlessly deletes and reclaims memory.
void MyEvent::process(SimObject *object)
{
MyObject* rm = static_cast<MyObject*>(object);
rm->processSecondElapsed();
MyEvent* rmEvent = new MyEvent;
Sim::postEvent(this->destObject, rmEvent, Sim::getCurrentTime() + 1000);
}
#2
07/17/2008 (2:53 pm)
If your object is one that has a processTick, you can build your own recurring event using an internal timer.
Associate James Ford
Sickhead Games
Or for continuous updates use pack/unpackUpdate in an object. I think internally that is still allocating NetEvents so... i wouldn't worry about it.