home

Tutorial index

About the XNA and how to use it:

The XNA framework, or XNA Game Studio as others call it, provides a strong set of commands which give the programmer good control over the graphics of the game. To me, it’s best feature is that it’s instructions and it’s functionality are such that the process of game development remains a matter of pure code –thus retaining the control over the mechanics and their better understanding- while not leaving vulnerable points which can lead to hours of debugging, such as would be the mixing of Device Contexts in the Win32Api/GDI.

One notable thing about the XNA is that it is specifically compatible with C#, which means that everything is an object. To see how that works it’s best to see transitioning from C++ to C# tutorials, in general you can code just as you used to, but you will have to modify array declarations, learn how C# includes other source files, and it would be a great advantage to have a good idea about what functionalities C# offers with its object-obsessed mechanics. For example, the length of an array in elements is given by a member function of the array. Another example is that integers, floats and other numerical variables have a toString() function as a member function, it might not sound like much, but it makes code much more straightforward. Pointers also need a setting to become availlable to you again, for that and anything else that occurs refer to the C# tutorials.

It is also useful to note that when you really get the hang of it, you will start getting a very, very long update function, in Bird of Prey I have done this mistake, however my previous programming experience made it relatively easy to navigate through the thousand-line or so code block. This is where you will appreciate two things: using many, many functions (it worked miracles for debugging version 0.1 of my new XNA project), and very clear coding style. Remember that the number of lines in your source code affects readability in a positive way, but it’s only the number of commands that affects processing speed, so fewer lines are equally efficient, if not less because of confusion and bad organization.

Now, the good thing about XNA is that you can jump straight into it, there is an amazing amount of things that can be done with only three features: drawing a non-transparent image, drawing a transparent image, and playing a sound effect. A game of chess doesn’t even use that last one. Sid Meier’s Civilization in the first games of the series was all about these three things. You could even make a game like Sid Meier’s Pirates with these, if you have the patience to make different images for every direction and state of every ship class.

So, the power of XNA is much greater than that of the GDI for the game programmer (never underestimate the GDI though, it is the forefather of nearly all the graphics we know today, most notably it is considered the predecessor of Direct2D, and in turn Direct3D and DirectX). I will eventually move on to more tools, but you can be satisfied that you are learning a strong tool, which supports 3D to a vast extent. To prove the power of XNA, I will refer to Magica, a game made a few years ago by 8 Swedish students, in the first 17 days of it’s release they sold 200.000 copies.

To sum it up, the XNA is powerful and straightforward, without loosing any touch at all with the coding aspect of programming. It has a strong foothold in the industry with highly successful titles and will enable you to maintain larger projects, allowing you do explore the techniques which form the basis of all professional-grade games.

If at any point you doubt your work, go to abandonware sites and download old games, I would suggest Wasteland (the ancestor of Fallout), the original Command and Conquer, the first Elder Scrolls game (Arena I believe), Sim City (again the first), and perhaps the Star Trek game created somewhere around the 90s. DosBox is needed to run most of these. You will understand that you are making something tha once would have been commercial, or at least you are capable of it, and that the creators of those games went forward to create today's sophisticated and elaborate games.