Issue 157: which classes do we need?
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
66 posts
• Page 4 of 5 • 1, 2, 3, 4, 5
Re: Issue 157: which classes do we need?
by Braids » 28 Aug 2011, 18:43
i have been careful with existing files in the past. when i was working mantis issue 144 (fixed in rev 9845), i was sure to preserve loading in the old format.Rob Cashwalker wrote:Just be aware that if you change the deck formats AGAIN, then you have to add IMPORTERS and EXPORTERS in addition to the original deck importers, otherwise folks are going to be furious with their old decks being useless.
On the other hand, you can tweak the single-liner deck format to support all the information you need.
The point of this is not to change the deck file. The point is to make a lightweight card object that makes searching and sorting faster.
what purpose do EXPORTERS serve? sharing decks with users who are running older versions of Forge?
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. 

-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
Re: Issue 157: which classes do we need?
by Max mtg » 28 Aug 2011, 19:03
Thank you, Braids!Braids wrote:i can help you with the new CardReader. just tell me which class, and which fields you want me to fill in. am i correct you want to load all cards?Max mtg wrote:It's not easy for me to crawl through all of that variable parsing found in CardReader
Would you please write that class? It should be an iterator of CardRules.
We need a class which would replace forge.card.MtgDataParser - it should somehow iterate over all the cards avaliable to Forge (regardless their location: in plain folders or zipped) and create matching CardRule objects.
Please fill all the fields of that CardRules class (well, the constuctor contains them all, and the class is designed to be immutable). Since you'll be iterating over cardname.txt files, it would be great idea to read AI-related vars from there and store them in CardRules object too.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Issue 157: which classes do we need?
by Rob Cashwalker » 28 Aug 2011, 19:43
I dunno... I just remember a big uproar when I added the set code to the card names in deckfiles. The Deck object was oblivious to the change, the change was entirely done at the UI level. However the deck exporters were too confusing for me, so I didn't change them immediately.Braids wrote:what purpose do EXPORTERS serve? sharing decks with users who are running older versions of Forge?
edit - Actually, I think the biggest use folks had was that they were exporting constructed decks just for import into quest mode... since it was a cheat, I was resistant to fixing it at first.
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: Issue 157: which classes do we need?
by Braids » 28 Aug 2011, 19:45
you are welcome.Max mtg wrote:Thank you, Braids!Braids wrote:i can help you with the new CardReader. just tell me which class, and which fields you want me to fill in. am i correct you want to load all cards?Max mtg wrote:It's not easy for me to crawl through all of that variable parsing found in CardReader
Would you please write that class? It should be an iterator of CardRules.
We need a class which would replace forge.card.MtgDataParser - it should somehow iterate over all the cards avaliable to Forge (regardless their location: in plain folders or zipped) and create matching CardRule objects.
Please fill all the fields of that CardRules class (well, the constuctor contains them all, and the class is designed to be immutable). Since you'll be iterating over cardname.txt files, it would be great idea to read AI-related vars from there and store them in CardRules object too.
@FriarSol, what do the card txt files look like with oracle text in them? would it be safe for you to possibly check one in?
@Max mtg, am i right that you have checked in some files, but they are not being executed by the game yet? if i rewrite CardReader, everything will break, yes? so the new class is going to have to be a copy and paste. please let me know.
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. 

-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
Re: Issue 157: which classes do we need?
by Rob Cashwalker » 28 Aug 2011, 19:47
Braids, copy CardReader to CardReader2. Change what you need to, then max should reference CardReader2. When everything's working, just remove the old one. Temporary copy and paste doesn't count. 

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: Issue 157: which classes do we need?
by friarsol » 28 Aug 2011, 19:51
Too late. All of this nonsense was giving me a headache so I'm checking them all in. I'm more than halfway done already.Braids wrote:@FriarSol, what do the card txt files look like with oracle text in them? would it be safe for you to possibly check one in?
Here's a random sample:
- Bad River | Open
- Name:Bad River
ManaCost:no cost
Types:Land
Text:no text
K:CARDNAME enters the battlefield tapped.
A:AB$ ChangeZone | Cost$ T Sac<1/CARDNAME> | Origin$ Library | Destination$ Battlefield | ChangeType$ Island,Swamp | ChangeNum$ 1 | SpellDescription$ Search your library for an Island or Swamp card and put it onto the battlefield. Then shuffle your library.
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/bad_river.jpg
SetInfo:MIR|Uncommon|http://magiccards.info/scans/en/mr/289.jpg
Oracle:Bad River enters the battlefield tapped.\n{T}, Sacrifice Bad River: Search your library for an Island or Swamp card and put it onto the battlefield. Then shuffle your library.
End
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Issue 157: which classes do we need?
by Braids » 28 Aug 2011, 19:54
thanks for the information, Rob.Rob Cashwalker wrote:Braids, copy CardReader to CardReader2. Change what you need to, then max should reference CardReader2. When everything's working, just remove the old one. Temporary copy and paste doesn't count.

