Search code examples
design-patternsgame-enginegame-loop

Purpose of having multiple game updates if there's a fixed timestep and interpolation


I am attempting to create a game and have implemented a fixed timestep as described in the article: http://www.koonsolo.com/news/dewitters-gameloop/comment-page-3/#comment-18678

This is quite a common strategy in order to get determinism in the development of a game. My question has to do with the number of updates that you would have. I have read about many variations (in the article it is set to 25 updates per second) but I have read about 20 or even 10. If interpolation is going to be used anyways, why not just update the game once in second and simply interpolate? What's the point of having multiple updates? You could just as easily have a big update every second and interpolate between them, or actually ANY number would suffice as the interpolation would simply match any number. How do game developers choose that number to be either 25, 20, 10, 15, 18, or whatever else? Thank you!


Solution

  • Games usually follow the principle of input -> processing -> output as almost all software does. Thus, whenever your internal game state changes or needs to react to some input or event, you would output the respective changes to the user. The inputs triggering an update depend on the actual game. In a game based on physical behavior, you would rather often update or recalculate the game's internal state to reflect object movements, collisions and such. In a card or board game, for example, you would need to update the game's state only whenever the player interacts with game elements (e.g. clicking a card) and would not need a periodical update of game state at all. The frequency of how often you would update your game state thus would follow the requirements of input interactions and events within your particular game:

    • How often would you need to poll player input, if it's not event-based?
    • How often would you need to internally update game element's internal state to reflect animations smoothly?

    You might also be interested in this question.