Geeks With Blogs

News

Google My Blog

Catch me at: The List!


My InstallScript Utility Belt My Amazon Wishlist
My Standard Disclaimer


Archives
Blogus Maximus Rubbing people the wrong way since 1970...

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…

gameloop

  • 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.

 

Next up…

I’ll cover putting something on the screen. If you came directly to this page, you can find the complete list of articles here.

Posted on Monday, February 13, 2017 2:35 PM Game Development , MonoGame | Back to top


Comments on this post: 5. MonoGame - The Game Loop

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Chris G. Williams | Powered by: GeeksWithBlogs.net