Pictures and Rarity as SVars and Conversion Scripts
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
38 posts
• Page 2 of 3 • 1, 2, 3
Re: Pictures and Rarity as SVars and Conversion Scripts
by silly freak » 11 Aug 2010, 20:31
let me change three things of your statement:Rob Cashwalker wrote:We could also write our own "multiverse" of sorts - a script running on a server that is able to translate our own ID numbers to known URLs on assorted hosts.... This reduces maintenance of these lists as they only need to be changed in one location, without clogging up the cards.txt even more.
first, don't create your own IDs if there is already one to be adopted
second, skip the server. Hosting a server for forge to translate image URLs for downloading is... unlikely
third, be more specific what that script would do: for gatherer images, it would paste the multiverse ID into a template URL...
... for others that don't use the multiverse ID the script would use some translation table to look up the URL belonging to the multiverse ID.Rob Cashwalker wrote:A mirror site would have different URLs anyway, probably not using the multiverse ID either.
And what you get is:
Silly Freak wrote:on my own project, I'm storing all the Multiverse-IDs for the cards, as this is also a unique identifier for the picture. for non-gatherer pictures, I will use a lookup table, so the URL is not stored with the card directly, but with the multiverse ID in a separate list.
For example, cards.txt would have
- Code: Select all
Some Card
..
..
SVar:MID:1,2,3
- Code: Select all
1 http://...
2 http://...
3 http://...
- every card has its multiverse IDs in cards.txt
- every mirror has a translation table (or translation function, e.g. for gatherer)
- no problem with multiple pictures, because every version of the card has its own multiverse ID
___
where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
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: Pictures and Rarity as SVars and Conversion Scripts
by Rob Cashwalker » 11 Aug 2010, 23:38
Then what's the advantage over what the card-pictures file is doing already?
Edit - Check it out: Twice the Llanowar Elves for twice the fun:
All it took was adding
SVar:PicCount:2 to Llanowar Elves
and
SVar:PicCount:4 to all the basic lands,
and
SVar:PicCount:2 to the Snow-Coverd lands. (there are currently 4 files each, and should be reduced to 2)
Just grab an alternative picture, add a 1 to the filename, and you're good to go.
Edit - Check it out: Twice the Llanowar Elves for twice the fun:
All it took was adding
SVar:PicCount:2 to Llanowar Elves
and
SVar:PicCount:4 to all the basic lands,
and
SVar:PicCount:2 to the Snow-Coverd lands. (there are currently 4 files each, and should be reduced to 2)
Just grab an alternative picture, add a 1 to the filename, and you're good to go.
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: Pictures and Rarity as SVars and Conversion Scripts
by silly freak » 12 Aug 2010, 21:03
well, one obvious advantage would be that it's a clean solution and allows you to implement any feature that requires knowledge about specific printings... say, Sets and rarity. sure, you could add set information directly to cards.txt, but you won't find the right pictures without the multiverse id assigned. Rarity is right now on a card-by-card basis, but you can't account for different rarities in different sets this way.
well, apparently there are advantages, but the decision is yours, as i currently don't have the will to contribute code myself and don't want to flame any more. I'm sorry if I'm a little stubborn...
well, apparently there are advantages, but the decision is yours, as i currently don't have the will to contribute code myself and don't want to flame any more. I'm sorry if I'm a little stubborn...
___
where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
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: Pictures and Rarity as SVars and Conversion Scripts
by Rob Cashwalker » 12 Aug 2010, 22:41
That's a good point... we'll have access to multiple images and eventually incorporate set-specific functionality. But without serious complication, a 2011 Giant Growth would show up in a 4th edition booster.... For quest mode, the card images add to the visual experience but for sealed and draft it would be a slight negative on the visual experience.... Hmmm decisions decisions....
This also raises the question of whether the card prices should be linked to the particular revision of the card....
Edit -
I just read the new migratedCardsScript.py and noticed that it doesn't bother with multiverse IDs anyway. It uses the general pictures combined with the image_name.
This also raises the question of whether the card prices should be linked to the particular revision of the card....
Edit -
I just read the new migratedCardsScript.py and noticed that it doesn't bother with multiverse IDs anyway. It uses the general pictures combined with the image_name.
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: Pictures and Rarity as SVars and Conversion Scripts
by Rob Cashwalker » 14 Aug 2010, 12:53
I just committed the changes in the 3 BoosterPack classes to support SVar:Rarity.
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: Pictures and Rarity as SVars and Conversion Scripts
by Chris H. » 14 Aug 2010, 13:42
`Rob Cashwalker wrote:I just committed the changes in the 3 BoosterPack classes to support SVar:Rarity.
Thank you. I have been updating my local copy and am paying attention to your and Sol's good work. I have been fairly busy and have not had a chance to contribute to the discussion.
I think that we should hold off on releasing the next beta until after this part of the project is completed. I only have modem dial up and can not test how well it works for downloading large numbers of pics at one time.
The last beta required 3 additional jars updates to get a fairly stable product out to the public.
-

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: Pictures and Rarity as SVars and Conversion Scripts
by Rob Cashwalker » 14 Aug 2010, 14:04
So far, the picture SVar's still only reference one picture for each card, so don't worry about that part.
When/If set-specific functionality is added then much of this code will need to be revised to deal with multiple printings. For now, if anyone wants to update the cards.txt with a few additional images with different artwork, it would at least make some visual impact.
For example - Llanowar Elves used the same artwork from 8th to now. Visually, there's little difference, but 7th is quite different, not only in the card frame but the artwork itself.
When/If set-specific functionality is added then much of this code will need to be revised to deal with multiple printings. For now, if anyone wants to update the cards.txt with a few additional images with different artwork, it would at least make some visual impact.
For example - Llanowar Elves used the same artwork from 8th to now. Visually, there's little difference, but 7th is quite different, not only in the card frame but the artwork itself.
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: Pictures and Rarity as SVars and Conversion Scripts
by Chris H. » 17 Aug 2010, 00:31
I updated my local copy to rev 1735 and noticed that some of the cards, older ones mainly, did not have a rarity value.
Are we far enough along that we can delete the card-pictures.txt and the rarity files? What will we do about the cube draft rarities located in the /res/draft/ folder?
Are we far enough along that we can delete the card-pictures.txt and the rarity files? What will we do about the cube draft rarities located in the /res/draft/ folder?
-

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: Pictures and Rarity as SVars and Conversion Scripts
by Rob Cashwalker » 17 Aug 2010, 03:23
This took a lot of digging before I figured out what's going on.
There are some cards which have been added recently which simply don't have the SVars in the cards.txt.
But others, which do have the SVars are also failing to match up both rarity and URLs.... I'll show Dromad Purebred as an example:
In this particular case, I'm guessing the effect should be converted to the Whenever keyword, but the problem is much more widespread, like ALL the planeswalkers.
At this point, it's probably not too tough to go through the cards which create new cards, adding the SVars to the new card. There are only a few dozen.... I think I'll need to make a new method to get and set all the SVars at once.
(Or we could do it the "easy" way and make the Card object cloneable....)
(Or the other easy way, and use one external file to carry this metadata)
There are some cards which have been added recently which simply don't have the SVars in the cards.txt.
But others, which do have the SVars are also failing to match up both rarity and URLs.... I'll show Dromad Purebred as an example:
- Code: Select all
Dromad Purebred
4 W
Creature Camel Beast
Whenever Dromad Purebred is dealt damage, you gain 1 life.
1/5
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/dromad_purebred.jpg
- Code: Select all
//*************** START *********** START **************************
else if(cardName.equals("Dromad Purebred")) {
final Card newCard = new Card() {
@Override
public void addDamage(HashMap<Card, Integer> map) {
final HashMap<Card, Integer> m = map;
final Ability ability = new Ability(card, "0") {
@Override
public void resolve() {
String player = card.getController();
AllZone.GameAction.getPlayerLife(player).addLife(1);
}
};
ability.setStackDescription(card.getName() + " - " + card.getController() + " gains 1 life.");
AllZone.Stack.add(ability);
for(Entry<Card, Integer> entry : m.entrySet()) {
this.addDamage(entry.getValue(), entry.getKey());
}
}
};
newCard.setOwner(card.getOwner());
newCard.setController(card.getController());
newCard.setManaCost(card.getManaCost());
newCard.setName(card.getName());
newCard.addType("Creature");
newCard.addType("Camel");
newCard.addType("Beast");
newCard.setText(card.getSpellText());
newCard.setBaseAttack(card.getBaseAttack());
newCard.setBaseDefense(card.getBaseDefense());
newCard.addSpellAbility(new Spell_Permanent(newCard));
return newCard;
}//*************** END ************ END **************************
In this particular case, I'm guessing the effect should be converted to the Whenever keyword, but the problem is much more widespread, like ALL the planeswalkers.
At this point, it's probably not too tough to go through the cards which create new cards, adding the SVars to the new card. There are only a few dozen.... I think I'll need to make a new method to get and set all the SVars at once.
(Or we could do it the "easy" way and make the Card object cloneable....)
(Or the other easy way, and use one external file to carry this metadata)
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: Pictures and Rarity as SVars and Conversion Scripts
by friarsol » 17 Aug 2010, 04:20
Is it clear why the card creates a new card instead of just adding the Ability in like all the other cards we're used to seeing? Is it just the card is an older creation and the new card creation hadn't been streamlined?
Maybe we can just make a list of which cards don't pull the rarity properly and fix the abilities on those of them so they don't create a newCard and just roll the ability during card generation.
Maybe we can just make a list of which cards don't pull the rarity properly and fix the abilities on those of them so they don't create a newCard and just roll the ability during card generation.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Pictures and Rarity as SVars and Conversion Scripts
by DennisBergkamp » 17 Aug 2010, 05:57
The reason new cards get created for those is because they need an overridden addDamage method (for example the planeswalkers don't get damaged like creatures do, they get their Loyalty counters removed - then there's a bunch of other cards like Dromad Purebred and the "Phantom" spirits).
I'm not quite sure what the best way is to fix this, but like Rob said, there's a lot of ways.
Maybe for now we'd just add a "newCard.setRarity(card.getRarity());" to all of those cards, which should do the trick for now, right?
I'm not quite sure what the best way is to fix this, but like Rob said, there's a lot of ways.
Maybe for now we'd just add a "newCard.setRarity(card.getRarity());" to all of those cards, which should do the trick for now, right?
-

DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Pictures and Rarity as SVars and Conversion Scripts
by Rob Cashwalker » 17 Aug 2010, 11:32
No, because Card.getRarity only works after a Card.setRarity... which is called after executing ReadBoosterPack. The DeckEditor screen calls upon ReadBoosterPack to determine the rarity of a card. But ReadBoosterPack doesn't know anything about rarity until it reads through all the cards, which occurs AFTER the new cards have been created and returned through CardFactory.
For now, I've added Card.getSVars and Card.setSVars(newSVars). So this line can be added wherever new cards are created:
newCard.setSVars(card.getSVars());
Considering silly freak's suggestions, these SVars may seriously limit how easy it will be to enable set-specific functions. One single external file for metadata may be the better long term solution.
For now, I've added Card.getSVars and Card.setSVars(newSVars). So this line can be added wherever new cards are created:
newCard.setSVars(card.getSVars());
Considering silly freak's suggestions, these SVars may seriously limit how easy it will be to enable set-specific functions. One single external file for metadata may be the better long term solution.
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: Pictures and Rarity as SVars and Conversion Scripts
by Chris H. » 17 Aug 2010, 13:31
I added "newCard.setSVars(card.getSVars());" to the creatures with missing rarities and added "card2.setSVars(card.getSVars());" to the planeswalkers. All of the cards now display a rarity value. 
-

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: Pictures and Rarity as SVars and Conversion Scripts
by Rob Cashwalker » 17 Aug 2010, 14:05
And also important is that their URLs will now work too....
Note- For now, the code lumps Mythic in with the Rares. It doesn't look too difficult to work Mythics into the card distribution.
Note- For now, the code lumps Mythic in with the Rares. It doesn't look too difficult to work Mythics into the card distribution.
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: Pictures and Rarity as SVars and Conversion Scripts
by Chris H. » 17 Aug 2010, 14:09
`Rob Cashwalker wrote:And also important is that their URLs will now work too....
I only have modem dial up.
I might be able to set the computer up to download LQ pics over night while I sleep. The HQ pics are a different matter.
-

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
38 posts
• Page 2 of 3 • 1, 2, 3
Who is online
Users browsing this forum: No registered users and 25 guests