Code Comments and 5WH

Comments in code, you can’t live with ’em, you can’t live without ’em. Depending on who you ask, comments are a crucial form of documentation without which most source code would be unusable. Others might say that code comments are, at best, an administrative nuisance or, at worst, dangerously misleading as they inevitably lose sync with the source code they purport to clarify. Reality, of course, lies across a spectrum between these extremes. Code comments, in-and-of-themselves, are neither helpful, nor hurtful. It’s the content of the comments themselves and how they relate to the reality of the source code itself that makes them valuable (or potentially harmful.)

If you’ve attended elementary school in the States, you should be familiar with 5WH, the building blocks of questions: Who, What, When, Where, Why and How. These six words cover the gamut of questions you can ask and provide structure to information sharing. So, what happens when you apply these questions to comments in source code and use them to direct the information you need to share?
Continue reading

More Fun with SpriteFonts

A while ago, I posted about pre-rendering text to improve runtime performance when using XNA SpriteFonts. Since then, I’ve managed to complete a game (Robot Legions, currently up for peer review) using my XNA codebase and got to try out my text pre-rendering solution in a real project. It worked out pretty well, but there were a few features that I wished I had implemented ahead of time. Well, while Robot Legions was being play-tested, I went ahead and implemented some of those features. Now I’ll describe those features and share a bit of (hopefully) helpful code that will let you use them in your own games. Continue reading

On Game Music

You know, there is some really great game music out there. Really memorable stuff that can instantly transport you to a different state of mind.

Here’s the thing though. While talking with some fellow game devs the other night, we got onto the topic of old 8-bit / 16-bit era chiptunes and how great we thought they are. Then, we started talking about how, despite all the iconic tunes we could remember from that era, we couldn’t think of nearly as many great examples of video game music from more recent games.

That got me wondering. Why did we have so many fond feelings for the game music of yesterday, but not nearly as much for the music of today’s games? Is it just nostalgia at work, or is there something else at play?
Continue reading

Using CLRProfiler to Take Out the Trash, Part 2

In last week’s post, I described how I used CLRProfiler to identify a couple parts of my code that were producing garbage every frame. One related to equality comparisons with my ActorState struct and another involving System.Objects being produced when I called RuntimePropertyInfo.SetValue(). This time, I’ll talk about what I did to fix those two problems. Continue reading

Using CLRProfiler to Take Out the Trash, Part 1

As cutesy as it may be, I’m growing rather fond of my garbage collection count display. I’m especially fond of it because it helped me find garbage collections occuring in places I never expected them to happen. Such as my title screen for example:

Ack! Look at all those garbage cans, I mean recycling bins (reduce, reuse, recycle, folks!)

That’s a lot of garbage collections for a “static” title screen. Now, how to find out what’s causing all that garbage to be created… That’s where Microsoft’s CLRProfiler comes into play. Continue reading

Improved Memory Usage Display

In a previous post, I talked about how I added basic memory usage output to my frametime debug display. I also mentioned the major problem with that system being that the debug output I used allocated memory, causing garbage collections to occur. This constant change in memory usage naturally made the output hard to read. As I was writing that post, I had an idea for how I could easily solve that problem which I will share with you now. Continue reading

Announcing… Robot Legions for Xbox Live Indie Games

After a brief stint in iOS development, I’m back to my Xbox Live Indie Games ways. For some games, you really need a physical controller in order for them to feel right. That feel is something I’ve really focused on in my latest project.

Robot Legions is a new twin-stick arena shooter for the Xbox 360. It features several different enemy types, each with unique behavior. As players defeat enemies, they will collect cash that they can use to upgrade their defense and firepower. The game also features several special feats to accomplish for players who want an extra challenge. Continue reading