Wednesday, January 28, 2009

Card Set Editor

MTG Forge uses the files common.txt, uncommon.txt, and rare.txt to generate the booster packs that are used for sealed deck and drafting. These files can be edited by the user but since MTG Forge has more than 1,200 cards, the job has become nearly impossible. The good news is that I’m almost done with a program that will let you easily edit these files using a nice user interface.

The set editor is almost done but there have been many obstacles. The set editor reads from the three files previously mentioned as well as from cards.txt. Anytime you read or write files things become very complicated.

There are numerous errors that can occur even when the user is trying to do everything right. For example, maybe there is a card name in uncommon.txt that isn’t in cards.txt. This is a major error because cards.txt holds all of the cards information and every card should be in cards.txt. My program checks all of the card names in common.txt, uncommon.txt, and rare.txt and shows the user an error message that they can understand.

I have to say thanks to Rob Cashwalker for the inspiration, there would be no set editor without him. Hopefully I’ll have the set editor done by Friday.


Anonymous said...

I think the idea behind that checks you call referential integrity. It would not be necessary if you use a database system for your cards. Like SQL Server Compact or a simple Access File.

Unknown said...

How would that help? Those data formats aren't portable. My cardset editor was stuck in windows, which I'm not happy about either. The beauty of MTGForge is that it's entirely portable... Java didn't care about LF vs CRLF line terminators, but VB sure did. Mac systems use LF, so when a Mac user submitted files, VB wouldn't read the line correctly. A cardset editor in Java would solve this.

Anonymous said...

You are right. Therefore I always check the line terminator first. Then I simply make a replace() if needed. Okay, I have to admit... I don't really care about portability...

Unknown said...

Yeah, I thought of trying to read the files first in binary mode, to replace the LFs, but it looked like a lot of effort. Forge's original files had CRLFs, because Forge uses Windows. So I instead suggested that we standardize on CRLF. I use Notepad++, so it was easy to convert the files, so I could get on with testing, and Chris (the Mac user submitting files) found a function in his editor to do the same.

Forge - I was noticing in cards.txt some text has a '#' character in it. Do you use the '#' character to indicate a new line in card text?

Milo said...

I might be wrong... but I would like to discuss a supposed bug. First, I'm a great fan of your software and you should be proud of your programming skills.

Well. Down to the issue.

I was playing a Sliver against Sliver deck, and I noticed that the attributes on the computer cards didn't stack with mine, and so on.

Explaining. The computer played HEART SLIVER, it gives ALL SLIVERS HASTE.


When I got to my turn, mine didn't get the Haste that, I am assuming, they should, since mine are SLIVER as well.

I'll be glad if you answer this in email or post (

best regards

Almost_Clever said...

Check out the forum (the MTG Forge - Forum in the upper right). There are posts documenting known bugs and issues. Your issue has been documented already, but if you run into any new ones, you can post them there.

Anonymous said...


I've fixed this for the next version. Currently, all slivers' "boosts" seem to only affect its controller's slivers.

Anonymous said...

So where's the Set Editor?