ODE Stepsize

Started by
10 comments, last by Gorax 17 years, 11 months ago
Quote:Original post by Gorax
I think BradDaBug meant you should limit the maximum step size, that way things don't end up in walls (this happens in NFS-MW) or pass through things (this happens in NFSU2).

Although setting a maximum step size is much better than nothing, I meant fixed timesteps. The basic idea is that you set your desired timestep size to something like 0.01 (100 Hz) and then each frame figure out whether you need to take a step or not. Some frames you may not take a step (if you're game is running really fast) and some frames you might take more than one step (if your game is running slower). Whatever happens, each timestep is exactly the same size, completely independent from the frame rate.
I like the DARK layout!
Advertisement
Sorry about that BradDaBug, I understand what you mean now (oddly enough, I've actually done it before, but a lack of sleep makes it easy to forget things). The only difference between the method I used, and the one you use, is that I assumed everybody's computers were slow, so the maximum time step was required (nothing like not being able to control anything for a few seconds while your computer chokes on something), but in order to keep it stable (so nothing got embedded in the walls, etc.), I had it run through small, fixed time steps (not unlike the ones you mentioned). It's less efficient than your method, but it'd run on (almost) anything without any problems.

NickGravelyn, incase you can't figure out what I'm rambling on about, instead of using some step size up to the maximum step size, run a loop that uses some step size up to some predetermined (smaller) step size that should ensure that nothing stupid happens during the simulation, until the step size acquried in the method I showed you is reached.

Also, your problem is probably the result of you not resetting the 'lastTick' value (I've done it before).

[EDIT]
BradDaBug, feel free to disregard everything I mentioned about my method differing from yours where it doesn't. I really need more sleep...

This topic is closed to new replies.

Advertisement