Wednesday, July 30, 2008

How did you learn Magic?

I learned Magic around 2004 when Darksteel came out. I worked for Rhino Video Games, a small retail store that eventually got bought out by GameStop. We carried a few trading card games like Dot Net and Yu-Gi-Oh. For some reason I remember all the employees got some free store credit, so I spent my on two Eight Edition starter decks. They were the green and red ones and they were great.

I loved the cards and I could sense the underlying strategy. I only played two games of them with another employee until I got hooked on Magic Online. Even though I thought I understand the rules, Magic Online really drilled the rules into my head. Learning all of the intricacies of the combat phase as well as tidbits of information like “lands are colorless” really takes time but it was really fun.

MTG Forge was originally designed to play Yu-Gi-Oh instead of Magic. I had a great Gameboy Advance Yu-Gi-Oh game that introduced me to world of trading card games. And while I never bought a single Yu-Gi-Oh card, it taught me many of the common rules like two main phases and creatures versus spells. And of course I eventually downloaded Shandalar and played it for many, many hours.

How did you learn Magic?

Monday, July 28, 2008

More Magic Programs

For other Magic related program check out this forum.

http://www.slightlymagic.net/forum/

The program Incantus is probably the most interesting and it has the best user interface. It lets you play against another player over the Internet and enforces all of the rules.

Download Incantus for Windows
Incantus Forum

Deck Editor

The one part of MTG Forge that I haven’t heard any complaints about is the deck editor. This fact is very interesting. I’ve had numerous grievances against the user interface, errors with cards, and other things but nothing negative has ever been said against the deck editor.

My theory is that the deck editor is easy to use. It mimics Magic Online’s deck editor, version 2. I worked hard so that cards can be sorted by name, rarity, mana cost, type, or color. It even sorts ascending or descending. The deck editor should be easy to use and it is. Putting together decks should be as fun as possible, even though it is always hard trimming your deck down to 40 or 60 cards.

Getting feedback from the public about a book, movie, or videogame is very interesting indeed. People email their negative thoughts and (usually) not their positive ones. It is often hard to understand what people like about your project.

I just saw the new X-File movie and I was waiting for a something exciting to happen, then I saw the credits. The whole movie seemed to stretch a 5 minute plot into 90 minutes. The negative aspect of the movie overshadowed my joy of seeing Molder and Scully together again.

So let me thank you for NOT e-mailing me about the deck editor. The best pieces of software are often overshadowed and easy to miss because they work so well. I’ve gotten many positive e-mails about MTG Forge. I do know that MTG Forge isn’t perfect but it certainly is “good enough.” If I was trying to make MTG Forge perfect, I would have never gotten it finished.

p.s.
I still never use the deck editor. I’m too lazy, so I just use the “generate deck” option.

Friday, July 25, 2008

What’s your color?

If you have played Magic enough, you probably find yourself drawn to playing one color over another. My color is probably green. I love big, huge creatures as well as mana acceleration. Elvish Piper is one of my favorite cards, even though a mono-green deck isn’t usually competitive.

White is good because of Wrath of God. Black’s iconic card is Terror. Blue mages couldn’t live without Counterspell. And red paladins love Lightning Bolt and Shock.

What color are you?

Wednesday, July 23, 2008

Odds and Ends

In the last two weeks I haven’t worked much on MTG Forge version 2.0. First, I need to write a decent graphical user interface (gui) and then I’ll work on creating cards, etc… I thought about trying to use a video game library for the gui but I get really tired of trying to write my own dialog pop-up boxes (Do you want to mulligan? Yes or No) and other things.

So I’ll use Java and just write a very simple sprite class that will let me draw and moves cards. The gui will be very basic, mana pool and life totals on the left and the rest just shows the game play area.

While I have some great ideas for programming complicated cards, I will start programming 10th Edition. 10th Edition isn’t the most complicated set of cards, it is a good starting pointing. I could try programming a whole block like Shadowmoor that would be a like a beginner trying to climb Mount Everest. First I need to program relatively simple cards and then I’ll do the crazy, insane ones. But this does not mean that I’ll randomly add some cool cards from other sets.

