If a computer is powerful enough, how does it know not to play videos or perform logic for games at a faster speed?

967 views

I don’t know if I’m explaining this right…
A computer can run logic at some speed based on how powerful the components of it are, so if it can perform the logic of something, for example, movement in a game, how does it know how much should be done based on its power, instead of essentially running in “fast-forward” or conversely in slow motion?

In: 1307

40 Answers

Anonymous 0 Comments

It’s called a game loop.

Think of it as a chess game. There is a set time (for example 1/60 frame of a second) that the chess players will switch turns. They don’t want to do it faster, so that the game speed will be consistent, and the players can interact with eacother in a predictable way (predictable lag).

The other player (the computer) will do multiple different things (render the things on screen, prepare possible interaction) in preparation for the other player (you). If they are quicker (more processing power), before when your turn starts, they can provide more information (more graphical frames per second, for example).

Then It’s your turn, and an internal ticker will move to the next “tick” in the loop, starting the process again.

Ps. Interesting anecdote. Space Invaders, a very famous (one of the earliest) game did speed up when you got to nearer to the end (less enemies on screen, no fixed loop, game responded faster). The developers considered it as a part of the gameplay loop then, to make the game harder at the end stage.

You are viewing 1 out of 40 answers, click here to view all answers.