It is currently 11 May 2025, 04:41
   
Text Size

New card pics algorithm

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

New card pics algorithm

Postby jpb » 27 Jan 2009, 08:56

I don't like the idea of downloading new card pics every time we try a new version of MTG Forge. I know you can manually copy the card pics over and then download the remaining cards, but can anyone come up with a more usable method? Keep in mind that forge cannot include card pictures in the distribution of MTG Forge.
jpb
 
Posts: 132
Joined: 05 Sep 2008, 13:12
Has thanked: 0 time
Been thanked: 0 time

Re: New card pics algorithm

Postby DennisBergkamp » 27 Jan 2009, 19:06

I've been wondering about this, how does it currently download the pictures? Will it actually overwrite previously downloaded pics? So if for a new version, say 15 new cards are added and these 15 new cards are also correctly added into card-pictures.txt, will it start downloading the entire 30 megs of cards again, just for those 15 pictures?

Another thing I would like to see is have the card pictures downloaded into a subdirectory called "images", or something close.
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: New card pics algorithm

Postby Rob Cashwalker » 27 Jan 2009, 19:24

I've written a downloader into the cardset editor. It has two commands - "download all images", (overwrites) and "download missing images". I know this doesn't help for non-windows folks....

A RAR file of my generated pics (I even doubled their size for less word-wrapping) is only 1.6 MB. I could also host the generic images for download, they're only about 5kb each. These could probably be included in the default package.

It looks like the code for Gui_DownloadPictures.getNeededCards() returns a list of cards that aren't already downloaded. However, in looking at the code, I'm thinking it may be prone to case sensitivity depending on the OS/filesystem. The pictures seem to be stored in all lower case, but it checks for file existence based on the name in card-pictures.txt. BTW, as a bug fix, the cancel button never seemed to respond for me.
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: New card pics algorithm

Postby mtgrares » 27 Jan 2009, 20:20

I've been wondering about this, how does it currently download the pictures?
MTG Forge uses the file card-pictures.txt to download the file. On each line there is a file name and URL. The file name is the same name that the MTG Forge program will try to read. Basically the "card picture download" program is separate from the rest of MTG Forge. Currently all the card pictures are downloaded from the Wizards site, but any site could be used. The program just downloads the picture at the URL and renames it to the appropriate name (spaces are converted to _ and dashes are removed).

Code: Select all
ambush_party.jpg       http://wizards.com/magic.../ambush_party.jpg
MTG Forge downloads the jpg from the URL and renames it ambush_party.jpg because that is the file name that MTG Forge will try to read.

Will it actually overwrite previously downloaded pics?
No it will only download the card pictures for the cards that you don't have.

The ideal solution is to let you set the path to the directory where the card pictures are located at, so you could have multiple copies of MTG Forge and they could all use the same pictures.
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times

Re: New card pics algorithm

Postby Orpheu » 03 Feb 2009, 11:17

DennisBergkamp wrote:Another thing I would like to see is have the card pictures downloaded into a subdirectory called "images", or something close.
Sorry for this late response to this old topic, but I really think this is a small update to the source code that would allow a more "clean" run forge mtg folder.
Orpheu
 
Posts: 25
Joined: 13 Dec 2008, 09:43
Has thanked: 0 time
Been thanked: 0 time

Re: New card pics algorithm

Postby Helza » 08 Feb 2009, 15:33

I've patched my local version to use a "pics" directory. Then i only have to overwrite the existing files when a new release comes along, the pics dir will then be unharmed..

I've attached a patch for the current trunk.. haven't tested this patch out on the trunk, but it should work. I patched the 24/02 version posted on these forums, but the trunk isn't all that much different.
You have to manually create the pics directory or you'll get some odd error that you require an internet connection :P