p.s. Hopefully I can program Warp World but I'm not sure.

Monday, July 21, 2008

Hacky Code

The word “hack” has many definitions like a person that breaks into your computer, a “hacker”. But when the word “hack” is applied to source code is has a different meaning. It means something like “This code could be improved but it works so I’ll change it later if I have the time.” A “hack” is similar to duct tape. Duct tape isn’t the best solution but it is a solution.

Many things in MTG Forge are added by “hacks.” Planeswalkers generally work correctly but if two are in play you cannot choose which one to attack. Planeswalkers are a colossal hack. Reach of Branches is another hack. It should return to your hand when you play a Forest but it doesn’t always work. I can’t really fix Reach of Branches because it was hacked already. MTG Forge does well with activated abilities but many other cards effects are “hacked” on.

MTG Forge uses many hacks and this means that it is time for version 2. Version 2 will hopefully implement cards like Planeswalkers and Reach of Branches without having to hack the code. Version 2 will have a dedicated rules engine just like Magic Online.

I’ll close by showing you some Java source code just in case you have never seen any. This is the code for Ancestral Recall (draw three cards). This card was in the first set of Magic cards ever printed and very few people own an original copy.

The computer will play this spell if he has 5 or less cards in his hand, otherwise the computer would play this it on turn one, effectively wasting it. If the computer has 5 cards in his hand, after Ancestral Recall resolves, he will have 7 cards in hand because 5 – 1 + 3 = 7. Minus one for Ancestral Recall itself. I love cards like Ancestral Recall because it is a great card that is simple to program.
//taken from CardFactory
if(cardName.equals("Ancestral Recall"))
{

SpellAbility spell = new Spell(card)
{
public void resolve()
{
AllZone.GameAction.drawCard(getTargetPlayer());
AllZone.GameAction.drawCard(getTargetPlayer());
AllZone.GameAction.drawCard(getTargetPlayer());
}//resolve()

public boolean canPlayAI()
{
return AllZone.Computer_Hand.getCards().length <= 5;
}//canPlayAI()
};//SpellAbility

spell.setChooseTargetAI(CardFactoryUtil.AI_targetComputer());

spell.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spell));

card.clearSpellAbility();
card.addSpellAbility(spell);

Friday, July 18, 2008

How much money have you spent on ONE Magic card?

I haven’t spent much one a single card. Overall I only own about 300 Magic cards. I own all the 8th Edition starter decks, 2 Mirrodon Theme decks, and about 5 random Magic boosters. Even with my small collection, I have all the land I will ever need.

The most I’ve spend on one card is probably about 2 dollars for Vedalken Shackles. It was a Fifth Dawn artifact that cost 3 but had the ability “2, tap: Gain control of target creature with power less than or equal to the number of Islands you control as long as Vedalken Shackles remains tapped.” I bought this the very first day it was released online and the card when up and up in value.

So how much have you spent for a card?

Wednesday, July 16, 2008

Too Much Land

Land is an interesting part of Magic. Too much or too little land means trouble, but having extra land cards in your hand doesn’t help either. Retrace is a great little Eventide mechanic that lets you use those extra lands. (Retrace - You may play this card from your graveyard by discarding a land card in addition to paying its other costs.)

Clash also helps with your land counts by smoothing your mana curve. (Clash - Each player reveals the top card of his or her library, then puts that card on the top or bottom. A player wins if his or her card had a higher converted mana cost.) While you may only win a clash about 25 percent of the time, at least you get to stack the top card of your deck. For better or worse clash also helps your opponent. Clash minimizes the negative aspect of land and smoothes your land counts.

Retrace is probably my favorite mechanic in Magic. Personally I think land is an old, arcane concept that Magic should get rid of. (Many people think Magic should also get rid of haste, but I like it.) I think you should be able to play any card as a land. A green card would be transformed into a Forest. The Marvel/DS VS trading card game does not use land and effectively lets you play any card as a land.

