Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: delta time  (Read 12969 times)

0 Members and 1 Guest are viewing this topic.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
delta time
« Reply #15 on: September 07, 2011, 01:52:28 pm »
Quote
If I first have 1000fps, i know that the delta is 1ms.
If I then make a change that makes the fps drop to 900, i know that the ms is ~1.1.
The performance has decreased by 10%, which the fps shows, it has dropped by 10% too.
The same applies at lower fps's, just at a lower scale.
I really don't see the problem.

The problem is that you compare relative values, not absolute ones.
The only relevant information is the amount of milliseconds that an operation takes to execute.
Let's say that a small operation (an event, or drawing one sprite) takes 1 ms. At 1000 FPS, this makes a huge relative difference, percentage or not. At 50 FPS, it's not significant anymore. And it's not the same percentage, although it's the exact same operation which takes the exact same amount of time.

You can't say that adding one sprite will always lower your FPS by 10%. But you can say that it will always eat 1 ms from your game loop.
Laurent Gomila - SFML developer

xinux

  • Newbie
  • *
  • Posts: 13
    • View Profile
delta time
« Reply #16 on: September 07, 2011, 03:23:23 pm »
Quote from: "Laurent"
The problem is that you compare relative values, not absolute ones.
The only relevant information is the amount of milliseconds that an operation takes to execute.
Let's say that a small operation (an event, or drawing one sprite) takes 1 ms. At 1000 FPS, this makes a huge relative difference, percentage or not. At 50 FPS, it's not significant anymore. And it's not the same percentage, although it's the exact same operation which takes the exact same amount of time.

You can't say that adding one sprite will always lower your FPS by 10%. But you can say that it will always eat 1 ms from your game loop.


As long as I know what the value is relative to, I also know how many ms the added operation takes.
In any case, lets' drop that discussion.

I'm interested though, how did SFML get the float value in the old implementation?
I guess I could make my own class that looks like it, as I still want to be able to show a fps counter in my game (with higher precision than 59fps, 63fps, 67fps that ms gives).

[edit] Nevermind, I'll check the source for the old version.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
delta time
« Reply #17 on: September 07, 2011, 03:30:41 pm »
The sources are the same as before, there's just a cast to integer somewhere in the middle now.
Laurent Gomila - SFML developer

xinux

  • Newbie
  • *
  • Posts: 13
    • View Profile
delta time
« Reply #18 on: September 07, 2011, 04:25:49 pm »
Quote from: "Laurent"
The sources are the same as before, there's just a cast to integer somewhere in the middle now.


Oh, that made things a lot easier. Thanks for the help!