It is currently 08 Sep 2025, 17:02
   
Text Size

Time to split CardFactory again....

Post MTG Forge Related Programming Questions Here

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

Time to split CardFactory again....

Postby Rob Cashwalker » 21 Aug 2010, 16:25

Dennis - can you work your magic again to split instants and sorceries to their own classes? My system is really lagging every time I make some changes, as it's recompiling and trying to suggest syntax....
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: Time to split CardFactory again....

Postby Chris H. » 21 Aug 2010, 16:49

Rob Cashwalker wrote:Dennis - can you work your magic again to split instants and sorceries to their own classes? My system is really lagging every time I make some changes, as it's recompiling and trying to suggest syntax....
`
On my copy of Eclipse I decided to uncheck the

Project -> Build Automatically

menu choice. It appears to have sped up my editing efforts. Granted, at some point I have to save the file and select "Build Project" or "Build All". The "Build Automatically" option seems to get in the way.
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: Time to split CardFactory again....

Postby Rob Cashwalker » 22 Aug 2010, 00:06

That only affects things when the file gets saved anyway. It's the in-between time, that I'm having trouble with..
We have so many classes and methods with slight differences in parameters, that I really like eclipse suggesting the available methods. But it only is able to do that in short classes. CardFactory is just so big that eclipse can't deal with it.

Granted, my laptop isn't terribly powerful, a 1.6 Ghz Centrino with 512 MB ram. Desktops probably have no issues.
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: Time to split CardFactory again....

Postby DennisBergkamp » 22 Aug 2010, 00:59

Ah, I'll have a look and see if there's an easy way to do this. The trickiest part would probably be the keyword stuff (almost all of the keyword code in CardFactory are used by both instants and sorceries, this code will have to show up in both CardFactory_Instants and CardFactory_Sorceries), and of course going through every single card.

EDIT: by the way, a lot of the keyword code could probably be externalized... also, there's some places where the code is slightly different, e.g. CardFactory_Creatures still has the old shouldTransmute(card), whereas CardFactory and CardFactory_Lands uses hasKeyword(card, "Transmute").
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Time to split CardFactory again....

Postby Chris H. » 22 Aug 2010, 01:02

The limited ram might be causing page outs. On my Mac, Eclipse is consuming 375.9 MB of ram. I guess that your laptop might also have a slow speed HD.

Will your computer take additional memory, or is this one of those situations where you would hate to throw more money into an older computer?
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: Time to split CardFactory again....

Postby Rob Cashwalker » 22 Aug 2010, 01:12

Reverse order...

chris - I can only swap out my 512 for a 1 GB... only one slot. And it's an older memory technology, so it's not as cheap as the new stuff. Beleive me, I've been wanting to do that for a while.. it's technically not entirely mine, though I paid for a replacement battery and power adapter.

Dennis - if we could split the keywords to their own class prior to processing other instants and sorceries, would that solve that problem?
Or in general, if any sub-factory doesn't match the card, then it would try the keywords.
Given the outline, you don't have to do the leg-work of copying the 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: Time to split CardFactory again....

Postby DennisBergkamp » 22 Aug 2010, 02:15

Actually, it's not as bad as I thought, obviously the ~5k lines of keyword code at the beginning of CardFactory get executed before they point to the different CardFactories (so they're just required in one place only). For Instants/Sorceries, there will only be a few keyword checks at the end (Transmute and (type)Cycling are the only ones I think).

On a related note, CardFactory_Creatures is getting quite big also...
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Time to split CardFactory again....

Postby Rob Cashwalker » 22 Aug 2010, 02:33

Cool beans. CardFactory may become just keywords, until the keywords themselves become troublesome...

So for the creatures, can we split it by alphabet? A-L go in one class, M-Z to another?
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: Time to split CardFactory again....

Postby DennisBergkamp » 22 Aug 2010, 02:46

Yes exactly.
As for the creatures, we could split them alphabetically, we could split them by color (W U B R G, multi, colorless), there's many options.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Time to split CardFactory again....

Postby Rob Cashwalker » 22 Aug 2010, 05:20

:partyman: Oooohh the colors dude... look at the colors!
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: Time to split CardFactory again....

Postby DennisBergkamp » 22 Aug 2010, 06:28

Double Rainbow :mrgreen:

Anyway, I just finished splitting this thing up... it should make a big difference, it's "only" 9500 lines now (5500 for the instants, 8200 for the sorceries). I also got rid of all of the commented out cards.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Time to split CardFactory again....

Postby Rob Cashwalker » 22 Aug 2010, 06:34

That should help immensly. Thank you.
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: Time to split CardFactory again....

Postby Chris H. » 22 Aug 2010, 12:43

Wow, I went to bed early last night. And find that Dennis was able to get this done last night. Thank you. =D>
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


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 51 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 51 users online :: 0 registered, 0 hidden and 51 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 51 guests

Login Form