Monday, August 18, 2008

Inspiration and Source Code

I am very impressed whenever someone leaves a comment like “I liked MTG Forge so much that I am working on my own implementation of Star Wars.” Hopefully that person spawns another computer programming project and the whole community is better for it. I always considered imitation the sincerest form of flattery. I would love to play computer simulations of other trading card games.

I’m also glad that MTG Forge’s source code is inspirational. The source code is almost 1 MB in size with CardFactory taking up 50% of the total length. (CardFactory is so long because it holds all of the code for the cards.) Some parts of the code are easy to understand like the Card object. Other parts of the program are a little harder to figure out, like Input which processes all of the mouse events, like clicking on a card. Unfortunately the source code is undocumented and only has a few comments here and there. Thankfully MTG Forge can be updated, like the new user interface if you downloaded the beta version.

The software architecture was literally built from the ground up. I had a vague goal in mind, but not a specific plan. I did build two or three previous versions that had too many problems so I had to start over. Other than using global variables, MTG Forge’s architecture is pretty good. I tried to write flexible code that could be changed later, like writing a Combat class so I could add a second combat phase when planeswalkers were introduced.

As always keep programming,


Anonymous said...


the creature cards you posted here recently... which edition are they from?

Can't identify the edition symbol. Seem to be foil, though.

Anyway... great Blog! Keep on posting and programming!


Gando the Wandering Fool said...

"the creature cards you posted here recently... which edition are they from?"

They are from the forthcoming dragons boxed set that is coming out for the 15th anniversary of something or other...(cf: the wizards site)

Good job so far MTG Forge, Keep it coming :D

Anonymous said...

forge, please comment the code in version 2. Not pointless comments that can be figured out without comments, like

//adds 2 to i

but comment entire classes on their purpose and what the purpose of the entire algorithm inside a method is.

Forge said...

I try to write comments that I would want to see. Overall comments about the general function of a class or method really help out also.

I like posting random Magic card pictures, usually from the new sets. You can checkout the set of new dragon cards, here.