It is currently 07 Sep 2025, 17:13
   
Text Size

Programming New Cards

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Programming New Cards

Postby 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 :mrgreen: , 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?
mastermindg
 
Posts: 10
Joined: 01 Sep 2010, 15:04
Has thanked: 0 time
Been thanked: 0 time

Re: Programming New Cards

Postby 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.
The Force will be with you, Always.
User avatar
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

Postby 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.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Programming New Cards

Postby 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.
User avatar
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

Postby Rob Cashwalker » 07 Sep 2010, 13:22

eclipse can also search through the files in the project.
The Force will be with you, Always.
User avatar
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

Postby 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.
User avatar
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

Postby 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.
The Force will be with you, Always.
User avatar
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

Postby 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!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 37 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 37 users online :: 0 registered, 0 hidden and 37 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 37 guests

Login Form