Blograby

The XNA Game Execution Model

XNA uses a game loop that is generated by the design tools. The life cycle for a game consists of four main stages, as shown in Figure 1.

The game first initializes and then loads content such as sprites, images, sounds, and other components of the game. It then initiates the game loop. The game loop consists of two processes that run asynchronously: code that draws the frame containing the complete screen to a buffer, and code that updates the screen from the buffer. This loop runs until the user closes the game, at which point the content is unloaded.

Draw and Update are executed at different rates. Draw is executed as frequently as possible based on the maximum frame rate that the device can provide, whereas Update is executed at a regular rate. The draw rate should generally be higher than the update rate.

For more information about creating games using XNA, see “Getting Started with XNA Game Studio Development” on MSDN® (http://msdn.microsoft.com/en-us/library/bb203894.aspx). For a walkthrough of creating a simple game using XNA, see “Your First Game: Microsoft XNA Game Studio in 2D” at on MSDN (http://msdn.microsoft.com/en-us/library/bb203893.aspx).

 

Exit mobile version