It is currently 07 Jul 2021, 21:52
   
Text Size

Wow, Nice job guys!

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

Wow, Nice job guys!

Postby dmikester1 » 16 Jul 2009, 15:41

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
dmikester1
 
Posts: 7
Joined: 16 Jul 2009, 15:15
Has thanked: 0 time
Been thanked: 0 time

Re: Wow, Nice job guys!

Postby zerker2000 » 17 Jul 2009, 00:43

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 :P. If you're fluent at java, look through CardFactory.java in source.rar and you will see what I mean.
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: Wow, Nice job guys!

Postby Rob Cashwalker » 17 Jul 2009, 00:54

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.
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: Wow, Nice job guys!

Postby mtgrares » 17 Jul 2009, 17:47

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).
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times

Re: Wow, Nice job guys!

Postby frwololo » 21 Jul 2009, 05:13

mtgrares wrote: MTG Forge has around 37,000 lines of code
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 blog

I am also concerned that the last update in the repository was almost a year ago, did you change the SVN location?
frwololo
DEVELOPER
 
Posts: 265
Joined: 21 Jun 2008, 04:33
Has thanked: 0 time
Been thanked: 3 times

Re: Wow, Nice job guys!

Postby mtgrares » 21 Jul 2009, 18:44

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
-------------------------------------------------------------------------------
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times

Re: Wow, Nice job guys!

Postby frwololo » 22 Jul 2009, 00:18

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!
frwololo
DEVELOPER
 
Posts: 265
Joined: 21 Jun 2008, 04:33
Has thanked: 0 time
Been thanked: 3 times

Re: Wow, Nice job guys!

Postby Resonantg » 11 Oct 2009, 18:03

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.
Resonantg
 
Posts: 172
Joined: 11 Oct 2009, 16:20
Has thanked: 0 time
Been thanked: 0 time

Re: Wow, Nice job guys!

Postby silly freak » 11 Oct 2009, 19:27

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.
___

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

Re: Wow, Nice job guys!

Postby Resonantg » 11 Oct 2009, 19:47

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)
Resonantg
 
Posts: 172
Joined: 11 Oct 2009, 16:20
Has thanked: 0 time
Been thanked: 0 time

Re: Wow, Nice job guys!

Postby silly freak » 12 Oct 2009, 04:26

that's a good idea - creating new cards in a copy- paste style seems to work excelently, also for non-programmers
___

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

Re: Wow, Nice job guys!

Postby Resonantg » 12 Oct 2009, 16:51

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?
Resonantg
 
Posts: 172
Joined: 11 Oct 2009, 16:20
Has thanked: 0 time
Been thanked: 0 time

Re: Wow, Nice job guys!

Postby silly freak » 12 Oct 2009, 17:04

it's the CardFactory.java file in the source archive of forge. it's... long
___

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

Re: Wow, Nice job guys!

Postby DennisBergkamp » 12 Oct 2009, 17:07

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

Re: Wow, Nice job guys!

Postby Chris H. » 12 Oct 2009, 17:09

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 Corner

The "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?
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

Next

Return to Forge

Who is online

Users browsing this forum: Google [Bot] and 11 guests

cron

Who is online

In total there are 12 users online :: 1 registered, 0 hidden and 11 guests (based on users active over the past 10 minutes)
Most users ever online was 1922 on 07 Jun 2021, 06:01

Users browsing this forum: Google [Bot] and 11 guests

Login Form