[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] frame independant movement



On 2010.8.28 1:42 AM, R. Alan Monroe wrote:

In other words, use a small enough time step that the difference
is not big enough to be a problem. But if you're doing that, you
might as well pick one sufficiently small time step and use a
variable number of them per frame, so that the physics is
always predictable whatever the frame rate.

While we're on the time topic, is there an easy way to do slo-mo, a la
Peggle Extreme Fever or a Burnout multi-car pileup?

Hmm. If your standard physics time-step is small enough that you can avoid problems like collision, making the time-step smaller than that doesn't seem like it'd hurt anything. (Though I might misunderstand some of the argument earlier.) And if it did, maybe it's enough that you don't need to care. Or if you were _really_ concerned, you could even back up the world objects' status at time 0, simulate times .1, .2, .3 &c instead of your usual 1, 2, 3, &c, and when you were done showing off, revert to time 0 and do a 1-unit time-step to eliminate any deviation from your usual physics.