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

Author Topic: Question about setFrameRateLimit  (Read 1055 times)

0 Members and 1 Guest are viewing this topic.

Zhiren

  • Newbie
  • *
  • Posts: 1
    • View Profile
Question about setFrameRateLimit
« on: June 14, 2014, 10:20:41 am »
I am writing a game and set the frame rate limit to 60 FPS.  However the frames actually run at about 30 FPS.  So I just am curious why that is. If I set the Vsync on and turn off the limit, it runs at 60. Would this change from computer to computer with different refresh rates?  Also, I probably shouldn't be putting timed events based on a frame count should I?  I probably should use the built in Time functions, right?

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Question about setFrameRateLimit
« Reply #1 on: June 14, 2014, 10:38:49 am »
Quote
Would this change from computer to computer with different refresh rates?
Yes.  Also different processor speeds and OS scheduling behavior.

Quote
Also, I probably shouldn't be putting timed events based on a frame count should I?  I probably should use the built in Time functions, right?
Yes.  A frame is not a unit of time.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6272
  • Thor Developer
    • View Profile
    • Bromeon
Re: Question about setFrameRateLimit
« Reply #2 on: June 14, 2014, 11:17:19 am »
Game logic should not depend on the actual time passed in a frame, otherwise you get non-deterministic and non-reproducible behavior. The typical approach is to let the logic run at a constant rate independent of the frame rate, and adapt the graphics dynamically. Fix your timestep is a more sophisticated article on that topic, there have also been several forum discussions in the past.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: