Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog

ShiVa3D

Return to Game programming

save cached files?

All about the StoneScript

save cached files?

Postby dtr1au » 19 Aug 2012, 09:36

I am sure that somewhere on the forums in the distant past I read about saving the files downloaded using the cache api, but my search is turning up empty so please forgive me if it's been asked and answered before.

Basically what i am looking at doing is creating something like "asset packs" which my game will download using cache.addfile. This works fine, and I've no problems, however I want to know how I can ensure this cached file is saved so that my players only need to download it again if they are missing it (or if I force it to update using methods to detect if the pack is newer, which I think I can do easily enough)

Is this possible? am i just missing something silly?

Thanks.
dtr1au
Platinum Boarder
Platinum Boarder
 
Posts: 371
Location: ACT, Australia

Re: save cached files?

Postby dreamora » 19 Aug 2012, 15:19

Thats how it works already

cache files are persistent, not 'till the end of this game run'
I'm no stonetrip representative, just a happy board member like you :)

If you find my portfolio interesting, feel free to contact me or follow my shares on my twitter stream or my game development blog
User avatar
dreamora
Platinum Boarder
Platinum Boarder
 
Posts: 844

Re: save cached files?

Postby dtr1au » 20 Aug 2012, 03:03

Hey Dreamora,

Thanks for the response. That's what I thought would be the case, but it seemed when I was testing last night it did not behave that way and was re-downloading every time... I will run a more in depth test after work tonight and see how I go.
dtr1au
Platinum Boarder
Platinum Boarder
 
Posts: 371
Location: ACT, Australia

Re: save cached files?

Postby dreamora » 20 Aug 2012, 08:30

On what platform are you testing it?
Depending on the platform, the platform vendors put requirements and limitations up that could impact it.

Can you potentially provide the code that you use to get it from cache again later?
I'm no stonetrip representative, just a happy board member like you :)

If you find my portfolio interesting, feel free to contact me or follow my shares on my twitter stream or my game development blog
User avatar
dreamora
Platinum Boarder
Platinum Boarder
 
Posts: 844

Re: save cached files?

Postby dtr1au » 20 Aug 2012, 09:52

Running on Windows7 x64. (will be testing on ios and android in the next couple days)
Managed to get it working how I wanted.

However it seems that within the editor once you stop playing it clears the cache file. I see the cache file get created and when i stop it gets deleted. I tried to find an option to turn off the option to clear cache on application quit but cannot find any option for this. It would be REALLY nice if the cache did not get deleted.

When I exported to a stand-alone it then saved and loaded from the cached file. However I did initially have a problem that if I disconnected from the internet the application would never even load my cached file, was checking for the file version before it loads cache. I found i can set the option "application.kOptionNetworkStreams" to -1 and this tells the application not to check the file versions, and thus works and loads the cached file even if I am disconnected. I can work with this an use other methods to update the file versions.

So in summary, all is good, just REALLY BEG for the cached file when running in editor to be saved (or expose the option disable it being deleted).
dtr1au
Platinum Boarder
Platinum Boarder
 
Posts: 371
Location: ACT, Australia

Re: save cached files?

Postby broozar » 20 Aug 2012, 10:11

User avatar
broozar
Platinum Boarder
Platinum Boarder
 
Posts: 3350
Location: Berlin - Germany

Re: save cached files?

Postby dtr1au » 20 Aug 2012, 11:41

... Well.... don't I feel like a fool. :lol:
Thanks for pointing that out broozar. Life is now good.
dtr1au
Platinum Boarder
Platinum Boarder
 
Posts: 371
Location: ACT, Australia


Return to Game programming