简体   繁体   English

使用HTML5进行本地存储 使用Javascript

[英]Local storage with HTML5 | Javascript

I've been working on a game using HTML5 for awhile and it's getting to the point where downloading the assets on load is becoming quite a hassle. 我一直在使用HTML5进行游戏,并且它已经到了在负载下载资产变得非常麻烦的程度。 I've created patchers for games before, so doing so wouldn't be an issue but I'm not sure how to go about storing the data. 我之前已经为游戏创建了修补程序,所以这样做不会成为问题,但我不确定如何存储数据。

LocalStorage only allows around 5MB of storage, which isn't enough for anything larger than a basic 2D game's worth of assets. LocalStorage只允许大约5MB的存储空间,这对于任何大于基本2D游戏的资产来说都是不够的。

Considering my game is almost 70MB now (It's not too large, but definitely not something you want to wait to load every-time you open it, especially as a developer) it's becoming a necessity to use some form of disk storage for reading/writing data. 考虑到我的游戏现在几乎是70MB(它不是太大,但绝对不是你想要等待每次打开它的东西,特别是作为开发人员),使用某种形式的磁盘存储来读/写是必要的数据。 (Game models, Music, Client code) (游戏模型,音乐,客户端代码)

Is this possible and if so how should I go about it? 这是可能的,如果是这样,我该怎么办呢? I'm expecting the full size of the game to end at around 220-270MB when we go into Closed Beta from Alpha and that's way too much to download every time apposed to checking file validation and updating what needs to be updated. 当我们从Alpha进入封闭测试版时,我预计游戏的完整大小将以220-270MB左右结束,并且每次下载时都要下载太多,以便检查文件验证并更新需要更新的内容。

I would try to cache some content on the browser and use IndexDB if possible. 我会尝试在浏览器上缓存一些内容并尽可能使用IndexDB

PS: You may be interested on this project too: LargeLocalStorage PS:您可能也对这个项目感兴趣: LargeLocalStorage

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM