Posts Tagged ‘Information’

Info – Game Programming Terminology – Part 2

**This post follows on from Info – Game Programming Terminology – Part 1.

As per my previous post, the following are terms which you may find useful, again these are inspired by my knowledge and Chad Carters excellent book, XNA Game Studio 3.0 – Unleashed.


Effects are quite simply used to get any 3D object to be shown on the screen, with effects like:

  • Textures
  • Light
  • Position of Points

One of the XNA classes to use is BasicEffect which will have one or more technique, and a technique will have one or more passes.

NB: More info to come on the explanation on technique and pass.

Index Buffers:

As we mentioned in the previous post, vertices are stored in Vertex Buffers, which is an area in memory containing lists of vertices. So an index buffer is an area in memory that stores indices that correspond to our Vertex Buffer.

For e.g. if you wanted to draw triangle, you use 3 points (x,y and z if needed) in the vertex buffer, i.e 3 x Vectors (x,y,z). If you want to draw a Rectangle (2 triangles), you could use 6 Vertices in the Vertex Buffer. But because the vertex structs in XNA are memory intensive, AND some of the vertices would be duplicated, then you only need to use 4 in the Vertex Buffer.

The Index Buffer will store 6 indices that correspond to the vertices, in the order we want them rendered. This means only the indices are duplicated and not the complex vertex data.

Good example of this is explained here.


Info – Game Programming Terminology – Part 1

I have started doing Chad Carters book, XNA Game Studio 3.0 – Unleashed, and im now on Chapter 4, Creating 3D Objects. Chad writes the book in a very unique way, where he starts with 3D Game logic first before 2D. You may think this is silly, but it is helping me solidify my current knowledge of 2D XNA programming, and making me delve into 3D, way before i would of without this book (maybe never). So hats of to Chad because i think it is actually the way to do things.

On reading i up some new terminology (to me anyways), which i will share with you now, plus some that i already knew, but the newbies of the gaming world may not know:


This is an important part of 3D and 2D gaming. All game objects are represented by points in space as a Vector. These are x, y and z coordinates (Cartesian).

Within XNA there are various Vector structs:

Vector2 (X,Y)


Vertex Buffers:

The 3D objects we talked about are made up of triangles. This is because the Graphics cards are designed to use triangles as the basic primitive. For e.g. a rectangle is made up of 2 triangles. A triangle in 3D space is 3 vertices.

Vertex buffers are used to store the 3D points in memory. XNA uses the coordinate system by:

x = goes from left to right  – e.g. left = -1 right = 1 (Horizontal axis)

y = goes up and down – e.g. down=-1 up = 1 (Vertical axis)

z = goes forward and back – forward=-1 back=1 (Depth axis)

A lot of 3D geometry going on here, but as Chad says in his book, even though XNA does a lot for you, it is good to know the math behind it.

Info – My YouTube Channel

My YouTube channel can be found here. At the moment this only includes videos of Manic Mummies, my 1st game i did under the 8WeekGame competition. I hope to add more videos of upcoming games and video Tutorials for XNA, so please subscribe for future content.
I will post on here also to let people know when new content is up though, and hope to tie in Tutorials from here to a Video tutorial on YouTube.

Info – How The XNA Framework Operates – Beginners

Unlike Windows programs (which are event driven), XNA programs runs in a continuous loop until the game exits. While the game is running, the Garbage Collector releases/reclaims managed referenced memory which isnt used. On a normal Windows PC, there are 3 Generations of memory, but because the Xbox 360 uses the .NET Compact Framework assembilies, there is only 1 Generation. This can cause Latency within your programs if you are not careful with memory and the GC needs to run often.

As i said previously, the main application calls your game (inherited by Microsoft.Xna.Framework.Game). The Game class contains various methods which are called during runtime in the following order:

  1. Main games Initialize method.
  2. Each game component Initialize methods (if you have any)
  3. If your game has any Drawable game components, then their LoadContent methods are called.
  4. Main games LoadContent methods are called.
  5. Main games Update methods are called.
  6. Each game components Update Methods.
  7. Main games Draw methods are called.
  8. Each game drawable components Draw methods are called.
  9. The game then loops around 5-8 (ie Update then Draw methods for the main game and components)
  10. If you reset the device, then UnloadContent is called.

This is a basic illustration of what goes on within the nuts and bolts of the loop. The XNA Framework handles the Game Loop within the Framework, either by a fixed or variable step timing. The default is fixed step and it targets 60 FPS (1/60th second).
What this means is that Update method is only called when the Game member TargetElapsedTime elapsed. If it is not time to call Update again, the Draw is called. Microsoft have also built an IsRunningSlowly, which means the game is running under 60 FPS, so XNA tries to compensate and calls Update extra time until caught up (without calling Draw in between).

For more information on the Application Model Overview – See here.