Wednesday, October 15, 2008

More Plaintext Cards

Version 2 is progressing nicely and I although I haven’t gotten to the point of actually programming cards yet I have a set of 10 cards that I am refining on paper. I’m going to only show you 4 of those cards because I don’t want to bore you.

Writing cards in this format is easy and even nonprogrammers should be able to add a card or two. All the cards will be in one directory and each card will be in a separate file. So if someone else writes a card, all you have to do is download the file and put it in your card directory.

It seems like I could write a simple Card Maker application that would check your card text for errors and would allow you to choose the target and resolve from a list of all available choices, without making you cut-and-paste. The card format below won’t work for all Magic cards but it will work for most of them.

p.s. I put extra information at the end of the resolve text after the comma. You should notice that both Shock and Prodigal Pyromancer share the same targets and resolves, my heart jumps with happiness, code reuse is good.

Shock.txt
Shock
R
Instant

Spell
Text: Shock deals 2 damage to target creature or player.
Target: creature or player
Resolve: damage target creature or player, 2

Prodigal_Pyromancer.txt
Prodigal Pyromancer
2 R
Creature Human Wizard
1/1

Activated Ability
Text: tap: Prodigal Pyromancer deals 1 damage to target creature or player.
Cost: tap
Resolve: damage target creature or player, 1

Venerable_Monk.txt
Venerable Monk
2 W
Creature Monk
2/2

Triggered Ability
Text: When Venerable Monk comes into play, you gain 2 life.
Trigger: comes into play
Resolve: gain life – controller, 2

Holy_Strength.txt
Holy Strength
W
Enchant Creature

Static Ability
Text: Enchanted creature gets +1/+2.
Effect: enchanted creature gets, +1/+2

Monday, October 13, 2008

AI and Limited Decks

While constructed decks are very focused, limited decks are not. Limited decks tend to be composed of good cards with a general theme. Limited decks tend to be more generalized because they rely on a mix of creatures and spells. The AI is very good at playing creatures since it just plays the biggest one and then attacks with it. I feel that the AI’s attacking and blocking strategy can be greatly improved in version 2.

So if MTG Forge is a limited simulator why does it matter? In case you forgot, the most important cards in limited are the commons, so I plan to program more commons in the future.

Commons are the least complicated cards, thus making them the easiest to program, and I plan to start with the commons of the Shards of Alara. (Everyone loves new cards, even programmers!!!) I’m not saying that I won’t program any uncommons or rares, I’m just saying that I will focus on the commons first.

And to tell you the truth, the effects on the common cards don’t give me nightmares like the rares. Programming one replacement effect is easy enough, but having multiple replacement effects is downright confusing. Most uncommons usually can be added with a little bit more effort. The fact of the matter is that it still takes loads of time and energy to program Magic cards, even the simple ones. If someone ever programs a whole block, bless his weary soul.

Friday, October 10, 2008

Computer Programming Comics

I love computer programming and comic books but those two passions don't usually intersect, but today they do. Recently, Google wrote an Internet browser called Chrome. Instead of using a boring press release to describe Chrome's features, Google decided to use an online comic book. The comic book is very funny, smart and easy to read. Programmers and non-programmers alike will laugh.

Chrome Comic Book

Wednesday, October 8, 2008

What is MTG Forge's Goal?

Recently I kept asking myself this question, “What is the real point of MTG Forge?” Is MTG Forge trying to help people learn more about the rules? (Originally I envisioned MTG Forge as more of an interactive rulebook than a videogame after reading a question someone submitted about Mirrodin’s new equipment subtype. The person totally misunderstood the idea of equipment.) Obviously, one of my goals was to simply play a game of Magic but to what end? Was MTG Forge trying to be a tournament simulator?

In my head I have always thought of MTG Forge as a limited simulator. I believe MTG Forge could really shine in sealed and draft games. MTG Forge will always essentially be a little bit weaker in constructed games since they have very focused decks that execute a specific plan which require playtesting in order use correctly.

