Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualKaptein

Posted 23 November 2012 - 06:38 AM

you can solve this by not running at a fixed timestep
i run everything using floating point timesteps :)
then it HOPEFULLY doesnt matter what your "update speed", or any speed is
all that matters is the precision level you choose to use, and the precision of the timer
you'll still have to cap the difference between previous and next to avoid jumps in physics when the system stalls for whatever reason
but you can't get smoother than floating point...
if (_localtime - _lasttime(0) > timing_max_difference)
  _lasttime(0) = _localtime - timing_max_difference
time_d_factor = 1.0 + (_localtime - (_lasttime(0) + movement_scale)) / movement_scale
_lasttime(0) = _localtime
now you can just multiply everything (including floating point counters) with time_d_factor
movement_scale isn't a good name for a variable.. it's just a measure of how big you want your multiplier to be (so that it makes sense in your physics department)
for example if its 0.01 you'll measure things in 10ms and so on

so, i'm just posting it here in hopes someone will discount or confirm my idea..
this has worked well for me for a month or two now, and it's been very smooth

#1Kaptein

Posted 23 November 2012 - 06:37 AM

you can solve this by not running at a fixed timestep
i run everything using floating point timesteps :)
then it doesnt matter what your "update speed", or any speed is
all that matters is the precision level you choose to use, and the precision of the timer
you'll still have to cap the difference between previous and next to avoid jumps in physics when the system stalls for whatever reason
but you can't get smoother than floating point...
if (_localtime - _lasttime(0) > timing_max_difference)
  _lasttime(0) = _localtime - timing_max_difference
time_d_factor = 1.0 + (_localtime - (_lasttime(0) + movement_scale)) / movement_scale
_lasttime(0) = _localtime
now you can just multiply everything (including floating point counters) with time_d_factor
movement_scale isn't a good name for a variable.. it's just a measure of how big you want your multiplier to be (so that it makes sense in your physics department)
for example if its 0.01 you'll measure things in 10ms and so on

PARTNERS