Physics and Delta Time

0 favourites
  • 11 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • Hello, I can't seem to get my head round dt in relation to physics.

    Here's a video to explain it:

    Subscribe to Construct videos now

    Basically my friends high refresh rate monitor is showing completely different physics forces so I'm trying to make my game framerate independant but when attempting to do this I'm seeing big differences between vsync and full framerate in construct.

  • Have you tried "Set stepping mode" action?

  • Have you tried "Set stepping mode" action?

    I have yeah, here's a video showing the difference:

    Subscribe to Construct videos now

    And here I've tried to adjust my impulse forces with full framerate and in vsync it is different again, with stepping mode, with every 1/30 seconds etc:

    Subscribe to Construct videos now
  • I'm not an expert here, but I had spent days trying to figure out what caused my Physics to change when I tried it in 'fast forward' (higher time scale).

    I still don't know why it does it (probably a bug), but I found out that it has something to do with 'World Gravity'. It doesn't reflect correctly when it comes to 'time scales' and/or 'dt'.

    My suggestions are:

    1. Try without the use of 'dt',
    2. and/or
    3. Change the World Gravity if at any point you're changing the Time Scale.

    For example, if your World Gravity is set originally to 30, and if you make your time-scale to 2, then everything is messed up until you make the World Gravity to 15. Then it's back to normal physics. (so inversely proportional).

    To change the 'World Gravity', you can use any physics object's action, it applies to all I believe.

    And always use V-Synced and Framerate Independent (so that different refresh rates devices don't affect Physics).

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • My suggestions are:

    1. Try without the use of 'dt',
    2. and/or
    3. Change the World Gravity if at any point you're changing the Time Scale.

    Thanks for the suggestions! I have tried this though, think I'm fundamentally just not understanding how this works

  • I think when you're removing 'dt' you're also making it to every X seconds.

    Keep it ticks-based. No dt. Always set to V-Synced, Stepping mode always independent.

    (Change the world-gravity only if you're changing time scales at any point)

    To test physics performance, don't change Full-frames/V-Synced, instead, test on two different devices with different refresh rates.

    I'm sure if you'll see the same result then on different refresh rate screens.

  • I'm sure if you'll see the same result then on different refresh rate screens.

    Ah good point maybe I'm just testing it all wrong. Thank you!

  • Quick update, I spent some time last night with my friend on video call working through this issue, it seemed that no matter what combination of techniques we tried we still witnessed discrepancy in physics forces between our systems.

    Things we tried:

    Always set to vsync

    Set physics objects to Framerate Independant

    Using every 1/30 seconds when controlling our gravity force

    Using *dt when controlling every tick forces

    Interestingly using the construct physics example projects we don't see this issue so I assume it must be to do with how I'm coding this, I will dig deeper and when I have figured out what I was doing wrong I'll post it here.

  • Don't physics ( if set to frame rate independent ) already use dt, as do all behaviors, so if you add your own dt that just messes with physics.

    And you really have no options other than using v-sync. The other ones are there just for testing ( to make sure game will run roughly the same on different monitors/systems.

    You have to export the final game using v-sync

  • I agree. Just drop the dt. Please.

    You should rely on On Trigger impulses, or every tick Forces, without dt.

  • I agree. Just drop the dt. Please.

    You should rely on On Trigger impulses, or every tick Forces, without dt.

    What’s wild is that’s what I’m doing, exactly that, but I’m getting differences between the two systems and also when testing with uncapped frame rate.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)