Jump to content
  • Advertisement
d000hg

HTML5 Limits and workarounds for storing large amounts of local data

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Posted (edited)

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).

Edited by SyncViews

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!