🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Limits and workarounds for storing large amounts of local data

Started by
3 comments, last by d000hg 5 years, 3 months ago

Can anyone tell me what the limits are for local storage in an HTML5 browser game, and how this varies across browsers? I've seen how advanced games and other projects can be using WebGL and advanced JS pre-compilers these days but data/assets appears a big bottleneck. Let's assume a 100Mbps internet connection (very optimistic) - this means we could download 1Gb of assets in about 2 minutes, which is already a pretty long wait-time before those assets are processed and you can start. Every time you re-load this site, you have to do it again. 

So do Chrome and others (but I'm assuming Chrome is the most advanced) provide a way for storing more than a few Mb between sessions? I understand sandboxing and security mean this is very locked down but are there any workarounds to get local file access suitable for large assets?

I'm assuming compression of assets is already done, and that procedural generation is not feasible, in this question - once everything else is done we still have 1GB+ of data we need.

Advertisement

Are you familiar with IndexedDB, localStorage and the like? Those provide several MB's of persistent storage. It's somewhat browser-specific and I haven't actively used it, but hopefully it gives you a hint what to look for.

Chrome have some API's for local storage, but I do not believe they are standard. Although a Chrome feature, the MDN has the best docs I could easily find

https://developer.mozilla.org/en-US/docs/Web/API/LocalFileSystem#requestFileSystem

MDN says the storage limit on Firefox is potentially 0, and up to 2GB max, which would require at least 20GB free space on the user profile drive due to how it allocates the maximum (on a per eTLD+1 basis, so game.gamedev.net and gamedev.net share a limit).

https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Browser_storage_limits_and_eviction_criteria#Storage_limits

I don't think there is a general way to guarantee such a massive amount, personally Id have thought having a downloadable version is the way to go, but I don't play or develop such web games so not sure what the common practice is there these days


For all "normal" content I would highly recommend using normal HTTP caching for any Javascript and images, which is pretty much perfect and fully automatic, but I suspect has it's data limit somewhat lower than what you need.

 

The other major solution is of course to only load what is needed on demand. This depends a lot on the game, but frequently large assets like music, sounds and textures are not constantly needed (e.g. may be map/level specific).

That "10% of available space" quota limit would be pretty great for us - I assume you have to check the files exist every time because the browser can clear space as it sees fit, but still to reduce the number of times things are downloaded would be cool.

We are also quite able to restrict to a single browser - probably Chrome I suppose.

 

Thanks.

This topic is closed to new replies.

Advertisement