Wednesday, June 18, 2008

Confessions of Blogger

I wanted to talk a little about the history of this blog. I started this blog about 14 months ago and I remember being disappointed when I was only getting 5 hits a day. Nowadays I’m up to 100+ hits a day which is phenomenal. I remember wondering should I stop blogging, since no one was reading it.
I’m probably the worst blogger ever. I don’t read any blogs and I write about the boring subject of computer programming, although I try to spice it up by talking about Magic, lol. Most blogs talk about too many subjects or at worst, just random thoughts. I try to make this blog very focused, just programming and Magic. A few “miracle” articles combine both topics, but sometimes I’ll write about just programming or Magic. Hopefully my programming articles are still interesting to my non-coding readers. I think programming is fun, so I try to make it sound fun.

This blog is also an extension of my program MTG Forge. It is a “behind the scenes” about programming Magic cards and artificial intelligence. MTG Forge has gotten people working on their own projects, which was one of my goals. Part of me feels like a “crazy scientist” that writes this program in his kitchen (I don’t have a basement) and then unleashes it on the world.

I like giving away the source code even though I know it isn’t really usable to anyone else. Trying to modify some else’s code is like trying to add a chapter into a book that is already written, you can do it, but it is very hard.

Hopefully small pieces of my code, like the Card and SpellAbility classes, make sense. So you don’t have to understand the whole project, you can just look at some of the pieces and use them in your own project if you want to. And if you are very brave you can look at CardFactory. CardFactory is so horrible, weird, and messy that it is almost beautiful.

In a way CardFactory is my masterpiece. A normal piece of code, called a “method”, is 5 to 30 lines long. CardFactory has a method that is more than 10,000 lines long. CardFactory actually creates all the cards, so a lot of “voodoo” happens there. Each planeswalker is about 200 lines of code. That is why MTG Forge currently only has 3 out of 5 planeswalkers, they are a ton of work.

So in closing, I wanted to thank you (the readers) for making this blog successful. At last count MTG Forge has been downloaded more than 10,000 times, but this number is 6 months old. (I don’t have a way to track the number of times my program is downloaded.) And hopefully one day I’ll build an AI (artificial intelligence) that is unbeatable ;)

9 comments:

  1. Who says computer programming is a boring topic? I'm thinking of following your example, and making a programming/SWCCG blog (once my exams are out of the way).

    Keep up the great blog!

    ReplyDelete
  2. Hello.

    Magic is great. Programming is great. What is boring about your blog? hehe

    MTGForge has an IRC?
    MTGForge2 has a CVS/Subversion?

    ReplyDelete
  3. Hey, I've worked in many other people's code, sometimes code written by non-english-speaking programmers.... (if, then, else in "english", but variable and function names or comments in spanish... NOT easy) Your code is fairly straightforward.

    CardFactory is a mess, and I'm starting to fully realize the up-hill battle of being maybe just too complicated to make generic. I might be better and faster at adding cards to Forge by copy and paste old code just like you... but I could focus on it.

    ReplyDelete
  4. Hi. I very much appreciate MTG Forge and all of your effort that it represents--even though the AI isn't finished yet, your free program is immensely more fun than marking up two decks of cards and pretending they're MTG cards and playing against myself. I can't wait to see Forge and the new interface!! I just had a few questions about Planeswalkers while fooling around:

    * Are Planeswalkers truly Legendary? They act like they are, but someone told me they technically aren't.

    * Are you really allowed to use the ability of the Planeswalkers during both your turn and your opponent's?

    * In the dialog box of the Planeswalkers, could you please add a 'Cancel' button?

    ReplyDelete
  5. I like to read about computer programming but not enough people write about it.

    I don't know of a IRC channel, but you can start one up if you want to. I'll probably put MTG Forge version 2 using Google Projects (its like Sourceforge).

    ReplyDelete
  6. Sorry Rob Cashwalker, CardFactory is a wonderful disaster. I think it is hard to copy object, I guess you could try cloning them "clone()", so I just create a new object each time instead of cloning objects. MTG Forge version 2 will put each card code in a separate file.

    Just cut-and-paste in CardFactory no one else is ever going to touch the code anyways.

    ReplyDelete
  7. Let me try to answer your planeswalker rules. You complete rules are here

    http://wizards.com/default.asp?x=magic/rules/planeswalkers

    1. Planeswalkers are NOT legendary, but I the legendary rule was already programmed, so I just used it to make Planeswalkers unique while in play.

    2. Technically you can only use their ability during your turn, but I think MTG Forge doesn't enforce that.

    3. Hm..I'm not sure what dialog mentions planeswalkers, you have to be more specific.

    I hope that helps, Forge

    ReplyDelete
  8. I think Forge definitely enforces the your turn only aspect, because it does act like a sorcery. I know I've tried to use it twice in a turn, and couldn't. I don't think I've TRIED to use it on the computer's turn, but I have tried activating in response, like an instant, and couldn't. Which is what leads me to think it's checks for sorcery speed legality, which would prevent it from working on the other turn.

    The dialog in question is when choosing a planeswalker ability. You can't cancel out of it, you HAVE to select one of the abilities. I've accidentally clicked the card, brings up the dialog, then stuck choosing an ability I might not otherwise have... like I realized I wanted to wait until Main2.

    ReplyDelete
  9. Thanks Rob Cashwalker about the planeswalker dialog. Hopefully I can fix that. In MTG Forge version 2 I'm planning on having an "undo" button which lets you fix you mistakes. I figure purists don't have to use it and everybody else will.

    ReplyDelete

Note: Only a member of this blog may post a comment.