The computer AI will not have the luxury of playtesting like a human player and the computer will try to compensate by playing the deck as good as it can but the AI won’t follow deck’s overall game plan. Granted, specific AI’s could be written to play specific decks or types of decks which would improve the AI’s performance.

Join me next time as I continue my discussion of how MTG Forge’s uses limited decks, thank you and good night.

Monday, October 6, 2008

MTG Forge Forum

I’m glad that MTG Forge has its own forum thanks to Slightly Magic. And thanks to some fancy programming, they even have a feature that displays the card text when your mouse is hovering over the card name. For example if you move your mouse cursor over the text “Ancestral Recall” it will show you the text for that card, very cool indeed.

On MTG Forge’s forums you can discuss anything about the program. I have posted a master list of all known bugs and other people have posted bugs also. The deck sub-forum is getting quite popular. The beta version of MTG Forge lets you import or export a deck, so people are posting their decks.

I have posted 2 decks: a Black Vise and an Akroma, Angle of Wrath deck. Posting your own deck creation is pretty fun and I would encourage you to participate. I even asked for a 5 color, 60 card singleton deck and someone posted one for me, thanks Gando. So checkout MTG Forge’s forums and have some fun.

MTG Forge Forum
Slightly Magic Forum

(Slightly Magic holds all the forums and MTG Forge has its own sub-forum, got it?)

p.s. Slightly Magic’s forums also have many other Magic programs like Incantus if you want to read about them. There is also the HQ Project which aims to provide high quality picture scans of all Magic cards in existence, which is quite a task considering there are about 10,000 cards not including promos. It is fun to download all the token pictures and look through them.

Friday, October 3, 2008

OCTGN - Card Playing Software

There seems to be many trading card game projects floating around the Internet. I thought I would have heard about most of the major projects, and maybe I have, but here is another project called OCTGN which lets you play card games against other players over the Internet.

OCTGN supports Magic and major a few other cards games, although the documentation is nonexistent. I presume it does not enforce the rules but I could be wrong, again there is no documentation. It does support Two-Headed Giant would should be some fun, below is a screenshot. You can find more information by searching Google for OCTGN.

Main OCTGN Site
OCTGN Blog

Wednesday, October 1, 2008

Random Thoughts About Version 2

I don’t have anything specific to write about today. I’ve done a lot of work on MTG Forge version 2, mostly “background code” that handles mouse clicks and stuff that is taken for granted. Thankfully the background code doesn’t usually have to be updated, so once it is written, it works.

The user interface for version 2 is working. It looks exactly like the current user interface but it uses abstract interfaces for the visual components (see the previous article). Some of the basic components like how I handle the mouse are the same as version 1, I still use the Input class.

I have all of the dialog boxes working. Dialog boxes are the popup boxes that ask you “Do you want to pay 2 life?” Yes or No. I have dialog boxes that show one card, many cards, just to show a message and one that shows a message with the yes/no button. The dialog boxes are a good example of background code.

I first started on working on MTG Forge version 2 over a year ago but I’ve only worked on it off and on. Over the last few days I’ve worked on it like a madman at 2am, 4am, and 6am. Currently version 2 is 131 KB of code, while version 1 weighs in at a hefty 1,000 KB. You have to keep in mind that version 1 probably should be 50% smaller if all of the redundant code was removed. (I would tell you the number of lines that version 2 has but I would have to write a small program and I’ve kind of burned out at the moment.)

Right now version 2 has working life points, mana pool, and board (the zones your hand and in play). Also the mouse click event works when you click on the life points, mana pool, or a card on the board. The “card detail” window on the right also works.

The next step is to get the user interface to cycle through all of the phases and to allow the user to select which phases to stop. Hopefully after I do that, I can actually program a card or two. I really want to just program cards, all of the background code is just laying the foundation. I’m going to lay a solid foundation so I don’t have to ever touch it again.

p.s. Version 2 will have ALL of Magic’s phases, so you can stop whenever you want to.

p.s. You can check out a visual spoiler of Shard of Alara here. We can all drool over the mega rares, lols.