March 05, 2003

TFD in games

Dan Dunham writes about using the test-first design in game development:
After about two months of looking at bugs in Camelot, and looking over our master bug lists, I realized that ... well, almost none of them could have been caught by unit tests.

So I'd like to tell you about a case of using TFD in game development in which I have participated a little bit myself. When we were starting a St.Petersburg XP Users Group, we were contacted by some guys from MADia, and they told us that they were using XP for game development. Of course, I was really interested to hear about that, so I came to visit them and to see myself what they were doing and how.

By that time, they had just released their first original game, Echelon, and started the prototyping work for a future add-on to the game. One of the things they wanted to rewrite for the add-on was their menu system. The old code was quite ugly and limited, and they wanted to replace it with something that could be easily modified and extended with a standard scripting language. And they wanted to implement that in test-first mode.

I was really interested in getting some experience with XP in game development, so I offered my help with that project, and my Python expertise (which was quite limited, but still better than nothing). We paired with the lead developer of "Echelon" and together created an initial implementation of embedding Python into the game. Unfortunately, timing issues didn't let me continue working together with them, and I have basically lost the contact with them since that time.

A few months ago, the Echelon add-on Wind Warriors was released, and I bought it to see if anything remained of all the Python scripting idea. I was pleased to see that they did bring the Python-customizable UI to completion, and of course, all the Python source code was included with the game. And quite curiously, wherever I looked to read some code, I saw firstly unit tests. :-) Looks like the unit tests comprised about two thirds of the Python code.

It would be interesting to know if they used unit tests in their game logic code, written in C++, and whether they felt much gain from the tests. But still - here is an example of using TFD in games which you can examine yourself.

Posted by yole at March 5, 2003 12:48 AM | TrackBack

I made a comment on Strange Coding (, but no reply yet...

Posted by: Jeremy Dunck on March 6, 2003 10:53 PM
Post a comment