Retrace is good because it turns the disadvantage of extra land into an advantage. Although land is a necessary evil, Magic is still getting better and better. I can’t wait for Magic 2.0 (that’s a joke).

Tuesday, July 15, 2008

Eventide Spoiler

Eventide is officially spoiled you can see checkout the Wizards article here. I also like how this guy makes his visual spoilers.

Monday, July 14, 2008

Version 2.0 now in Java

I’m slowly working on MTG Forge version 2. First I started version 2 in Java, then switched to Python because it seemed so cool, but now I’ve switched back to Java. Python is very, very cool but I keep thinking “in Java”, so one night I got frustrated and said to myself, just change back to Java.

For version 2.0 I knew that I wanted a better user interface, but I wasn’t sure how to draw simple graphics with Java. I switched to Python because I saw a very good user interface written with it. But learning a new language from scratch and trying to program a large program with it at the same time is a little bit futile. It is like me saying, “Why don’t I write a novel in Spanish.” I could write a novel in Spanish but it would much easier if I just wrote in English, a language I already know.

You, the user, won’t notice any differences between Java or Python. Most people just want something that is easy to use, which usually means having an attractive user interface. If you have used other free software, games or otherwise, you will probably notice that most of the time their user interface is a bit lacking and hard to use. As I have said before, writing a good user interface takes a ton of time and effort.

Most of the time one person, or group, will write the user interface and another person, or group, will write the rules engine. A programmer who is good with both the front end, the user interface, and the back end, the engine, is rare. As you might have noticed, most programmers and geeks have a hard enough time dressing themselves so writing a good user interface is pretty much out of the question.

Having a good-looking user interface is like a car with a nice, shiny paint job. The paint job has nothing to do with how the car runs, but it sure does help.

Friday, July 11, 2008

What’s Your Favorite Magic Block?

My old favorite was Ravnica. The mixed-colored theme was great and it had so many playable cards. My new favorite is Shadowmoor and Eventide. With so many hybrid cards, like you can pay W or G, you have tons of useable cards.

I consider myself a limited player so I prefer sealed and draft. I am curious how the Time Spiral block plays in limited since the card pool is so large. What’s your favorite block and why?

Wednesday, July 9, 2008

Wish List

I have delusions of grandeur. I imagine MTG Forge with undo and when the mouse hovers over a card, all of the legal targets would be highlighted. The user interface would look exactly like a real card table, complete with a red zone for attacking. Each card would be perfectly rendered to look like a printed card, even when abilities were added or removed. And MTG Forge would include every Magic card ever printed, so you could play any format that ever existed.

I imagine there would be some sort of RPG where you begin with a starter deck and then you battle to become the World Champion. You would earn money and cards by competing in constructed, sealed, and draft tournaments. The tournaments would have multiple rounds and you would have to win each one. Tournaments would have random requirements like no forests, or you must use only creatures or islands. Obviously the deck editor would have to support sideboards since sideboarding in tournaments is almost an art form. MTG Forge would keep your Magic rating and it will be close to your DCI rating.

The AI would be very tough. It would analyze your deck and determine the best way to beat you. The AI would mercilessly beat you again and again. Your Magic skills would improve with time, but playing a pro tour AI would certainly make you black-and-blue. The AI will draft realistically and try to cut your colors. The computer might switch colors midway through the draft just to mess you up. It would also excel in sealed deck tournaments. The AI would be good enough to win pro tour tournaments.

Obviously dreaming is easy and programming is hard, but I keep doing both. --Forge

Monday, July 7, 2008

Undo

Mmmm…Mountain Dew is very good. Maybe I could code without it, but I would hate to try. I have this idea for a story: the whole world blew up and there is only one can of Mountain Dew left. I don’t know what the plot would be but it still sounds cool.

Ok, back on topic, undo. The undo feature is probably the most important computer invention since the mouse. Undo is easy to understand but hard to program. I’m not saying that undo is impossible but it is certainly tricky at best. Adding undo is like saying, “Let’s redo the foundation of this house.” You can redo the foundation but it basically means that you have to tear down a lot of stuff in order to do it.

