Replies: 2 comments
-
Varying the timestep every frame will reduce stability. Whether that's actually a problem depends on the simulation- if you do a bunch of representative/thorough tests and it's always fine, then probably nothing to worry about. The more it is allowed to vary, the larger the potential instability. If it jumps from 1/10 to 1/200 repeatedly, very few simulations will work well. If it's jumping from 1/60 to 1/65, it's far less likely to cause a problem. If it is constrained such that it changes no more than 1% per frame or something like that, you would very rarely see any issues. If you do encounter unacceptable levels of instability, the usual approach is to interpolate results computed using a fixed timestep. You can turn that on in v1: https://github.com/bepu/bepuphysics1/blob/master/Documentation/UpdatingAsynchronously.md (edit: linking simulation to rendering time will also tend to make game mechanics dependent on framerate, which is the source of a lot of goofy stuff across many games. Not necessarily a showstopper- after all, those games did ship with those behaviors- but something to be aware of.) |
Beta Was this translation helpful? Give feedback.
-
Hi Norbo, thanks for your quick answer. I'll keep testing it and hoping no problems arise, framerate should be really stable for most users so fingers crossed. I'm aware of the "quake 3 physics long jump" problem, a friend of mine complained a lot about his terrible computer and that bug :) Fortunately the game is not competitive nor even fast paced, so even with differences in physics it shouldn't be a big problem. |
Beta Was this translation helpful? Give feedback.
-
Hi Norbo!
I'm reaching my game's final stages before EA release and I'm trying to adapt my game to 144 Hz displays. I've got quite some problems with it ( why can't people have 60Hz monitors like me XD ) but it seems almost everything is fixed now, except physics.
The Space.Update function just accumulates time until TimeStepDuration is reached, and then calculates a single physics step. (iterates up to MaxTimestepsPerFrame). Unfortunately I need results in each step.
My idea is chaging TimeStepDuration every frame so that I get DoTimeStep called (at least) once, putting a lower value for computers where high framerate must be achieved, and keep the current 1/60th timestep for computers on 60 FPS or lower. (timestep won't go higher than 1/60 ever)
The first tests I've done seems to be positive, but being bepu such a complex library, I'm a bit scared. Do you remember if there can be problems modifying TimeStepDuration each frame?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions