Time to split CardFactory again....
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
13 posts
• Page 1 of 1
Time to split CardFactory again....
by 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.
-
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....
by 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.
-
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....
by 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.
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.
-
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....
by 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").
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").
-
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....
by 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?
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?
-
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....
by 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.
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.
-
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....
by 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...
On a related note, CardFactory_Creatures is getting quite big also...
-
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....
by 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?
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.
-
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....
by 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.
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.
-
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....
by Rob Cashwalker » 22 Aug 2010, 05:20

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: Time to split CardFactory again....
by DennisBergkamp » 22 Aug 2010, 06:28
Double Rainbow
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.

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.
-
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....
by Rob Cashwalker » 22 Aug 2010, 06:34
That should help immensly. Thank you.
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: Time to split CardFactory again....
by 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. 

-
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
13 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 51 guests