14 ms·
How do you "install" a game? For example, let's say you have 150MB of art assets. You wouldn't want players to have to re-download the assets each time they g
by palish 16y ago
How do you "install" a game?
For example, let's say you have 150MB of art assets. You wouldn't want players to have to re-download the assets each time they go to play.
So how would you cache: 1) a texture, 2) a vertex+index buffer?
- lilli 16y agoCheck out the HTML5 LocalFileSystem APIs. They aren't widely available yet (Chrome 9+, behind a flag) but they are exactly what you want for this kind of thing. http://www.html5rocks.com/tutorials/file/filesystem/ http://www.html5rocks.com/tutorials/file/filesystem/
- lilli 16y agoAlso, I should mention Application Cache (5MB local storage). Very useful for static game assets: http://www.html5rocks.com/tutorials/appcache/beginner/ http://www.html5rocks.com/tutorials/appcache/beginner/
- chc 16y agoEh, it's moderately useful. 5 MB is nothing these days — that's smaller than the L3 cache on a modern processor. If your game is only 5 MB, you hardly even need caching.
- maggit 16y agoThe browser caches assets like that automatically. Alternatively, if you want to have a more install-like install, you might have luck with local storage: http://diveintohtml5.org/storage.html http://diveintohtml5.org/storage.html Local storage seems to currently max out at 5 MB, but that's easy for the browser vendors to change if they see the need.
- azakai 16y agoYou can't rely on the browser cache, it is limited in size and depends on other websites as well. Localstorage is useful, but as you say limited. The real solution is IndexedDB. Partial (but useful already) support is in Firefox and Chrome. Other browsers are expected to follow soon.
- bajsejohannes 16y ago> You can't rely on the browser cache, it is limited in size and depends on other websites as well. And as if that wasn't enough, browsers don't trust expiration dates in HTTP, either. Press reload enough times, and all resources will be reloaded.
- simias 16y agoCache size is (fortunately) limited, and I wouldn't want a webapp to be able to store 100+MB of data in local storage without explicitely asking for my consent beforehand.
- MatthewPhillips 16y agoThis hits on one of the biggest obstacles to people perceiving web apps as "real apps". Most web pages feel, and in actually are, very disposable. You read an article at a site once, you don't want those assets to persist on your hard drive where they'll never be reused. Many people clear their caches regularly. What we need is a way for a site to say "i'm an app" which will tell the browser to store the cache in a separate bucket. Then when users go to clear their cache, there is a separate checkbox for web apps which is uncheck by default (just how passwords are unchecked by default). This is what Mozilla should be working on with it's web apps project. The installation part is just mascara. We need the browsers to do the distinguishing, not users.
- mnutt 16y agoThis sounds like a good idea, but as someone who runs a website, why wouldn't I say that it's an app even if it isn't?
- MatthewPhillips 16y agoGood point. The obvious answer is to prompt the user when a website says it's an app and wants to use special storage options. But wording that might be difficult to prevent confusing the user. It's not as easy to understand as "this website want to use your geolocation" or "this website wants to send you notifications".
- marshray 16y agoI think I heard this was going to be a feature of HTML 5.
- 16y ago