I'm finally done writing an XNA game called "Microbe Patrol" based on the Microbes sample I wrote and blogged about, around a month ago. I think it turned into a fairly fun, original, good-looking game. The basic concept of the game is to create trails from one point on the arena's perimeter to another, without touching any microbes. The longer your trail is, the more points you earn. It starts out quite easy, but things get frenetic pretty fast. In addition to the "positive" and "negative" microbes that I had before, I've added cyan "shepherds" that fly around unpredictably, and purple "sweepers" that keep the microbes from bunching up around the perimeter. Give it a try -- can you make it to 30,000 points?

 

The game uses many of the things I've talked about in previous posts, most recently the stroke-based text. In this version of the StrokeFont class, I added a few routines to measure text and center a string around the origin -- but I removed the 0x80+ characters, so if you want an "ultimate" version of StrokeFont you'll have do some copy and paste work. Same thing for the Line code -- some stuff is added here as compared to previous versions, and some stuff is removed. I'm trying to not get too hung up on writing "perfect" utility classes and tools -- at some point that kind of coding just isn't fun, and if I spend all my time polishing utility classes, I'll never get around to writing games and exploring all the interesting concepts that I want to try in XNA. I'm hoping people find my code useful as starting points and can adapt it to their own needs. You can always ask me if you really get stuck trying to add the functionality you want to my code.

Anyway, back to the game....

It's perhaps notable that it doesn't use any texture maps at all. Texture maps are great for some things, but I think people may rely on them a bit too much rather than using shaders to their full potential. I like to be able to zoom in as much as I want into the scene and not see big pixelated chunks from textures that are over-magnified. And of course, doing things procedurally saves space: MicrobePatrol's source code packs down to 125KB, and most of that is audio data for (my very amateur attempt at) sound effects. If I had any art skills, I'd probably be using more textures!

You might notice that there are four tubes entering the play arena, but only three are currently used for anything. I was thinking that (with a little work) the game could support two players on the arena at once. With some additional game elements (such as "good" microbes that you collect for points, or ways to sabotage your opponent's lines), things could get interesting. If you think this would be a good idea, feel free to try hooking it up yourself, or send me feedback and maybe I'll give it a shot at some point.

The code violates the "safe area" rules -- it could probably be fixed fairly easily by adjusting the view matrix.

Oh, and the explosions are kind of weak -- I didn't even do my blurred-edges thingie. But they get the job done:

I've only tested this game on one PC so far, so I apologize in advance if I missed any huge compatibility or performance issues that just aren't showing up on my computer. Also, I haven't tried this code on the Xbox 360 yet, though I am hopeful that it wouldn't be too hard to get it running there, since it doesn't do anything particularly tricky, graphics-wise. I'm not being very careful about memory management, so the 360's garbage collector might have performance issues with my code. I'll gather feedback and do some additional testing, then probably post an updated version in a couple weeks if there are problems that need fixing.

Have fun!

-Mike