The MonoGame Game Loop (just like the XNA Game Loop)
In the previous section, we talked about what you can find in the MonoGame project, so these methods should look familiar. Now I’ll explain a bit more about them, but first, a picture…
- The Initialize() method is called only once, when your game first starts up.
- The LoadContent() method is called from the Initialize() method, and is where any content assets (3D, 2D, spritefonts, music) would be loaded.
- The Update() and Draw() methods form the game loop.
The Game Loop keeps going until you exit out of it. One pass through both of these methods is called a frame, and on the Playstation and Xbox, you’ll get about 60 frames per second (FPS). Some smartphones run about 30 FPS. Your performance can vary significantly on a PC, because of the hardware involved, but consoles give a pretty consistent experience overall. We’ll cover a bunch of the interesting things you can do in the Update() and Draw() methods in a later post.
- The UnloadContent() method is where you would dispose of any resources you loaded up for your game.
I’ll cover putting something on the screen. If you came directly to this page, you can find the complete list of articles here.