Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm just starting out HTML5 game developement (and game dev in general) and watching all the videos and tutorials available something has crossed my mind.

Everyone keep saying I should set the cookie's (or cached files) to be expired after a certain amount of time. So that when it reaches that time the browser automatically downloads all assets again, even if it's the same asset's.

Wouldn't it be possible to manually define the version of the game? For example the user has downloaded all the files for 1.01 of the game, when updating I change a simple variable to 1.02. When the user logs in it would compare his version to the current and if they are not equal only then it downloads the files?

This could even be improved to download only specific files depending on what needs to be updated?

Would this be possible or am I just dreaming? What are the possible downsides of this approach?

share|improve this question
Of course it is possible, you can do the same with never expiring cookies also. Or, by providing web based user authentication that holds what version / revision the particular user is using, if lower than production, update. This approach has no downsides! There is also an option to serve files with version number, like texture.jpg?v=2012-29-06-1429, and, if the version has changed, the file, in theory, would get auto re-downloaded. – joltmode Jun 29 '12 at 11:31
up vote 1 down vote accepted

For that to work you need to go online and check for a new version, when the user opens the game. It's just a simple ajax call to the server, that then returns the current version number an perhaps a releasedate. That's how programs i general do it, so you should be able to do the same.

All that is left is then to compare version number, that you might save in a static variable, and download the new one if a newer version is available.

share|improve this answer
Yeah I thought that too, that's why I was surprised everyone were advocating the cookie expire method (Google Tech Talks included) but no mention of this much better technique. I thought there might be something in the spec preventing it. I'll leave the question open for a little longer to see if someone has other inputs. – justanotherhobbyist Jun 30 '12 at 0:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.