« GBA Movie Player - review | Main | Terminology that isn't obvious »

October 04, 2004

Everybodies code sucks

A good friend of mine, Jon, who was there in my formative years as a professional programmer, has just blogged a great link by Dave Astel: Why your code sucks. Basically there are a bunch of reasons that peoples code can be considered as sucking (read Daves blog for the details)
How does this relate to games development ? Pretty much all game code sucks :-) Although I have come across some amazingly beautiful snippets of code, the majority is poorly put together, badly documented, hard to test, not working, etc.
I can hear the cries now of "deadline pressures", "performance issues" and other reasons as to why code sucks - but thats no reason not to strive for a better programming world.

Let me say this first, My code sucks. I'm a self-taught programmer for the most part (Uni taught me lots, but by then I had been programming for 5-6 years and had bad habits!). I've also stopped programming full-time since becoming a producer, so my code is even more hacky than before :-)
I have a book on my bookshelf, "Games for your TI99/4A" which contains my first ever published games (back in 1983/4) - a quick scan of the source code in that book reminds me how far I've come, but also to remind me that code I think is fantastic will, in hindsight, turn out to suck :-)

As a Producer I get to see things from a different viewpoint. Bad code has terrible consequences for a team (even if the individual can't see it). I've seen code thrown away because nobody could understand it, I've seen duplication of code and effort by programmers who didn't communicate and realise they were writing the same functionality. Worst of all (IMHO) is the code that cannot be debugged by anyone other than the original author, and cannot even be tested because the work it does is unknown.

Then again, there are real-world considerations to be made. We're in a business, we need to make money to survive and that means finishing a project. Finding the balance between 'perfect' code and 'damaging' code is difficult and almost impossible to define. Show any good programmer a reasonable sized block of code and they will be able to show you how to improve it. The question is a balance of resources between creating the initial code, making it less and less sucky, and getting on with the next bit of code so that the game gets finished and you get paid.
One of the things I like to see is the occasional (and appropriately timed) rewriting of important sections of code in a game. This is usually limited to 2-3 weeks work (for one person) and the condition is that it must replace the existing code with the same functionality (very important). We don't do this very often, but when we do it's usually a great move and pays for itself many times over.
I'm proud of my sucky code (there's code in our systems that I wrote 4-5 years ago that has no right to still be alive). I am even prouder when someone gets the chance to go over the code and improve it, bringing it into the 21st century with all the trimmings of professional code development.
Those people that are better disciplined than I are able to start their first version of their code in a much better state, and everyone is better for it, but it's worth remembering that it's always going to suck :-)

Don't get too attached to your code, accept that it's the idea behind the code thats cool and elegant - the implementation can always be improved.

Posted by Zaph at October 4, 2004 08:36 PM

Trackback Pings

TrackBack URL for this entry:
http://www.torps.com/cgi-bin/MT-3.01D-full-en_us/mt-xtbx.pl/22

Comments

Hi Zaph
i am part of a gaming community that plays GP500 which is an incredible game.I have played this game for about 5 years now.I have seen and have been part of the many changes to the game which we can do,but there are limits to what we can do.We have numerous different bikesets and numerous updates for various parts of the game.I was wondering whether you could find it in your heart to release the source code for the game as we believe we could continue to make this game even better than it is today.here is a link to our website take a look at what we have achieved http://www.gp500store.co.uk/
your help would be greatly appreciated by everyone .thanks for listening,
G.Hughes (sonicgaz)

Posted by: Gary Hughes at October 17, 2004 09:34 PM

Hi Gaz,
I'm glad there are still Gp500 fans out there - it's amazing that the game still stands up today compared to much newer stuff.
Sorry, but the rights to GP500 belong to Hasbro, and the added complication to that (even if Hasbro/Atari wanted to release it) is that being a licensed game it has gone past the life of the license, so nothing can be released (as far as I know) since the license rights are no longer held by Hasbro/Atari.

Zaph

Posted by: Zaph at October 17, 2004 10:23 PM

Hi Zaph
just to let you know that we are making a lot of progress without the code m8.we have been able to add new tracks into the game with a lot of hard work and effort from a lot of the guys in the gp500 community.Thanks for your answer and im sorry i could not reply sooner as i am swamped out with my work.I also managed to contact atari directly and at this moment waiting to hear from them,im not gonna build my hopes up,but it was nice of them to spend some time chatting with me about the game.anyway thanks again zaph,hope to speak to you again.

Posted by: Gary Hughes at July 19, 2005 10:31 AM

Post a comment

Thanks for signing in, . Now you can comment. (sign out)

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


Remember me?