Synchronize Physics World Step and Framerate Limit

Blitz3D Forums/Blitz3D Userlibs/Synchronize Physics World Step and Framerate Limit

RustyKristi(Posted 2016) [#1]
I'm trying to use both frame limiter step so for the consistent results and at the same time use physics.

The demos regardless of wrapper (newton,physx,ode) don't show how this works (or maybe I just missed it), usually the worldstep function takes over and just Flip (not false)

Any ideas guys?

timer = CreateTimer(60)

repeat
   WaitTimer timer
   WorldStep(0.01)
   Cls

   UpdatePhysicsStuff()

   RenderWorld
   Flip 0
until keyhit(1)


The above renders slow


Trinosis(Posted 2016) [#2]
Maybe your V Sync is forced on in your graphics card, so flip 0 is ignored.

It may be updating at 30hz instead of 60.
Waiting for your timer and then a V Sync.


RustyKristi(Posted 2016) [#3]
Thanks Trinosis. Apparently I don't use vsync and I can test other code that confirms it.


Zethrax(Posted 2016) [#4]
I was using a constant for the physics step value at one point in a render tweened FPS engine and found that the physics and rendering states were getting slightly out of sync. Changing the code to dynamically calculate the delta-time value provided as the physics step value (rather than using a pre-calculated constant) fixed the problem.

Basically your rendering frame rate will always have some degree of variance and that fact needs to be factored into your physics time-step.

Not sure if this is the actual problem you're having, though.


RustyKristi(Posted 2016) [#5]
Thanks, I will try do the same thing. Will this work if it this is multiplayer?


Yue(Posted 2016) [#6]
Flip the problem that is ignored is not a matter of the graphics card is verision 1,106 Blitz3D problem , if you use a library where the problem is corrected. The fact is that the upgrade to 1,107 corrects this problem.


RustyKristi(Posted 2016) [#7]
So there's a physics problem with the older 1106? I'm using 1108