Thursday, May 3, 2007

Programming Environment

I programmed using JBuilder 7, circa 2003, that used Java 1.3. It worked fine, it was fast and my computer was not top of the line either. JBuilder 7 did well at most things, but it didn’t off packages, yes all your classes were in one long list. At first this didn’t bother me, but later it was too much. My program had 118 classes and 700kb of source code. It is hard to visualize 700kb but written out it would be the size of a thick 500 page novel. Backups were made just zipping up all the source code. No standardized testing was done, but testing was done ad hoc when there was an error. Not knowing what to do with errors, I usually just threw a Runtime Exception with a message about the problem, which is not very friendly but what are the alternatives?


wingsofseraphim said...

This seems like a strange coincidence. I just started thinking about programming a Magic the Gathering card game recently as well. I'm curious how you were able to get some of the abilities to work and how your classes worked? You mentioned having over 700 Classes. Did you have one for each card? The game is definitely very fun. I started doing it in OCaml. That's my programming language of choice, although I do have some experience with Java. Is the code available on Sourceforge? I would like to take a look at how you did this.

Forge said...

All the code is available at SourceForge, but not in the CVS. The source code is in the zip file that you can download, not the exe.

I got spells/abilities to work by making them one class.

class SpellAbility
abstract void resolve()

Every spell or ability had to override resolve(). All the game zones like "cards in play" were global variables.

I'm glad you enjoy it. I play it almost every day. I love the "generate sealed deck" option.

I think every programmer thinks about "programming Magic." Currently I can only program a few cards. I'm working on version 2.