How to make physics independent of frame rate? (Deterministic physics).

Here are two videos comparing a run with lag and one without lag.
I’m making a racing game using chaos vehicle. But the physics simulation speed is dependent on the frame rate. This means that players with a lower fps also drive slower. This is of course not fair.
I included two videos in the link above that showcases this.
What I already tried:

  • Using a fixed frame rate. This also slows down the game time when the fixed frame rate is not reached.
  • Multiplying by delta time. This does nothing?
  • Using substepping. This just isn’t deterministic.

Is there a way to make the physics independent of the frame rate? Or another way to make the physics deterministic?
I can include images of my code when needed. Thanks in advance!

Hello @OrangeAedan ,
This video , Pygame Framerate Independence Tutorial: Delta Time Movement , does a great job explaining why players with lower FPS end up driving slower, so it’s useful to understand the context.

You can try enabling Physics Sub-Stepping.
“Sub-stepping improves the accuracy and stability of physics simulations, especially when performance is low or motion is complex. It works by dividing each frame’s time into multiple “sub-steps” and running the physics simulation several times within that frame, keeping the simulation consistent regardless of FPS”.

Here’s the official Unreal documentation, a forum post discussing the topic, and a few videos that can help you set it up in your project:

If you have any questions, don’t hesitate to ask again on the forum!
Hope it helps!

Thank you for the detailed explanation! But I already saw these articles. Substepping still doesn’t work when you get a lag spike. And it is not precise enough for my game. People will compete for the fastest time. So I don’t want things like frame rate to have influence at all. Multiplying by delta time doesn’t work either. I included an image of how I apply gas bellow:


The person on the forums was using forces. Which is not the same as what I’m doing.

I need deterministic physics. And the only thing that did that was fixing the frame rate. But that is not a good solution.