Logo of the XNA Game Game Architecture tutorial series, three interlocked gears

Game Architecture Day 2

Stylish logo of two engaged gears with the text XNA Game Architecture

Welcome to day 2 of the XNA Game Architecture series!

I have thought hard about whether I should just assume a certain level of object oriented programming knowledge in this series. People picking up these articles likely already have some knowledge about objects and design, so I settled on a quick run-over of the principles that hopefully won’t bore the seasoned developers and provide a good reference for people just starting out!

If you already know all this, feel free to skip ahead until it becomes interesting again or to the next chapter ;)!

Read More
Logo of the XNA Game Game Architecture tutorial series, three interlocked gears

Game Architecture Day 1

Stylish logo of two engaged gears with the text XNA Game Architecture

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.

Read More

Game Architecture Series

Stylish logo of two engaged gears with the text XNA Game Architecture

Series

I’m planning to start a short article series:

There are a lot of XNA tutorials out there that explain the basics – how to display a sprite, how to do collision detection and how to render a bunch of colorful particles with additive blending. But there aren’t many articles that explain to you how you’re supposed to put it all together – how to structure a game so that it is easy to extend and remains manageable when the amount of code begins to grow.

The discipline that deals with this issue is called software architecture. Like programming, or any other creative process, it relies a lot on tacit knowledge – finding a good solution without first running down an alley of dead ends (that you can identify using the Principles of Object-Oriented Design) requires a lot of experience.

What I will do in this series is let you look over my shoulder as I design a small game and try to explain my motivations for choosing one design over another while I do so. This will give you a solid starting point and an understanding of the design process that you can apply to your own game projects.

Logo of the Nuclex Framework, the text "Nuclex" with three green dots on a blue ring

Nuclex Framework R984 Released!

The word 'Nuclex' with a stylish font framed by an elliptical ring with three dots

I just uploaded a new release of the Nuclex Framework on CodePlex!

It has been a lot of work getting the GUI library finalized. For once, I really wanted to have 100% unit test coverage on the whole library, which meant a lot of work ensuring the design allowed for this and thinking of all the test cases. But hey, what other GUI library can provide that level of unit tests! :)

Another feature I didn’t want to let go of was control navigation with the game pad and cursor keys. The idea is that you, the developer, just throw some controls on the screen and the GUI will automatically figure out which control to change focus to when the player uses the thumb stick on his game pad. This means you can just add four buttons labeled “New Game”, “Options”, “Credits” and “Quit” to your screen and voilà, you’ve got a main menu the user can interact with using his mouse, keyboard or game pad.

Read More
The logo of the WiX XNA intaller, a cheap montage of the WiX and XNA logos

WiX XNA Installer 3.1

WiX XNA Installer Logo

I just uploaded a new release of my WiX XNA Installer template that has been updated to XNA 3.1!

If you happen to have a customized installer built on the XNA 3.0 template, fear not, for the required changes are very small! Use your favorite Diff/Merge tool and copy over any changes referring to Xna_3_1 into your existing installer.

I have declared this release a beta because I haven’t gotten around to testing it on all possible operating systems.

A Look Back: Gothic 1

In just two days, “Risen” will be on the store shelves. Risen is the inofficial child to the excellent Gothic series, a trilogy of role-playing games produced by german developer Piranha Bytes.

Because of this special opportunity, allow me to revel in ancient times and take a look back at the series’ previous games. I have played all parts so far, including all add-ons, with the exception of the publisher’s cannibalization attempt that is “Forsaken Gods” (which means I played exactly one Add-On, “Night of the Raven” :P).

In my opinion, no other game can compare to this series, no Elder Scrolls, no Baldur’s Gate and no Fallout. Read on to find out why I’m so addicted to the Gothic series :)

Scan of the Gothic 1 package cover

Read More
Logo of the Nuclex Framework, the text "Nuclex" with three green dots on a blue ring

Nuclex Framework on CodePlex

The Nuclex Framework has been released to CodePlex today!

The word 'Nuclex' with a stylish font framed by an elliptical ring with three dots