Undo is one of those thorny features that effects the whole program, a program has to be written from the ground up with undo in mind. Hopefully MTG Forge version 2 will have undo. Undo would also help the computer AI. The AI could play a few cards and then determine which card would be the best to play.

And while MTG Forge currently doesn’t have undo, it does let the user cancel most actions. Even though the cancel button seems unnecessary, I often use it. I played through the Marvel Trading Card Game on PC and would you believe it, there was no cancel button. If you clicked on a card that had a legal target, you HAD to play it.

Needless to say this was very, very annoying. It was like the game was working against me. I played on despite the annoyances and then got stuck on the last boss. He started with a huge creature in play and I had no idea how to defeat him. I wanted to Terror it but couldn’t. Anyways, keep tapping those cards. --Forge

p.s.
I posted a picture of a Japanese card just for fun, the English picture is here.

Friday, July 4, 2008

Monday and Wednesday

In case you haven't figured it out, I try to post something new on Monday and Wednesday, anything more than that really wears me out. My posts are typically short, ranging from 150 to 500 words and even 500 words is pushing it.

I hate reading really long Magic articles because I'm tried by the time I get to the end. It seem weird that I'm posting something on Friday that says I'm going to only post things on Mon and Wed, but you get the idea.

Eventide card's are currently being spoiled and checkout Primalcrux. I guess with 6 green mana symbols in the cost Wizards is saying "Play this only in a mono-green" deck, lol. Checkout more Eventide cards here.

Thursday, July 3, 2008

Contribute Code

I'm not sure how this is going to work, but I just created a new project on Google. The homepage is here. You can download the latest version and the source code.

If you want to be part of the project, you must create a Google account and then e-mail me (Forge) saying that you want to be part of the project (mtgrares yahoo com). If you want to make any changes to the source code, read the wiki page that I wrote about source code control. And in case you didn't know, all of the source code is in Java.

I didn't name the project "MTG Forge" because I wanted to avoid using the abbreviation MTG, which seemed to cause me previous problems.

Wednesday, July 2, 2008

Compile versus Runtime

First, let me define the terms compile and runtime. Transforming a programming language, like Java, into an executable file is called “compiling.” Runtime is when the program is actually running on your machine. For further details see the Wikipedia for compile time and runtime.

For programmers there is a constant battle going on. The battle is this: should the logic of a program be specified at runtime or compile time? Specifying compile time is easy. Below a tax variable is created, this is an example of compile time.
float tax = 6.5;
Runtime code would read the tax variable from a file. Runtime code is more flexible but harder to write. The runtime code would also require additional error checking to see if the file exists, see if the number is valid, etc...

Most programs use both compile and runtime code. At runtime MTG Forge reads a list of card names, mana costs, and text from the file “cards.txt”. Recently someone e-mailed me and said that Sprout Swarm should be an instant. All I had to do was to change it in the card.txt file, nothing else had to be done.

While it would be easy for a non-programmer to say that all variables and logic should be specified at runtime, it is not feasible. Some parts of a program, like the tax variable, might change in the future so it should be created at runtime. It is a design decision whether to make the code runtime or compile time.

I use the file “cards.txt” for convenience because it allows me to easily add simple creatures. Simple creatures are creatures that have a keyword like flying, haste, or landwalk. MTG Forge uses card.txt to make creatures at runtime. All activated abilities and sorceries/instants are created at compile time.

Keywords that cards.txt recognizes. All the keywords have to have this exact spelling, with Haste being capitilized and "tap: G" having only 1 space after the colon.

Mountainwalk
Forestwalk
Islandwalk
Plainswalk
Swampwalk
Indestructible
Defender
Fear
Flying
Haste
tap: add 1
tap: add B
tap: add G
tap: add R
tap: add U
tap: add W
This creature can block as though it had flying.
This creature cannot block
Trample
Unblockable
Vigilance