It is currently 12 Sep 2025, 23:09
   
Text Size

Issue 157: which classes do we need?

Post MTG Forge Related Programming Questions Here

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

Re: Issue 157: which classes do we need?

Postby Braids » 28 Aug 2011, 18:43

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

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. ;)
User avatar
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?

Postby Max mtg » 28 Aug 2011, 19:03

Braids wrote:
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.
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?
Thank you, Braids!

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?

Postby Rob Cashwalker » 28 Aug 2011, 19:43

Braids wrote:what purpose do EXPORTERS serve? sharing decks with users who are running older versions of Forge?
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.

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.
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: Issue 157: which classes do we need?

Postby Braids » 28 Aug 2011, 19:45

Max mtg wrote:
Braids wrote:
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.
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?
Thank you, Braids!

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.
you are welcome.

@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. ;)
User avatar
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?

Postby 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.
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: Issue 157: which classes do we need?

Postby friarsol » 28 Aug 2011, 19:51

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

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?

Postby Braids » 28 Aug 2011, 19:54

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. ;-)
thanks for the information, Rob. :) i thought that might be the way to go. if i use svn cp, it retains history! yay.
"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. ;)
User avatar
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?

Postby Max mtg » 28 Aug 2011, 19:58

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.
You're right The new classes are not instantiated yet from any point of already commited code.
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?

Postby Braids » 28 Aug 2011, 20:02

friarsol wrote:
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?
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.

Here's a random sample: . . .
thanks for contributing through the headache, friarsol. i do appreciate it.
"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. ;)
User avatar
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?

Postby friarsol » 28 Aug 2011, 20:07

Braids wrote:thanks for contributing through the headache, friarsol. i do appreciate it.
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.
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?

Postby Max mtg » 28 Aug 2011, 20:11

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.
Yes, thank you. I don't know anyone else who would be able to update all that 9000 files with oracle text.

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?

Postby 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.
"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. ;)
User avatar
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?

Postby Max mtg » 28 Aug 2011, 23:28

Braids 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.
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 minute

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?

Postby 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.
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: Issue 157: which classes do we need?

Postby 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. ;)
User avatar
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

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 19 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 19 users online :: 0 registered, 0 hidden and 19 guests (based on users active over the past 10 minutes)
Most users ever online was 7967 on 09 Sep 2025, 23:08

Users browsing this forum: No registered users and 19 guests

Login Form