how do you make a games speed not rely on fps?

  • Thread starter Thread starter Nyap
  • Start date Start date
  • Views Views 914
  • Replies Replies 1

Nyap

HTML Noob
Banned
Joined
Jan 13, 2016
Messages
971
Reaction score
347
Trophies
0
Age
57
Location
That Chaos Site
XP
529
Country
so if you did this (pseudocode)
Code:
int main()
{
    while (inGame)
    {
        render stuff etc
    }
}
the game would be blazing fast at 200fps and slow-motion in 20fps. How do modern games remedy this?
 
Last edited by Nyap,
Most modern games use what's basically called a time step. Instead of having things like physics or game speed run based on the amount of frames someone's hardware can render, they use equations to limit actions performed in the game to a specific interval. This allows the game to run at whatever fps hardware can handle while keeping things like physics or in-game speed at a stable speed instead of increasing/decreasing. I suggest googling around about it for more in-depth information.

That's usually the preferred way of doing things in modern games, however there are some that instead will just limit the amount of FPS a game can render instead. Fallout 4 is one of the most recent examples I can think of, Bethesda made the game's speed tied to framerate and just capped the framerate. If you do a little modding and unlock the framerate to, say, 144fps, in-game actions would happen twice as fast; you run faster, objects fall quicker, etc.
 
  • Like
Reactions: Nyap

Site & Scene News

Popular threads in this forum