Page 1 of 2
Wow, Nice job guys!

Posted:
16 Jul 2009, 15:41
by dmikester1
I just downloaded this game the other night and stayed up til 4am playing it because it was so addicting. I've only played the real(physical) version of MTG before this. I have a degree in computer programming and I've learned quite a bit of Java, but I've never done anything this big before. It just blows my mind to think that you could write a program for a game like Magic without having an if/else block for every single card in the game.
There is one thing that bothered me while playing the game. I would be quickly clicking through the turns to speed things up and all of a sudden I would click one to many times and one of my creatures would disappear and the message that told what happened on the left was already gone. Is there a way to make those messages in a scrollable window showing every message in the game? I think that would be very handy.
Thanks for all the hard work devs, this is a really neat app.
Mike
Re: Wow, Nice job guys!

Posted:
17 Jul 2009, 00:43
by zerker2000
dmikester1 wrote:It just blows my mind to think that you could write a program for a game like Magic without having an if/else block for every single card in the game.
Actually, we kind of do for half of them

. If you're fluent at java, look through CardFactory.java in source.rar and you will see what I mean.
Re: Wow, Nice job guys!

Posted:
17 Jul 2009, 00:54
by Rob Cashwalker
Welcome, and thanks for the kudos! MTGForge has grown exponentially over the course of only a year or so, from a personal project of mtgrares, supporting a few hundred cards into this project you have become addicted to, which will soon support nearly two thousand cards, thanks to a few dedicated programmers from around the globe.
Most of the card support IS coded underneath a huge stack of if blocks. Check out CardFactory.java... you'll see a lot of:
if (cardname.equals("Some Card"))
{
card code
}
When I first got into the program, all cards were explicitly coded in separate if blocks, even if the only thing different was a single number... like +1/+1 vs +2/+2. Since then, I have helped push the project towards using script-like keywords as plain-text in cards.txt. So there's still a few if blocks, but the code is reused for all cards that need it. Many cards still need explicit code, mostly just the complex ones, like ones that change the fundamental rules of the game instead of just simple mechanics.
I didn't know a lick of Java before this, I'm a VB programmer by trade. All I needed was a little reference material and I can figure out nearly any language. We can always use more hands around here for adding more cards or improving the existing ones, or modifying the GUI, as you suggested. Only rares has been able to add completely new GUI features, because he designed it in the first place and has the JBuilder environment to do so - the rest of us just use Eclipse to work on the other code.
Re: Wow, Nice job guys!

