The game loop
The game loop is a game developer's roadmap. The names differ depending on the framework and platform, but the same rules apply. The game loop comprises of all the methods, physics updates, and draw calls that occur during a single frame of your game and their order of execution. The golden rule to game development is to try to keep this loop always spinning in full iterations at no slower than 16.6 milliseconds, or 60 frames per second.
There are aspects of the game loop that don't have to be controlled by the game developer as much as they used to be in the past, though we do have the option to work down to the very GPU calls using OpenGL, or even better, Apple's Metal API. We will discuss more on these topics later on.
Here is what the SpriteKit game loop looks like:
The preceding is an illustration given to us directly from the Apple Developer site. We see a number of functions that are called during a single frame. The first function iterated through is update()
. The update...