Forum GameFS Only download files if changed

Discussion and help relating to the PlayerIO game asset hosting and CDN solution, GameFS.

Only download files if changed

Postby nlarson » January 14th, 2019, 11:30 pm

Does the system do some kind of check to see if the file has changed and needs to be downloaded?

Neil
nlarson
 
Posts: 4
Joined: March 8th, 2018, 12:21 pm

Re: Only download files if changed

Postby Henrik » January 15th, 2019, 6:15 am

Yes, GameFS files will be properly cached and properly expire from the web browser cache when you update a file.
Henrik
.IO
 
Posts: 1832
Joined: January 4th, 2010, 1:53 pm

Re: Only download files if changed

Postby nlarson » January 15th, 2019, 6:41 pm

Good to know.

I don't think I asked my question clearly enough, which leads to another question.

My goal is to not pull files down if the local copy is already up to date.

Is there some method in the PlayerIO API to request info about the file? For example, could I get a hash or date and then not bother downloading the file at all if it matches my local file?

Or would this be available somewhere directly with SFTP?
nlarson
 
Posts: 4
Joined: March 8th, 2018, 12:21 pm

Re: Only download files if changed

Postby Henrik » January 15th, 2019, 10:20 pm

Pull down files in what kind of context? As a player playing the game? As a developer downloading all your files through SFTP again?

In the GameFS interface, the age of every file is displayed. If you SFTP to your GameFS, I think the creation date of every file should be correct, and a good SFTP client should be able to compare that with a local copy and figure out which ones are newer.
Henrik
.IO
 
Posts: 1832
Joined: January 4th, 2010, 1:53 pm

Re: Only download files if changed

Postby nlarson » January 15th, 2019, 11:03 pm

I have a large map png (40M) and a smaller data xml (15K) file that could change a couple of times a year.
When the player launches his game app, I want to check to see if the files need to be downloaded.

PlayerIO has made everything easy. Downloading the file each time would be easy, but I don't want to use up any bandwidth without a good reason.

Check/Downloading the content via SFTP seems the right way to go.

Thanks for the help.

Neil
nlarson
 
Posts: 4
Joined: March 8th, 2018, 12:21 pm

Re: Only download files if changed

Postby Henrik » January 16th, 2019, 12:15 am

If the game is played in a browser, requesting the file normally from your game should cause all the regular browser caching to kick in, which means it will Just Work, the browser will check cache headers and ask the CDN if there's a newer version, and only downloading it if needed.

Doing some kind of check through SFTP means you have to embed your SFTP password in the game clients, which means that anyone could login to that and edit your GameFS files, which is typically a bad thing.

If you are doing a mobile game, a quick check shows that at least for Android you can enable a cache for all the HTTP requests that your game does, which functions exactly like a browser cache: https://developer.android.com/reference ... ponseCache

There's probably something similar for iOS.
Henrik
.IO
 
Posts: 1832
Joined: January 4th, 2010, 1:53 pm


Return to GameFS