Card coding
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
7 posts
• Page 1 of 1
Card coding
by zaroblan » 18 Aug 2010, 13:10
Greetings,
I would dearly like to get into coding cards for Forge. I have been developing for over 20 years in a variety of language ... and have been playing Magic since Unlimited. Forge has become a very large part of my Magic life and I would like to contribute.
I have downloaded the source code. I am very new to Java, but use C++ and C# on a daily basis so the language is nothing new. What I cannot seem to find is where the cards are actually defined or coded. Please could you give me some pointers where to start so I can get cracking.
Thanks in advance,
Robert Lancaster
I would dearly like to get into coding cards for Forge. I have been developing for over 20 years in a variety of language ... and have been playing Magic since Unlimited. Forge has become a very large part of my Magic life and I would like to contribute.
I have downloaded the source code. I am very new to Java, but use C++ and C# on a daily basis so the language is nothing new. What I cannot seem to find is where the cards are actually defined or coded. Please could you give me some pointers where to start so I can get cracking.
Thanks in advance,
Robert Lancaster
- zaroblan
- Posts: 59
- Joined: 22 May 2009, 11:36
- Has thanked: 0 time
- Been thanked: 0 time
Re: Card coding
by Rob Cashwalker » 18 Aug 2010, 13:21
I've been there... I'm a VB programmer at heart, but nearly any language makes sense to a good programmer.
There are a few main classes to look at for the card code. CardFactory(s) contain almost everything that deals with spell effects or abilities that activate and do something. GameAction and GameActionUtil contain continuous effects. Beyond that, there is card-specific code strewn all over the place... depends on what the card function needs to do.
There are a few main classes to look at for the card code. CardFactory(s) contain almost everything that deals with spell effects or abilities that activate and do something. GameAction and GameActionUtil contain continuous effects. Beyond that, there is card-specific code strewn all over the place... depends on what the card function needs to do.
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: Card coding
by friarsol » 18 Aug 2010, 13:34
One thing Rob didn't mention is that the structure of the card appears in the cards.txt file which is parsed by the CardFactory files. Unless a cards abilities have been keyworded, there will need to be some additional code added into the appropriate CardFactory file. We've had a big push lately to try to group abilities into types so we can code similar abilities all together as a keyword. I have similar coding experience (C++/C#) and you'll be fine coding Java just like it was C# in a majority of circumstances.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Card coding
by zaroblan » 18 Aug 2010, 14:07
Thanks for the response Rob and friarisol!
The code and cards.txt look pretty easy to understand.
Just a quick question. Once I have added cards to the txt file what is the next step?
It would be really handy to have some kind of developers guide.
Can I edit the cards.txt file that was included with the last release (7-16) and add simple type cards and they would be available in the game?
Is there a free java compiler I can use to build the application to test my changes?
The code and cards.txt look pretty easy to understand.
Just a quick question. Once I have added cards to the txt file what is the next step?
It would be really handy to have some kind of developers guide.
Can I edit the cards.txt file that was included with the last release (7-16) and add simple type cards and they would be available in the game?
Is there a free java compiler I can use to build the application to test my changes?
- zaroblan
- Posts: 59
- Joined: 22 May 2009, 11:36
- Has thanked: 0 time
- Been thanked: 0 time
Re: Card coding
by Chris H. » 18 Aug 2010, 14:08
Every card has some data located in the cards.txt file. This is a good starting place. There is a list of keywords on our forum and you should examine the listing.
Much of the card (and keyword) code can be found in the CardFactory class files:
Much of the card (and keyword) code can be found in the CardFactory class files:
- CardFactory_Auras.java
CardFactory_Creatures.java
CardFactory_Equipment.java
CardFactory_Lands.java
CardFactory_Planeswalkers.java
CardFactory.java
-
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: Card coding
by Rob Cashwalker » 18 Aug 2010, 16:04
It's real tough to spend the evening speaking fluent Java, then have to switch gears in the morning to VB - Like I forget to write "Dim" a lot....
Also interesting - I don't forget the ";" as much in Java as I do in Perl... and I don't accidentally use it in VB.
The Java runtime environment is all you need to "compile". We mostly use Eclipse, which handles the compilation and debugging. There's a thread here for getting started with eclipse and pulling the SVN archive.
Also interesting - I don't forget the ";" as much in Java as I do in Perl... and I don't accidentally use it in VB.
The Java runtime environment is all you need to "compile". We mostly use Eclipse, which handles the compilation and debugging. There's a thread here for getting started with eclipse and pulling the SVN archive.
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: Card coding
by mtgrares » 20 Aug 2010, 18:13
I think that's cool. I'm glad that you enjoy Forge so much.zaroblan wrote:Forge has become a very large part of my Magic life and I would like to contribute.

- mtgrares
- DEVELOPER
- Posts: 1352
- Joined: 08 Sep 2008, 22:10
- Has thanked: 3 times
- Been thanked: 12 times
7 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 38 guests