Page 1 of 1

Help with adding new card sets

PostPosted: 04 Sep 2011, 14:03
by dfh30012
Hi there!

I recently heard of MAGE, checked it out and found it very promising. After a bit of experimentation I managed to get the project to compile, and started adding some new cards to existing sets. Everything worked out fine until I tried adding a new set (classic sixth edition). The new set shows up in the Deck Editor drop-down, but the card list is empty.

What steps am I missing? Here's what I did:
- Added Mage.Sets/src/mage/sets/ClassicSixth.java, with shorthand "6ED" and package mage.sets.classicsixth
- Added folder Mage.Sets/src/mage/sets/classicsixth
- Created a new card in Mage.Sets/src/mage/sets/classicsixth
- Added addSet(ClassicSixth.getInstance()) in Mage.Sets/src/mage/sets/Sets.java

Also, what's the quickest way of doing iterative testing for cards without having to rebuild and redeploy the whole project?

Re: Help with adding new card sets

PostPosted: 04 Sep 2011, 16:47
by nantuko84
Hi, dfh30012

I'm glad you liked the Mage. And more glad to hear you even tried to add new cards

I'll try to help you here. Actually I tried your steps with adding 6ED and a new card in it - everything works for me - I can see both set and added card in deck editor. Just wonder maybe there is mistype somewhere.

Btw, no need to rebuild and redeploy everytime. Whenever you change anything on server side (that is everything except Mage.Client), you just need to restart server in IDE (Eclipse, IDEA, Netbeans).

So usually I follow these steps when creating new cards.
Let's say server is already running and client is in the game.
1. Add new class to the set that represents the card. Implement the logic.
Btw, you may use perl script trunk/Utils/get-card.pl that will ask card name and then generate class for you and put it in corresponding package.
You will need to install Active Perl and then package called Text::Template.
What's good is that the script will create all cards with the same name and put them to other packages as well. E.g., if you type "Shock", it will create ~11 classes Shock.java and put them to corresponding packaging. You will still need to implement card behavior only in one parent class as other classes will use inheritance.
2. Disconnect from server in client (no need to exit from client)
3. Restart server in IDE
4. Connect again, create game
5. Add card to init.txt in Mage.Server\config\init.txt
hand:player:New_Card_Name:1
e.g.
hand:player:Lightning Bolt:1
More about that here (at the bottom):
http://code.google.com/p/mage/wiki/DeveloperNotes
6. Use "cheat" button on players panel to put lands onto battlefield and new card into your hand. Some time you'll need to add targets for the card.
7. Play it

Re: Help with adding new card sets

PostPosted: 04 Sep 2011, 17:33
by BetaSteward
I would also suggest that you check the expansionSetCode property of the card. If it doesn't exactly match the value on the Set then the card will not show up in the deck editor.

Once you are finished adding the new cards we would love to be able to add them to MAGE. Drop by the developers forum http://groups.google.com/group/mage-developers and we'll see about adding you to the project.

Re: Help with adding new card sets

PostPosted: 04 Sep 2011, 19:51
by North
And you should definitely install perl so that you can use the gen-card.pl script from Utils. It saves time on implementing cards, more than you might think.

Also, I have recently added 2 sets (1 hour ago I think). You can see there everything that needs to be done to add it.

Re: Help with adding new card sets

PostPosted: 06 Sep 2011, 16:53
by dfh30012
Thanks for the welcomes.

Seems the issue is environment related. I started off with building from the command line using maven and no cards were showing up. Then I installed Eclipse, and boom, everything works fine when I just run it from the IDE. It's my first day with Eclipse (I have a C++ / Visual Studio background), so I'm still finding out stuff... like where's the button that actually compiles stuff. Although just running with a VM is actually fine for playing - and even better for testing. Plus I get to see lovely debug output. ;)

I like those card generation scripts too. They neatly automate a lot of the overhead required for Java code when compared to a scripting language.

Re: Help with adding new card sets

PostPosted: 07 Sep 2011, 12:08
by North
If you are new to Java development I advise you to use either Netbeans or IntelliJ IDEA. From my point of view, they are more user friendly. I think the team will agree with me on this. You also get native integration with both Maven and Mercurial.

Re: Help with adding new card sets

PostPosted: 09 Sep 2011, 03:59
by nantuko84
Any news? How is it going with the creating new cards?

Re: Help with adding new card sets

PostPosted: 09 Sep 2011, 20:49
by dfh30012
Got swamped with work for three weeks due to projects getting rearranged, so I only managed to get five done. Will have to come back to this when there's more time, though. Thanks for the help.