Instead of only writing about all the cool stuff and then pointing people at my Subversion repository whenever someone asks for the source code, I finally sat down and published the entire Nuclex Framework on CodePlex, together with lots of examples, documentation and screen shots.

The Nuclex Framework consists of small isolated building blocks that you can pick from, so you can easily use just the things you require and ignore the rest (or even create your own trimmed-down edition of the framework if you’re not worried about doing it all again when a new version is out).

All the highlights I wrote about in this blog (and quite a lot that I didn’t write about) are neatly organized in there. And the code’s quality should hopefully speak for itself :)

Just to list some of the more interesting things, there’s a Deque collection (faster than List<> and LinkedList<> and much less garbage), 3D vector font rendering code, 7-Zip content compression, a 3D SpriteBatch equivalent, rectangle packing algorithms for texture atlas creation, a flexible multi-threaded particle system, a work-in-progress GUI library with skin support, a cleaner game state management system, a debug overlay renderer and some helpers that allow you to automatically create VertexDeclarations from a structure without listing the VertexElements by hand.

So what are you waiting for, check it out! :D

Efficiently Rendering Dynamic Vertices

Sometimes, games have to render highly dynamic geometry such as sparks, bullet trails, muzzle flashes and lightning arcs. Sometimes it’s possible to off-load the work of simulating these things to the GPU, but there are effects than can’t be done by the GPU alone.

These cases usually occur when effects require heavy interaction with level geometry or when they require lots of conditionals to mutate a persistent effect state. And sometimes, the effort of simulating an effect on the GPU is just not worth the results. If you have maybe a hundred instances of a bullet trail at once, letting the GPU orient the constrained billboards for the trails instead of generating the vertices on the CPU might just not yield any tangible benefits.

However, there are still a lot of traps you can run into. A typical mistake of the unknowing developer is to render the primitives one-by-one either using one Draw[Indexed]UserPrimitives() call per spark/trail/arc.

This is not a good idea because modern GPUs are optimized for rendering large numbers of polygons at once. When you call Draw[Indexed]UserPrimitives(), XNA will call into Direct3D, which will cause a call into driver (which means a call from code running in user mode to code running in kernel mode, which is especially slow). Then the vertices are added to the GPU’s processing queue.

By sending single primitives to the GPU, this per-call overhead is multiplied and can become a real bottleneck. To demonstrate the effects of making lots of small drawing calls, I wrote a small benchmark and measured the results on my GeForce 8800 GTS 512 and on whatever the XBox 360 uses as its GPU.

Chart showing a drastic performance bottleneck for excessive DrawPrimitive() calls

Read More

Best Video Games of this Decade

This is my personal list of must-play games in the post-2000 era. I find that often, my opinions differ greatly from the reviews in gaming magazines. For example, I liked DooM 3 because of its story, which I find immersive and fascinating, whereas most people regard the game as a tech demo for id’s engine. And I totally don’t get Call of Duty 4/5, the story (?) was uninteresting and has you incoherently jumping from place to place with scripted annoyance everywhere that prevents you from playing in your own style :)

If you’re equally weird, maybe you can find one or the other insider’s tip within this list to check out :D

The game's box showing the hero standing in a white light being held by two claw-like hands

Read More
The logo of the WiX XNA intaller, a cheap montage of the WiX and XNA logos

WiX XNA Installer 3.0

WiX XNA Installer Logo

This past week I’ve been working on my WiX XNA installer template again because I really wanted to integrate installer generation into my continuous integration builds. That way, I can hand test versions to friends without explaining in detail how to get it to run and it’s one less worry I have when I release the game.

After some FAQ reading and some questions on the XNA Forums, I had the certainty that XNA 3.0 can be deployed with .NET 2.0 only (if you change your project configurations to target .NET 2.0). This is good news because the .NET 3.5 installer is huge and, on a fresh system, I’ve had about a 1 in 10 success quote of the installer finishing without an error, so my trust in the .NET 3.5 installer is completely shattered.

Screenshot of an installer showing that DirectX 9.0c and XNA 3.0 are installed

Read More