Page 1 of 1

delta-time and framerate

PostPosted: Sat Mar 03, 2012 8:09 am
by Ragtime
Hi!

By chance, I've heard about "delta-time and framerate". That's something totally new for me. 2-3 weeks ago, I posted a topic about performance and no one mentioned that.

I suppose I should have to apply it manually on all my project. But before to do so, I'd like to know :

Thanks to that, can I "force" a game to be fast on a slow computer (that makes the game run at 30fps), and will it look like if it was really running at 60fps??

It would be too nice to be true, but I might have misunderstood... What are the disadvantages? Why isn't it a default feature?

Rag'

Re: delta-time and framerate

PostPosted: Sat Mar 03, 2012 8:19 am
by Yann
you can't force a game to be fast unfortunately (:
using dt just unsure that if you want an object to move 100px per seconds, it moves exactly at this speed.
If your fps is at 60, the sprite will move 100px/60 = 1.67 px per tick
If your fps is at 30, the sprite will move 100px/30 = 3.33 px per tick
If your fps is at 2, the sprite will move 100px/2 = 50 px per tick

So the higher the fps, the smoother the movement.Yann2012-03-03 08:19:37

Re: delta-time and framerate

PostPosted: Sat Mar 03, 2012 9:39 am
by Ragtime
That's exactly what I was looking for, in order to make my game playable on every computer...

Even if it's less smooth on a slow computer, it remains playable! (I've quickly tested and it seems to work)

Does it impact the collisions accuracy?

Re: delta-time and framerate

PostPosted: Sat Mar 03, 2012 2:15 pm
by Ashley
Yes, as the article notes, lower framerates mean objects jump further every tick which can make some collisions less accurate. However a minimum FPS of 10 is used which helps prevent it getting too bad at really low framerates.