Categories
Game Development General

XNA Framework API?

The other day I decided to look through some source code of other games, and I downloaded a breakout clone written using the XNA Framework. It provided the source code, and I figured that C# can’t be that different from Java or C++, so it shouldn’t be a problem. At one point I thought that maybe C# allowed you to use two different names for the same function, such as calling Run() vs defining it as BeginRun(), but then I realized that the code I was trying to find was apparently in the XNA Framework.

I almost gave up looking for the XNA Framework API since it seems to be too difficult to find, which means that the game’s source is almost impossible to follow since I can’t find a way to start running the game. Since I do all of my development on GNU/Linux, and Microsoft isn’t porting their software over anytime soon, I am left with the source code that depends on a missing API to understand. I finally found the API in MSDN, but I had to use Google to do so. Why I couldn’t just search for it with MSDN itself I have no idea. I also wish that the documentation was a bit more useful. For instance, here’s the Game method Run():


public void Run ()

That’s it. I don’t even get to see what it is calling or doing. The comment says “Starts the game”, and I have to find a completely different part of the documentation that tells me that it “starts a loop that will call Update and Draw multiple times a second until Exit is called”. So now I know what it calls and what it does, but why couldn’t the function’s page tell me?

Is it secret code or something? I guess I am just used to seeing the code of implementations, such as C++ standard libraries. I mean, I understand that I shouldn’t have to know what the implementation is doing in order to use it, but since it seems so hard to get good documentation on what the API is and how to use it, what else could I do but go to the source?

Maybe it is because I don’t have Game Studio Express or any of the Microsoft XNA-related pieces of software. I believe there are tutorials provided, and I found a few videos that seem to explain how the content-pipeline works, so it is obviously documented somewhere. Maybe search terms like “xna framework api” aren’t the ones to use?

Well, anyway, after a few hours of research, I finally found the info that I needed. Now I can look at the breakout clone’s source code and figure out how it works. At least until I hit another mysterious XNA Framework API call, that is.

By the way, I kept hearing about how great the XNA Content Pipeline is, and I concluded that it simply integrates graphics asset collection into the same program you use to edit code. It’s nice, but I was expecting more from all the noise getting generated about it. Is there something more to it that I didn’t find in my admittedly quick research?

3 replies on “XNA Framework API?”

There is no magic to XNA, but the framework is very new and the documentation is still a little sparse. At the same time, MS usually splits their documentation into tutorial like “getting started” sections and reference sections that are basically a listing of methods. If you don’t know what you are doing, reference isn’t very helpful.

http://msdn2.microsoft.com/en-us/library/f8ae3cdb-93d-976c-667d-5262e9a6d3e.aspx#ID2ES

Explains everything pretty well though imo.

Wow, that sucks that MS doesn’t have decent / easy to find docs about their stuff. It should have some basic info like what kind of exceptions Run could throw, what kind of overloads it has (if any), what needs to be called before it, and what its going do to your game state when it gets called. Also, it should probablly tell you about the configuration options you have before you run, probably with a link to the doc page, otherwise how else are you going to find them!

What’s odd about XNA’s lack of documentation is that MSDN usually does a great job of answering the above questions for everything else.

Impossible: Yeah, once I found the Application Model Overview page, I was able to figure things out. I just don’t know why those same things couldn’t be explained closer to where I would think one would look. If I want to find out what Run() does, I would look at Run(). I wouldn’t think to look at the complete application overview for that information, right?

Comments are closed.