It is currently 19 Apr 2024, 23:13
   
Text Size

Help with adding new card sets

by BetaSteward

Moderators: North, BetaSteward, noxx, jeffwadsworth, JayDi, TheElk801, LevelX, CCGHQ Admins

Help with adding new card sets

Postby dfh30012 » 04 Sep 2011, 14:03

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?
dfh30012
 
Posts: 3
Joined: 04 Sep 2011, 13:47
Has thanked: 0 time
Been thanked: 0 time

Re: Help with adding new card sets

Postby nantuko84 » 04 Sep 2011, 16:47

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
Mage\MagicWars blog: http://mwars.blogspot.com/
nantuko84
DEVELOPER
 
Posts: 266
Joined: 08 Feb 2009, 21:14
Has thanked: 2 times
Been thanked: 9 times

Re: Help with adding new card sets

Postby BetaSteward » 04 Sep 2011, 17:33

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.
BetaSteward
DEVELOPER
 
Posts: 129
Joined: 28 Mar 2010, 13:15
Has thanked: 6 times
Been thanked: 29 times

Re: Help with adding new card sets

Postby North » 04 Sep 2011, 19:51

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.
North
DEVELOPER
 
Posts: 93
Joined: 15 May 2011, 08:20
Has thanked: 8 times
Been thanked: 15 times

Re: Help with adding new card sets

Postby dfh30012 » 06 Sep 2011, 16:53

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.
dfh30012
 
Posts: 3
Joined: 04 Sep 2011, 13:47
Has thanked: 0 time
Been thanked: 0 time

Re: Help with adding new card sets

Postby North » 07 Sep 2011, 12:08

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.
North
DEVELOPER
 
Posts: 93
Joined: 15 May 2011, 08:20
Has thanked: 8 times
Been thanked: 15 times

Re: Help with adding new card sets

Postby nantuko84 » 09 Sep 2011, 03:59

Any news? How is it going with the creating new cards?
Mage\MagicWars blog: http://mwars.blogspot.com/
nantuko84
DEVELOPER
 
Posts: 266
Joined: 08 Feb 2009, 21:14
Has thanked: 2 times
Been thanked: 9 times

Re: Help with adding new card sets

Postby dfh30012 » 09 Sep 2011, 20:49

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.
dfh30012
 
Posts: 3
Joined: 04 Sep 2011, 13:47
Has thanked: 0 time
Been thanked: 0 time


Return to XMage

Who is online

Users browsing this forum: No registered users and 147 guests


Who is online

In total there are 147 users online :: 0 registered, 0 hidden and 147 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 147 guests

Login Form