mmm, i seem to be unable to upload the path here.. its not allowing .txt or .patch filenames :(
uploaded it here: http://code.google.com/p/cardforge/issues/detail?id=16
Helza
 
Posts: 12
Joined: 14 Jan 2009, 23:54
Has thanked: 0 time
Been thanked: 0 time

Re: New card pics algorithm

Postby nantuko84 » 08 Feb 2009, 21:17

if you want to fix the issue with Cancel button (that doesn't respond while images downloading), just replace the line in Gui_DownloadPictures.java:

SwingUtilities.invokeLater(thread);

by

thread.start();
Mage\MagicWars blog: http://mwars.blogspot.com/
nantuko84
DEVELOPER
 
Posts: 266
Joined: 08 Feb 2009, 21:14
Has thanked: 2 times
Been thanked: 9 times

Re: New card pics algorithm

Postby DennisBergkamp » 08 Feb 2009, 21:50

Helza wrote:I've patched my local version to use a "pics" directory. Then i only have to overwrite the existing files when a new release comes along, the pics dir will then be unharmed..

I've attached a patch for the current trunk.. haven't tested this patch out on the trunk, but it should work. I patched the 24/02 version posted on these forums, but the trunk isn't all that much different.
You have to manually create the pics directory or you'll get some odd error that you require an internet connection :P

mmm, i seem to be unable to upload the path here.. its not allowing .txt or .patch filenames :(
uploaded it here: http://code.google.com/p/cardforge/issues/detail?id=16
This is very cool! I've been meaning to look into this myself, since all those images really clutter up the root directory of MTGForge...

How do these .patch files work? Is it some SVN repository thing? If possible, could you post your code changes, and I can just manually update my own code?
Thanks :)
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: New card pics algorithm

Postby MageKing17 » 08 Feb 2009, 22:48

It's just a diff file. You can open it in any text editing program to see the changes.
User avatar
MageKing17
Programmer
 
Posts: 473
Joined: 12 Jun 2008, 20:40
Has thanked: 5 times
Been thanked: 9 times

Re: New card pics algorithm

Postby DennisBergkamp » 09 Feb 2009, 00:51

Ahh, you're right. I got it working, thanks :)
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: New card pics algorithm

Postby Helza » 09 Feb 2009, 19:01

In most SVN client you can also apply these diff/patch files directly. I used TortoiseSVN to create the path file... you can then easily apply it using the apply patch of TortoiseSVN on other systems..
Helza
 
Posts: 12
Joined: 14 Jan 2009, 23:54
Has thanked: 0 time
Been thanked: 0 time

Re: New card pics algorithm

Postby DennisBergkamp » 09 Feb 2009, 20:10

I'm using tortoiseSVN, but I don't really know how to use all of its features. I've mostly just used it to download things from online repositories :)
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: New card pics algorithm

Postby Helza » 10 Feb 2009, 19:57

I use it at work alot and love it :) , although i never used it to create a patch.. (just lots and lots of merging)

You can just right click in the directory where you have a checkout of your repository and then click on TortoiseSVN -> Apply Patch
Helza
 
Posts: 12
Joined: 14 Jan 2009, 23:54
Has thanked: 0 time
Been thanked: 0 time

Re: New card pics algorithm

Postby Rob Cashwalker » 11 Feb 2009, 04:29

So, we've discussed whether we can simply download all pics by base URL - like the following:

http://www.wizards.com/global/images/magic/general/{Card_Name}.jpg

I've made a download algorithm for this in my cardset editor, and can now backup my fear - not all cards are available from the above folder. Of the cards we support, the following card pictures are not present there:


alaborn_grenadier.jpg
alaborn_musketeer.jpg
alert_shu_infantry.jpg
armored_griffin.jpg
chorus_of_woe.jpg
craven_knight.jpg
desert_drake.jpg
desperate_charge.jpg
djinn_of_the_lamp.jpg
elite_cat_warrior.jpg
festival_of_trokin.jpg
hulking_goblin.jpg
keen_eyed_archers.jpg
moaning_spirit.jpg
mountain_bandit.jpg
natures_ruin.jpg
norwood_archers.jpg
ogre_berserker.jpg
overwhelming_forces.jpg
raging_minotaur.jpg
righteous_charge.jpg
royal_falcon.jpg
spotted_griffin.jpg
talas_scout.jpg
talas_warrior.jpg
undying_beast.jpg
valorous_charge.jpg
virtues_ruin.jpg
virtuous_charge.jpg
warriors_charge.jpg
wild_ox.jpg
yellow_scarves_troops.jpg
zodiac_dog.jpg
zodiac_horse.jpg
zodiac_ox.jpg
zodiac_rat.jpg
zodiac_snake.jpg
zodiac_tiger.jpg

So we must continue defining URLs for each card.
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: New card pics algorithm

Postby MageKing17 » 11 Feb 2009, 09:47

Those are Portal cards. Incantus grabs its card images from that folder, so I can tell you that every non-portal card image is in that folder (except for Scornful AEther-Lich, for some bizarre reason).
User avatar
MageKing17
Programmer
 
Posts: 473
Joined: 12 Jun 2008, 20:40
Has thanked: 5 times
Been thanked: 9 times

Next

Return to Forge

Who is online

Users browsing this forum: No registered users and 38 guests


Who is online

In total there are 38 users online :: 0 registered, 0 hidden and 38 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 38 guests

Login Form