This has been a TODO forever, just wanted to formalize it here.
It's super useful to globally control the tick rate of a game, for easy slow-motion or to manage frame-rate. In the past, I would override the onTick function in timer.js, but timestepanimate native accelerated code was not affected and ran off its own timer.
Enable / disable automatic ticking, always enabled by default
Allow manual ticking with parameter dt (usually in this case, automatic ticking is disabled)
Can be used to smooth-out frame rate in the event of lag spike (from garbage collection etc.)
Alternatively, we could drop in a tick-smoothing algorithm used in some of our games in the past that helped mitigate lag spikes; on by default but optionally disabled or replaced
Allow setting / getting of a dt multiplier, defaults to 1
Native animations currently tick before timestep js ticks. There are at least two options:
Have the js-tick function return an adjusted dt for native, requires switching the order of animation/timestep ticks. I'm not sure if the order matters.
Add an additional, optional, callback for computing the dt before the main tick. Incurs additional overhead each tick, but probably not significant.
Either route would allow easy implementation of any of the features you mentioned in JS.
This has been a TODO forever, just wanted to formalize it here.
It's super useful to globally control the tick rate of a game, for easy slow-motion or to manage frame-rate. In the past, I would override the
onTick
function intimer.js
, buttimestep
animate
native accelerated code was not affected and ran off its own timer.