Jump to content

  • Log In with Google      Sign In   
  • Create Account


Timesteps and "timesteps"


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 vadevaman   Members   -  Reputation: 157

Like
0Likes
Like

Posted 14 February 2014 - 10:36 AM

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!



Sponsor:

#2 Álvaro   Crossbones+   -  Reputation: 11910

Like
0Likes
Like

Posted 14 February 2014 - 12:33 PM

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

 

What is "SAE"?



#3 brucedjones   Members   -  Reputation: 404

Like
0Likes
Like

Posted 14 February 2014 - 02:18 PM

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.



#4 Irlan R.   Members   -  Reputation: 1276

Like
0Likes
Like

Posted 14 February 2014 - 02:41 PM

I am not familiar with these type of physics too but this can be useful.



#5 h4tt3n   Members   -  Reputation: 967

Like
0Likes
Like

Posted 20 February 2014 - 12:44 AM

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



#6 Irlan R.   Members   -  Reputation: 1276

Like
0Likes
Like

Posted 20 February 2014 - 08:00 AM

I agree with h4tt3n. Drop RK4 and go with Euler.

Like I said this can be helpfull even if you're not using RK4's method.



#7 Irlan R.   Members   -  Reputation: 1276

Like
0Likes
Like

Posted 20 February 2014 - 08:04 AM

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;
   }
}


#8 brucedjones   Members   -  Reputation: 404

Like
0Likes
Like

Posted 20 February 2014 - 12:22 PM

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.



#9 h4tt3n   Members   -  Reputation: 967

Like
0Likes
Like

Posted 21 February 2014 - 02:50 PM

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, 22 February 2014 - 12:11 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS