Our textbook, Beginning XNA 2.0 Game Programming: From Notice to Professional Apress tries to provide a broad look at the development of a 2d or a 3d game. This is a lot to cover and we hope this page will provide a big picture view.
Below, we briefly focus on the portions of this file. For clarity, all comments have beenr removed.
Lots of using declarations were here namespace Stewart_Game1 { public class Game1 : Microsoft.Xna.Framework.Game { GraphicsDeviceManager graphics; SpriteBatch spriteBatch; public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; } protected override void Initialize() { base.Initialize(); } protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); protected override void UnloadContent() { } protected override void Update(GameTime gameTime) { base.Update(gameTime); } { graphics.GraphicsDevice.Clear(Color.CornflowerBlue); base.Draw(gameTime); } } }
When you design your game, you choose to have objects that will interact with the player and defines the activity of the game. For the 2d game, you created a sprite and set up its properties. In Chapter 3, you created the GameComponent for the 2d game Rock Rain. The player is represented as a space ship and the meteors are the objects the player interacts with. Each of the objects will be created by XNA/C# as a Game Component, your game assets with their own properties.
p. 15 Summary give a nice big-picture view and its roughly reproduced here.
The Game Structure: Intiialize graphics, input and sound Load resources Start game loop. In every step: Gather user input Perform needed calculations (AI, movement, collision detection, etc.) Text for game ending criteria - if met, stop looping Draw (render) screen, generate sounds and game controller feedback Finalize graphics, input and sound Free resources This general game structure maps onto the XNA Game class overridable methods: Game1() - General initialization Initialize() - Include nongraphics initialtion LoadContent() - Include graphics initialization Run() - Start game loop. In every step: Update() - Include code to read and process user input, do calculations for AI, movements and collisions, and test for game end Draw() - Include the drawing (renderization) code UnloadContent() - Free graphics resources
Another useful text is XNA 2.0 Game Programming Recipes, by Riember Grottjans, Apress. The author provides his own gateway to tutorials on XNA www.riemers.net which you may find useful.
Riemers characterizes the XNA Framework as divided into 3 parts.