Programming New Cards
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
8 posts
• Page 1 of 1
Programming New Cards
by mastermindg » 07 Sep 2010, 01:49
I'd like to put some time in here to program new cards for Forge. It's not completely selfish since I'll be working on my cards first
, but I wouldn't be opposed to working on other requests once I'm done with mine.
I've got the SVN pulled up in Eclipse. I've compiled the jar so I know everything works so far. How do I go about adding new cards? Where should I start?

I've got the SVN pulled up in Eclipse. I've compiled the jar so I know everything works so far. How do I go about adding new cards? Where should I start?
- mastermindg
- Posts: 10
- Joined: 01 Sep 2010, 15:04
- Has thanked: 0 time
- Been thanked: 0 time
Re: Programming New Cards
by Rob Cashwalker » 07 Sep 2010, 03:14
Depends on exactly what kind of card you're looking to create.
Are there any cards in Forge already that are related or kinda sorta do similar things to the cards you're looking for? If it's a creature, search through CardFactory_Creature for the example code.
Most triggered abilities, upkeep actions and static effects are handled in GameActionUtility.
If the ability/effect is somewhat common or is a particular mechanic which is applicable to many cards, (existing or future) then it would be beneficial to create a keyword parser, like the first half of CardFactory.
Are there any cards in Forge already that are related or kinda sorta do similar things to the cards you're looking for? If it's a creature, search through CardFactory_Creature for the example code.
Most triggered abilities, upkeep actions and static effects are handled in GameActionUtility.
If the ability/effect is somewhat common or is a particular mechanic which is applicable to many cards, (existing or future) then it would be beneficial to create a keyword parser, like the first half of CardFactory.
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: Programming New Cards
by DennisBergkamp » 07 Sep 2010, 03:32
Yes, I think the best places to start looking are the CardFactories (CardFactory, CardFactory_Creatures, CardFactory_Sorceries, ... ) and of course cards.txt.
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Programming New Cards
by Chris H. » 07 Sep 2010, 12:14
Examine the cards.txt file first. Every card has a record with some important data for each of the cards that have been implemented. Card name, casting cost, power/toughness, etc.
You will notice that many of the card records include keywords and some of these keywords include additional data. Check this message for a list of our keywords: Keywords recognized by Forge.
Most of the card specific code can be found in the CardFactory files. There is card specific code located elsewhere. It helps to use your file system's "search by file's content" search system. This will help you to find what you are looking for. If you get lost you can always ask a question here and someone should be able to guide you.
You will notice that many of the card records include keywords and some of these keywords include additional data. Check this message for a list of our keywords: Keywords recognized by Forge.
Most of the card specific code can be found in the CardFactory files. There is card specific code located elsewhere. It helps to use your file system's "search by file's content" search system. This will help you to find what you are looking for. If you get lost you can always ask a question here and someone should be able to guide you.
-
Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
Re: Programming New Cards
by Rob Cashwalker » 07 Sep 2010, 13:22
eclipse can also search through the files in the project.
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: Programming New Cards
by Chris H. » 07 Sep 2010, 13:55
`Rob Cashwalker wrote:eclipse can also search through the files in the project.
Thank you for that hint. I never looked into the Eclipse Search command before. This is an improvement over OS based searches.
-
Chris H. - Forge Moderator
- Posts: 6320
- Joined: 04 Nov 2008, 12:11
- Location: Mac OS X Yosemite
- Has thanked: 644 times
- Been thanked: 643 times
Re: Programming New Cards
by Rob Cashwalker » 07 Sep 2010, 14:57
Yep. It has a few search functions.
There's the Ctrl-F find in the editor.
There's a File search, which you can specify *.java for example and it searches just those files. I use this all the time. The results show up on the bottom panel, or wherever the console view is attached.
There's also a Java search, which seems like it should do something similar, but I don't get the results I expect.
There's the Ctrl-F find in the editor.
There's a File search, which you can specify *.java for example and it searches just those files. I use this all the time. The results show up on the bottom panel, or wherever the console view is attached.
There's also a Java search, which seems like it should do something similar, but I don't get the results I expect.
The Force will be with you, Always.
-
Rob Cashwalker - Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: Programming New Cards
by silly freak » 07 Sep 2010, 16:04
i use the java search indirectly quite often, through the "find references" function. just select a class or method name and press F3, and eclipse finds everywhere it is used
___
where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
- silly freak
- DEVELOPER
- Posts: 598
- Joined: 26 Mar 2009, 07:18
- Location: Vienna, Austria
- Has thanked: 93 times
- Been thanked: 25 times
8 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 37 guests