The greatest performance improvement of all is when a system goes from not-working to working.
-- John Ousterhout
Today Cryptic Sea released the source code to Gish after pledging to do so for the Humble Indie Bundle. This is, in a word, frigging awesome!
Wait, that's two words... but that's okay because that's how cool it is!
For those of you unaware (which is to your detriment, I assure you!) Gish is a brilliant little indie platforming game involving a ball of tar, some really weird enemies, a glitchy physics engine, and some really simple multiplayer. That may not sound like much, but this game has actually gotten my friends and I kicked out of a LAN party before because we were laughing too hard. (True story! Embarrassing corollary: the LAN party was hosted at my house. The kicking was done by my wife.) It's available on Steam, and is worth whatever price they're asking at the moment.
At the very least you should check out the trailer.
Now, that's all well and good but what I actually wanted to talk about was the source code. It doesn't take long after beginning to browse through the code to see that the quality of the code is, frankly, atrocious. Magic numbers everywhere, very little in the way of abstraction, little to no comments. In short, it's everything that your CS teacher would have flunked you for.
And this is a good thing!
Why? Primarily because I think that there are a lot of very capable developers out there who will never, ever finish a personal project of this magnitude because we get too caught up in the structure of it all. After all, what use is a graphics engine if it doesn't have a completely abstracted, plugin capable shader system with a graphical designer, right? I've seen indie projects fail time and time again because the developers behind them spent an awful lot of time carefully constructing an "engine" but very little time actually making, you know, a game. Seriously, the Gamedev.net forums are full of 'em! It's kinda sad.
Which is why I think that the Gish code is great. Because it's a project that got finished! Who cares if the code sucks, it's making it's creators money right now. It's being played by gamers right now! How many indie developers can really say that?
So often the code we interact with takes the form of either:
A) A library, whose interface was agonized over and revised by multiple contributors to ensure that it's usable in the most abstract of scenarios or...
B) Some large, popular project like Quake 3 that gets open sourced after years of use by AAA studios that have beat it into shape, and was designed to be reusable from the get go anyway.
And sure, these projects have their quirks and oddities and funny variable names, but they still represent something that is reasonably polished, mostly reusable, and carefully prepped for consumption by others. That can taint our perception of what all code should look like.
The Gish code has very little of that. The creators essentially plucked the code off their hard drive and dropped it in our laps. Not much there in the way of polish. It does one thing and one thing only: Gish. It's not always pretty how it does it, either. But it works, and it shipped. And that is the single most important milestone that any chunk of code can ever attain. Everything else is just a bonus. Gish illustrates that beautifully by allowing itself to be ugly.
Now, am I saying to throw good design to the wind? No, not in the slightest. If nothing else it can save you a great deal of heartache if three months down the road you suddenly decide that gravity needs to be just a smidge stronger and you had the foresight to define it in a constant instead of using magic numbers everywhere. But we should never, EVER allow an overabundance of design to become a roadblock to the finished product.