Posts Tagged ‘Terminology’

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:

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.

Advertisements

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:

Vertices/Vectors:

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)

Vector3(X,Y,Z)

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.