It is currently 29 Oct 2025, 10:44
   
Text Size

Alternative to downloading pictures en masse

Post MTG Forge Related Programming Questions Here

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

Alternative to downloading pictures en masse

Postby Rob Cashwalker » 02 Nov 2010, 04:08

I'm trying to think of what to do about downloading set-specific images. Somehow, no matter what server source, leeching that many pictures is just bad karma for all of us....
So I started thinking about how I might be able to work around that.... First thoughts were to only allow one set to be downloaded at a time. Second, distribute the requests across multiple mirrors.
I considered the fact that the HQ pics are mirrored in particular folder structures, that can easily be assembled on the fly. For LQ, I considered writing a script to invoke ImageMagik running on a webhost to do the dirtywork for me.

And then I started looking back to where Forge actually loads the picture, and I realize that we have the opportunity to kill a few birds with one stone.

ImageCache, line 81:
Code: Select all
File file = new File(path, key + ".jpg");
                        if(!file.exists()) {
                           //DEBUG
                            //System.out.println("File not found, no image created: " + file);
                            return null;
                        }
So, if the file doesn't exist do nothing? Not even the debug? How 'bout if it doesn't exist, attempt to go get it?
HEEEEEYYY, wait a sec!
I set a breakpoint, and realize that it only attempts to load the file when it actually needs to draw it. Not at startup, not even when launching a game or the deck editor. Nope, only when it's drawn.

So if there's likely to be a few cards out of 5000 that we never will actually load, why do we need to have them on the drive? If we ever do need to see the card, how long does it take for Forge to grab the pic? (as long as there's internet.. but how often are you without? OK... mtgrares, is a big exception...) The worst case scenario (load-time-wise) is an opening hand of singletons that you have never seen before.

Certainly by spreading out the downloads, there is less impact on the servers, which would have been a legitimate gripe against us.
Thoughts?
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: Alternative to downloading pictures en masse

Postby timmermac » 02 Nov 2010, 04:58

Honestly, I've taken recently to grabbing cardpics as needed from the Gatherer site. That's been easier than finding the picture that I need on my hard drive, as I'd already grabbed everything through M11 for another game that I play on a very rare basis.
"I just woke up, haven't had coffee, let alone a pee in 7 days, and I find out you stole my ass and made a ...mini-me! Carter, I should be irked currently, yes?" - Jack O'Neill
User avatar
timmermac
Tester
 
Posts: 1512
Joined: 17 May 2010, 20:36
Has thanked: 18 times
Been thanked: 95 times

Re: Alternative to downloading pictures en masse

Postby jeffwadsworth » 02 Nov 2010, 17:46

What about a torrent of the card pictures? That is how I obtained mine. Would this be considered taboo/illegal? I do not see how considering the fact that Google has every card in multiple formats linked.
jeffwadsworth
Super Tester Elite
 
Posts: 1172
Joined: 20 Oct 2010, 04:47
Location: USA
Has thanked: 287 times
Been thanked: 70 times

Re: Alternative to downloading pictures en masse

Postby timmermac » 02 Nov 2010, 17:53

somebody in the CCGHQ pictures thread posted a torrent some time ago that we have access to.
"I just woke up, haven't had coffee, let alone a pee in 7 days, and I find out you stole my ass and made a ...mini-me! Carter, I should be irked currently, yes?" - Jack O'Neill
User avatar
timmermac
Tester
 
Posts: 1512
Joined: 17 May 2010, 20:36
Has thanked: 18 times
Been thanked: 95 times

Re: Alternative to downloading pictures en masse

Postby Rob Cashwalker » 02 Nov 2010, 19:25

A Torrent is fine for someone with a big pipe and who already knows what to do. Consider Chris, who is still on Dialup...

Forge can be configured to pull pics from a particular folder, if you already have the pictures.

Google archives the thumbnails as it finds them. It doesn't download 5000 of them in one shot (like a new user) and doesn't do anything else... like allow you to play.
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: Alternative to downloading pictures en masse

Postby Huggybaby » 05 Nov 2010, 21:09

Load the card only when drawn? That's a clever idea Rob.

BTW, I've been looking at Dropbox lately, I wonder if that could work?
User avatar
Huggybaby
Administrator
 
Posts: 3229
Joined: 15 Jan 2006, 19:44
Location: Finally out of Atlanta
Has thanked: 754 times
Been thanked: 601 times

Re: Alternative to downloading pictures en masse

Postby nantuko84 » 05 Nov 2010, 22:05

Hi,

Here is how downloading was implemented in MagicWars
1. Client asks server what cards implemented it has
2. Every card has set and collect id
3. Urls are being generated based on these two values
4. Client starts downloading

But anyway it takes too much time to download all 2500 card pics (whenever any card is implemented in MW, it automatically implementes the same card for all sets, so for Shock it will download about 10 cardpics from various sets)
That's why there is an option in download dialog to download card images for current game only that usually about 30-50 unique cardpics. That really makes sense as you can start playing with images immediately.

There was also good blog entry in Laterna Magica where he described that downloading can be much faster if you download images using several threads as it takes a lot of time to save image on disk and you don't use your internet channel efficiently.

~regards
nantuko
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


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 25 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 25 users online :: 0 registered, 0 hidden and 25 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: No registered users and 25 guests

Login Form