Sign in to follow this  

Timesteps and "timesteps"

This topic is 1425 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone know a way to "hack" a different timestep under the current timestep?
I know It doesnt seem logical at first, but I remember something done with looping in a fixed update. And then basically damping the resulting values with variables found in the loop. I dont remember how its actually done, but does anyone know the name of this method and can guide me how to use this?

The main reason I ask this is because I have a simulation running at 50hz (1/0.02)
But id like to run some calculations in 1000hz (1/0.001)

 

Basically I'm simulating car physics, the driveline calculations work well at 50hz, but tires not so well. They get really jerky at low speeds, it seems to be the hardest topic in car simulations.

Anyway I'd like to run slipAngle and slipRatio calculation at 1000hz. I found that SAE methods work pretty well at 1000hz, not perfectly, but  good enough to keep the car 100% static at full stop.

 

Or if I dont need a different timestep, then could anyone give me some pointers on how to damp the slip calculations at low speeds? Switching to a velocity based friction model didnt give any good results. I had some notable side effects.

Also as a side topic cold anyone simply explain how's Runge-Kutta working and is it any good or it's out dated?

Thanks!

Share this post


Link to post
Share on other sites

I am not familiar with the challenges of writing car physics, but I would try to find a more stable integrator.

 

What is "SAE"?

Share this post


Link to post
Share on other sites

Is your time integration explicit? If so, you may want to try an implicit method. Though implicit is more computationally expensive, you can get away with much larger time steps, so in practice it tends to be faster. The downside is its more complicated to implement.

 

Runga-Kutta is fine, you can do it implicit or explicit. It is still widely used in computer modelling. The wiki page on RK is pretty good.

Share this post


Link to post
Share on other sites

Drop the Runge Kutta 4th order integration method! Yes, it does an excellent job at preserving energy, and no, it's not very good for game physics. Instead, use the symplectic Euler 1st order or Verlet 2nd order. Alternatively, use impulses instead of forces and drop the integrator completely, which gives the same result as symplectic Euler.

 

Cheers,

Mike

Share this post


Link to post
Share on other sites

A simple approach that I've used in my games is:


lagTime = 0;

while (isActive)
{
   frameTime = getFrameTime
   lagTime += frameTime;
   dt = constant frame rate;
   while (lagTime >= dt)
   { 
     integrate(dt);
     lagTime -= dt;
   }
}

Share this post


Link to post
Share on other sites

I should just point out to anyone reading this, Runga-Kutta is a family of methods. RK4 or, 4th order Runga-Kutta, is very common but just one method in the family. As other posters have implied, 4th order accuracy is overkill for a game. But that doesn't necessarily rule out the whole family of methods.

Share this post


Link to post
Share on other sites

I should just point out to anyone reading this, Runga-Kutta is a family of methods. RK4 or, 4th order Runga-Kutta, is very common but just one method in the family. As other posters have implied, 4th order accuracy is overkill for a game. But that doesn't necessarily rule out the whole family of methods.

 

Correct, it's a family of methods, not a single one. Should be mentioned. But my opinion is similar with the other members. I have implemented 2nd and 3rd order RK just once and never used them again, since they either introduced or removed a lot of energy from the system and generally did a poor job.

 

A few years back I tested a lot of integrators in the hopes that they would improve my simulations greatly above the standards of symplectic Euler. Well, I was mostly disappointed. The only two exceptions are the 2nd order velocity-less Verlet and the family of higher order integrators by David Whysong. These are just awesome, and I use them mainly for high accuracy space physics. If you want energy preservation, these 4th, 6th, and 8th order integrators will definitely do the job:

 

http://www.projectpluto.com/symp.cpp

 

Cheers,

Mike

Edited by h4tt3n

Share this post


Link to post
Share on other sites
Sign in to follow this