I researched a lot about game loops but most of the explanations I found credible also stay at a high level. I still don't understand the functionality of the components in a game loop. Let's consider:

while gameIsRunning:

What is the difference between processInput() and update()? Obviously one handles the input and one updates, but that doesn't really explain what they do. Is it correct to assume that the first step to update ONLY the players action and in the following function the rest of the scene? Is the following assumption correct?

    def processInput/handleInput/...():
        if input == UP:
        elif input == DOWN:

    def update():
        updateEnemies() # like position etc.

1 Answer 1


If you consider that a "game" is basically a data simulation then the input() + update() + render() stages need to happen in that order for each frame displayed to the player to make any sense.

The outer game loop IS high level, that's why you only see that. At this level, processInput() simply takes input from the player and tells the engine about it. No action is taken yet, it records what the player is asking to do, probably does some sanity checks to make sure it's a legal request, and passes it along to the game simulation.

Then update() does everything to change the running game data for each time step, including finally handling the player changes from the input, enemy AI, visual effects, game logic... This update() is where 90% of your game lives.

And finally render() builds the visual display from the current game state.

The game loop really isn't more complicated than that. PS: there is a gamedev stack https://gamedev.stackexchange.com/ that will help with the update() 90%

  • 1
    Thanks! That explains everything I needed to know Oct 24, 2019 at 22:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.