Confused about DT

0 favourites
  • 5 posts
  • Hey you,

    I have been looking the forums and tutorials but I haven't found anything that applies to me, just yet. Or maybe I don't fully understand. Anyways, I have a scrolling back that moves +6 pixels every tick.

    I would like to do the same but with deltaTime. There doesn't seem to be an event for it. Any help?

    Thank you,

    Stephen

  • Deltatime is a constant... just reference it in your event by using Background.x=Background.x+6*dt (experiment here...)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Deltatime is a constant... just reference it in your event by using Background.x=Background.x+6*dt (experiment here...)

    Actually delta-time is not constant, it is time that has been elapsed since last tick occurred. That can vary. :)

    When using delta-time, you really can't say 'move 6 pixels forward every tick' as you are just going against the whole principle of the thing. Instead, you can say that 'move 6 pixels in time frame of one second'.

    DT creates framerate independence. Regardless of what FPS player has, the object will move those 6 pixels in time frame of one second if you are using dt. If you are not using it, player with lower FPS would move LESS than player with higher FPS, as he will have less ticks in a second.

  • The tutorial delta-time and framerate independence covers exactly this.

    Normally games run at 60 FPS. So if you move 6 pixels per tick, it's moving 6 x 60 = 360 pixels per second. However it will change if the framerate changes.

    So to prevent it changing when the framerate changes, move it 360 * dt pixels per tick instead. Then it moves exactly the same speed as it did before at 60 FPS, but the actual speed does not change if the framerate changes.

  • So, this is what I came up with Ashley, vee41, I don't see a difference but I think that is mostly because I have a constant 60fps. I tried spawning 1000 objects and making them fly around but still no drop in fps. I will have to compile a mobile version and test it on my phone. Seeing as wifi preview doesn't work since I switched routers.

    Anyways, here is what my events look like now. Is this correct?

    <img src="http://img560.imageshack.us/img560/1851/support016.jpg" border="0" />

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