- Error
| Game Architecture Day 1 |
|
|
| Written by Markus Ewald | |||
| Friday, December 25 2009 18:45 | |||
|
Welcome to day 1 of the XNA Game Architecture series! We're about to create a small 3D Shoot 'em Up using the principles of modern software architecture.
If you missed the
introduction, this series is about the architecture of games. Instead of
focusing on a single concept, we'll be focusing at how it all comes together and
how you can keep your game's code manageable and clean. You'll be looking over
my shoulder as I write a small game and explain why I do things one way and
not the other
Today, I will start the project by creating a development tree that contains the actual XNA project and some third-party libraries I'm going to use within the game. Normally, I would add those libraries as I go, but I've got a pretty clear idea for this project and it will be easier for you because I can just package them all in a handy zip archive which you'll find at the end of this article. The Development TreeMy first step will be to create a new development tree. A development tree is the directory structure used to organize a game's projects and their files. Let me think of a good name for our new Shoot 'em Up. How about "Space Invaders"? Nah, I think someone else used that already. "R-Type" maybe? Googles... nope, looks like some small niche game used that name, too. "Tyrian?" Dang. How do they come up with these names? I know! I'll call my fictitious company "Crisp" and my game "Shmup". Now that's just brilliant!
Note to the reader: if that sounds stupid, that's so because I want to motivate
you to find your own name for the game
Back to the development tree! Obviously, the directory housing the development tree will be named Shmup after the game's title. I like to keep things simple, so the contents of my development tree will look like this:
From top to bottom, this is what the directories are for:
That's my development tree. Programmers can immediately spot the solutions and
open them without browsing through the tree. Artists, musicians and so on will
quickly see the relevant directory their work goes into (as described for the
Third-Party LibrariesIn my early days as a programmer, I wanted to build everything myself because then I would know exactly how it works and I could be sure that its code was the smallest and fastest possible ...and probably broken.
While today I may have the skill to build it and make it work, over time
I have found that for any task where there is a popular library in existence, without
exception, this library works well and efficiently. I also discovered that I'm not at
all interested in studying the 40-page PNG specification or learning how to decode
.ogg files just so I can load textures or play music in my game
Here are the libraries I'm going to use in this game:
You don't need to download them right now; I have prepared a zip archive with my development tree including all third-party libraries that you can find at the end of this article.
I'm generally very pedantic about organizing the libraries in the development tree's
Project SetupFor the XNA game project, I will tweak a few settings One tweak is that I target .NET 2.0 instead of .NET 3.5. I do this because .NET 2.0 comes pre-installed with many more systems than .NET 3.5 and because .NET 2.0 is a much smaller download (22 MB versus 231 MB).
Next, I will enable the generation of XML documentation files, which will cause the compiler to issue warnings whenever I forget to write an XML comment over a public class or method.
I usually create two projects, one named
That concludes day 1 of the game architecture series. Remember that you're just looking over my shoulder! Feel free to use your own directory structure and project settings if you're following this series. I won't refer to the directory structure much from here on, so don't hold back.
In the next chapter, we will have a quick run-over of the fundamentals of
software architecture before we finally start writing some code in chapter 3
Download
You can download the finished development tree from here:
|


.
.




Comments
Can't wait for the next chapters!
You have me working with Ninject now and seeing how I can best integrate it with what I want to do. I'm even tempted to figure out unit testing and try it out!
Looking forward to more! Bring it on!
I can't wait for the next one to be online. Please do it!!
PS Happy new year!
RSS feed for comments to this post