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
The game’s logic knows how much time has passed since the last “frame”
“`
function move_people(seconds_passed, people) {
for each person of people {
person.move (speed * seconds_passed)
}
}
“`
If the game’s logic runs faster, this function will be run more frequently, however seconds_passed will be smaller for each run so for each call the people will move less than a slower running computer. as a whole the person will move the same distance.
Latest Answers