Monday, September 14, 2009

Pros of MTG Forge

I'm going to roughly outline the pros and cons of my program MTG Forge. (I'll do cons next time.)

MTG Forge has many strong points including the AI. Even though the AI wouldn't win a Friday Night Tournament, the AI is competent. (AI is similar to a special effect for a movie, it is just an illusion, that guy isn't really on fire.) MTG Forge has a large number of cards, more than 1,800 and includes many planeswalkers. The deck editor is also fully integrated and easy to use.

MTG Forge supports sealed deck, drafting, and a quest mode where you start with a limited number of cards and you have to play matches in order to win more cards. You can also edit the cards that are used to create the booster decks. Recently I talked about how MTG Forge "scripts" cards using the file "cards.txt" which I think is a major innovation and in the future I would like all cards do be "scripted" or reduced to plaintext instead of hardcoded with Java.

And I almost for one of my favorite aspects of MTG Forge, the "Generate Random Deck" feature. I absolutely love playing with and against random decks (I don't really like building decks most of the time, I would rather just play.) Hopefully I can improve the AI in order to make the game more challenging. I really like the idea that MTG Forge can help you improve your Magic skills.


Forge said...

This article isn't technical at all. I thought about trying to do a brief overview of the important Java classes like Card, SpellAbility, and Combat. It is hard to guess which topics are interesting :)

Karnblack said...

You're doing a great job with this program. Are you the only one working on it? I'm amazed at how much it has grown in the past couple of years.

When I originally tried it out a couple of years ago I thought it had potential, but after I tried out the latest version a few days ago I just can't stop playing.

I like how you've gone to scripting the cards. I played a little with Lua, and it's a lot more fun to script than to least for me.

I wish I had time to contribute. Maybe in the future. In the meantime I'll check out the forum. Keep up the good work!

telengard said...

I have a random warband generator (same idea as a random deck) and yea it's fun!

I also use it for automated testing by continually creating random warbands and having 2 AIs play them. Works pretty well.

At some point I'd like to do a "sealed" type of warband generator.

Marek14 said...

I also agree that the random deck is fun, but I am a bit concerned that it doesn't generate everything... I only ever saw monocolored cards in it.

I think this part could do with some enhancing. Ideally, it might work like this:

You set a number of colors set. (1-5, maybe for larger number of colors you could start with more life to compensate for awkward mana base?)

You set a deck size. If you want random fun, why constraining yourself to 60? Also, this increases probability you get something really good, and thus the power of tutor effects (which, however, still won't be as strong as constructed).

You generate a land base. (You COULD have a settable percentage of lands, but usually you will want to go with 1/3, I guess). Although it's called "land" base, in practice it includes every card that can generate mana without costing any, most notably Moxes, but Elvish Spirit Guide might qualify as well. I guess that what you COULD set would be how many of the slots availaible HAVE to be basic lands, i.e. if you want nonbasics to be common in the deck or rare. Maybe this would be a fixed number, maybe just probability (so the actual deck could end up with less or more). Percentage of snow-covered basics is another possibly settable number.
Now a land base file comes into effect. Basically, each land base card has defined where it is playable.

For example:
Adarkar Wastes ; WU

You only want to play Adarkar Wastes in a deck that plays both white and blue, since otherwise it's worse than a basic land.

Crosis's Caldera ; UB UR BR
Crosis's Caldera adds three colors, so I guess it's playable in any deck that includes at least two of those.

Mox Emerald ;
Mox Emerald is playable even if your deck doesn't play green, since it's acceleration.

City of Brass ; WU WB UB UR BR BG RG RW GW GU
The general rule of thumb is that a land producing more than one type of mana is useful if a deck plays at least two of those. Thus, any two-or-more-color deck can include City of Brass.

So the first parse of land base file creates a land base for the specific color combination the deck will play. Next, cards will be randomly selected from it to build the base.

Marek14 said...

The final part is to select the spells.

A very similar approach to land base can also work here. Every spell is marked by what kind of deck it can be used with. This is usually determined by its color, but there are exceptions

Grizly Bears ; G
Obviously, you need green deck to play Grizzly Bears

Watchwolf ; GW
And equally as obviously, your deck must play both green and white to play Watchwolf

Ornithopter ;
While Ornithopther has no requirements at all.

Kitchen Finks ; G W
Kitchen Finks, as a hybrid card, requires you to play green OR white, but you don't need both

Bant Sureblade; GW WU
Similar principle, you need white, but another color is a choice.

Bant Battlemage ; GWU
Bant Battlemage COULD be played in monowhite, but would you ever want to? To use it, you want at least two colors, but ideally all three.

There is some space for debate, for example whether to allow any deck to play Gathan Raiders or limit it to red, or whether have Whip-Spine Drake as "W U" or as "WU" (whether he's useful enough in monocolor). I'd usually go with the harsher requirements. Also, sunburst might be a question: how many colors do you have to play so you could be given Suncrusher? Would you want to require five-color deck for that?

So, what do you think? If this was implemented, the only external part are the files detailing use of cards, and I would be willing to write those...

Forge said...

Thanks for your suggestions
Marek14, there are many things that could be done to improve the "Generate Deck" option. I personally wish it would create a deck using a mana curve (that maybe the user could set) so that your deck wouldn't be completely random. The Generate Deck option doesn't include any multi-colored cards.

Forge said...


Hopefully you find many errors with the AI playing itself. For MTG Forge version 2 I'm planning on letting the AI play itself in order to "evolve" a better AI and to find some nasty bugs, which are very annoying if a player finds during an important game.

Forge said...

Karnblack, "You're doing a great job with this program. Are you the only one working on it? I'm amazed at how much it has grown in the past couple of years."

Thanks, in 2007 MTG Forge had 400 cards and now it has over 1,800. There are about 2-3 main coders and about 2-3 other people who contribute smaller bits of code.