Posted:
17 Jul 2009, 17:47
by mtgrares
MTG Forge is still a little "rough" and other people have mentioned problems when speed clicking. (I have this problem sometimes also but I'm not sure how to fix it.) MTG Forge has around
37,000 lines of code, this number doesn't include blank lines or lines with just brackets.
It is great that you have a degree in computer programming, I have a degree in programming myself (information science).
Re: Wow, Nice job guys!

Posted:
21 Jul 2009, 05:13
by frwololo
It is
high time you guys did some serious refactoring before the code gets too big for you to maintain.
I've been receiving some help with the code for Wagic recently, and it sure grows faster when there's several persons working on it, but it's also a good way for the "lead programmer" to see what the flaws are in the design.
Whenever someone who's not used to the code does a copy/paste somewhere, use this as a serious warning that this bunch of code should be a separate method or a class.
I actually wrote a post about this a few days ago in
my blogI am also concerned that the last update in the repository was almost a year ago, did you change the SVN location?
Re: Wow, Nice job guys!

Posted:
21 Jul 2009, 18:44
by mtgrares
We don't use any version control and the code in the SVN was just an old experiment. We just post code to the forum which is a little archaic but it works.
According to
CLOC MTG Forge has 29,000 lines of code with CardFactory and 25,000 lines without CardFactory. I included both statistics because CardFactory has the most redundant code.
p.s.
By the way CLOC's default shows the number of lines for a generic "3rd generation language" which is almost useless because it bumped the actual number of lines 29,000 up to 39,000.
- Code: Select all
--With CardFactory and --no3 option
http://cloc.sourceforge.net v 1.08 T=6.0 s (25.0 files/s, 10995.0 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Java 150 11552 25299 29119
-------------------------------------------------------------------------------
SUM: 150 11552 25299 29119
-------------------------------------------------------------------------------
--No CardFactory and --no3 option
http://cloc.sourceforge.net v 1.08 T=3.0 s (49.7 files/s, 11464.0 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Java 149 5939 3037 25416
-------------------------------------------------------------------------------
SUM: 149 5939 3037 25416
-------------------------------------------------------------------------------
Re: Wow, Nice job guys!

Posted:
22 Jul 2009, 00:18
by frwololo
Nice
Oh, I highly recommend that you give google code (and SVN in general) another chance. Most of the people who help me on Wagic have NO experience at all in IT, and yet they managed to get ready with tortoise SVN in a matter of minutes.
Once tortoise SVN is set up on everyone's computer, everything becomes SO easy.
You should definitely give it another try, it makes sense now that there are several devs involved in Forge!
Re: Wow, Nice job guys!

Posted:
11 Oct 2009, 18:03
by Resonantg
I agree with the name of this thread. I've been looking for a way to play old school MtG for a long time, and to find it free in a form I can participate in is frankly fantastic.
I'm currently geeking out looking at cards from when I used to play (from Unlimited to Alliances sets) and finding cards that I would love to see again from those.
Questions I haven't seen so far in what limited searching I've done.
--Is there a way for how some of us could help code cards via a WYSIWYG editor or some other assisting program? I'd love to help out in this, but I haven't the slightest idea how to code Javascript and know only a little HTML so... yeah. There's that.
--Banding, Cumulative Upkeep, Tapping cards during the Draw Phase. Are these things supported so far yet with MTGForge?
--Any limitation of where/when cards are coming from or how to submit?
Thanks once again for some GREAT work here! I love what I found and am really looking forward for what's to come.
Re: Wow, Nice job guys!

Posted:
11 Oct 2009, 19:27
by silly freak
hi and welcome!
there's no WYSIWYG editor for adding cards, just the cards.txt file, which contains all the cards. some cards are implemented just by this file. sorry for that, many ask this, but I think that most, if not all, of the possible cards are already there. (btw, we don't use HTML or JavaScript, it's pure Java)
i think those three aren't working. Banding is really a big thingy. cumulative upkeep shouldn't be too hard, it's just not done yet. i have no clue about doing anything during draw step... maybe it's simple to add, but I don't think so
we'd like to add every card, so there are no limits. you can say that newer cards usually are better known, and so are more interesting to add, but it's more that mechanics are set specific, and implementing a new mechanic enables many cards at once. if we add cumulative upkeep, we'll be able to add many cards from that era.
Re: Wow, Nice job guys!

Posted:
11 Oct 2009, 19:47
by Resonantg
Well, I know enough on how to read code and maybe use it as a basis to learn and create simple creature cards from it just by 'editing' what I have off on the side and then submitting codes maybe.
My real expertise is in graphic design. Sooooo... maybe that's something I may be able to help out with in the long run. I dunno, just toying with ideas here.
Thanks for the response. :c)
Re: Wow, Nice job guys!

Posted:
12 Oct 2009, 04:26
by silly freak
that's a good idea - creating new cards in a copy- paste style seems to work excelently, also for non-programmers
Re: Wow, Nice job guys!

Posted:
12 Oct 2009, 16:51
by Resonantg
Okay, maybe my brain's not working well right now, but where can I go to view card code so I can submit it once I comprehend what I'm looking at? Is there a tutorial or a place for me to view code, or do I need to download a program to view it?
Sorry, last time I did this kinda stuff I had access to Dreamweaver a long time ago to edit. (Huh... would MSWord display it and which file would I open with it?
Re: Wow, Nice job guys!

Posted:
12 Oct 2009, 17:04
by silly freak
it's the CardFactory.java file in the source archive of forge. it's... long
Re: Wow, Nice job guys!

Posted:
12 Oct 2009, 17:07
by DennisBergkamp
Yes, all of the code can be found in source.rar, and CardFactory.java has most of the logic. Start out by looking at cards.txt (which can be found in the \res directory) and CardFactory.java. Any text editor can open these .java files by the way, but it's much nicer to look at using some editor built for it. I either use Eclipse or sometimes EditPlus.
Re: Wow, Nice job guys!

Posted:
12 Oct 2009, 17:09
by Chris H.
Resonantg wrote:Okay, maybe my brain's not working well right now, but where can I go to view card code so I can submit it once I comprehend what I'm looking at? Is there a tutorial or a place for me to view code, or do I need to download a program to view it?
Sorry, last time I did this kinda stuff I had access to Dreamweaver a long time ago to edit. (Huh... would MSWord display it and which file would I open with it?
`
The easiest answer to your question is to load the java file from the source code into any text editing application. From there, the next step would be to download the free Eclipse development package and learn how to use it.
We have a sub-forum devoted to developer issues, code, etc. The link:
Developer's CornerThe "Developer's Corner" sub-forum has a section devoted to helping people get set up with the proper software development tools and you can visit this link:
How to get started?