"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. 

-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
Re: Issue 157: which classes do we need?
by Max mtg » 28 Aug 2011, 19:58
You're right The new classes are not instantiated yet from any point of already commited code.Braids wrote:@Max mtg, am i right that you have checked in some files, but they are not being executed by the game yet? if i rewrite CardReader, everything will break, yes? so the new class is going to have to be a copy and paste. please let me know.
Nothing will break if you write your class next to the CardReader we already have.
But avoid making redundant copies of old classes or their methods, since it makes code harder to mantain.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Issue 157: which classes do we need?
by Braids » 28 Aug 2011, 20:02
thanks for contributing through the headache, friarsol. i do appreciate it.friarsol wrote:Too late. All of this nonsense was giving me a headache so I'm checking them all in. I'm more than halfway done already.Braids wrote:@FriarSol, what do the card txt files look like with oracle text in them? would it be safe for you to possibly check one in?
Here's a random sample: . . .
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. 

-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
Re: Issue 157: which classes do we need?
by friarsol » 28 Aug 2011, 20:07
I'm just hoping we don't have to go back through and change how the Oracle text appears in cards.txt. It's obnoxious for everyone to have to update 9000 cards from the SVN. At least my FIOS connection can quickly upload everything necessary.Braids wrote:thanks for contributing through the headache, friarsol. i do appreciate it.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Issue 157: which classes do we need?
by Max mtg » 28 Aug 2011, 20:11
Yes, thank you. I don't know anyone else who would be able to update all that 9000 files with oracle text.friarsol wrote:I'm just hoping we don't have to go back through and change how the Oracle text appears in cards.txt. It's obnoxious for everyone to have to update 9000 cards from the SVN. At least my FIOS connection can quickly upload everything necessary.
If there any problems commiting, you can mail me the files, I'll commit them fast and painless - cause I live a bit closer to server and have a good connection.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Issue 157: which classes do we need?
by Braids » 28 Aug 2011, 23:04
i'm doing ok with svn. i'm having to do the update one letter folder at a time from the command line. i am very glad i was able to split the cardsfolder up alphabetically several weeks ago.
@Max mtg, i've added two boolean fields to CardRules: removedFromAIDecks and removedFromRandomDecks. i added them to the ctor and added two 'is' accessors for them. these values are important for being able to generate random decks for both the player and the AI, and also for AI drafting.
@Max mtg, i've added two boolean fields to CardRules: removedFromAIDecks and removedFromRandomDecks. i added them to the ctor and added two 'is' accessors for them. these values are important for being able to generate random decks for both the player and the AI, and also for AI drafting.
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. 

-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
Re: Issue 157: which classes do we need?
by Max mtg » 28 Aug 2011, 23:28
I strongly support the decision of splitting the cardsfolder - now the directories open faster and the needed card is faster to located. Despite of the update of all over 9000 files took me about a minuteBraids wrote:i'm doing ok with svn. i'm having to do the update one letter folder at a time from the command line. i am very glad i was able to split the cardsfolder up alphabetically several weeks ago.
@Max mtg, i've added two boolean fields to CardRules: removedFromAIDecks and removedFromRandomDecks. i added them to the ctor and added two 'is' accessors for them. these values are important for being able to generate random decks for both the player and the AI, and also for AI drafting.
You've done it right. These fields are definitelly necesary once we switch completely to generators based on lighweight classes.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Issue 157: which classes do we need?
by Rob Cashwalker » 29 Aug 2011, 04:15
FYI, the SlightlyMagic SVN is going quite fast. I recall with GoogleCode, updating all 5000+ cards took an hour due to the stream crapping out every few hundred cards. It just did 8829 updates in about 6 minutes.
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: Issue 157: which classes do we need?
by Braids » 29 Aug 2011, 16:12
not using SSL speeds things along.
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. 

-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
66 posts
• Page 4 of 5 • 1, 2, 3, 4, 5
Who is online
Users browsing this forum: No registered users and 19 guests