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

Nyap

HTML Noob
OP
Banned
Joined
Jan 13, 2016
Messages
971
Trophies
0
Age
55
Location
That Chaos Site
XP
483
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,

Tom Bombadildo

Dick, With Balls
Member
Joined
Jul 11, 2009
Messages
14,575
Trophies
2
Age
29
Location
I forgot
Website
POCKET.LIKEITS
XP
19,216
Country
United States
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

General chit-chat
Help Users
  • No one is chatting at the moment.
    SylverReZ @ SylverReZ: https://www.youtube.com/watch?v=3eGAHfC5P-Y