Important note about uploading HTML5 games

19 posts

Flag Post

We have heard from a few developers about issues with updating HMTL5 games; specifically, developers not seeing the new versions of files after the normal amount of time (about 15 minutes) it takes for the server cache to clear.

Here is a tip to help prevent this problem:

When uploading a zip archive of additional files for your HTML5 game, make sure you are compressing sets of loose files rather than a folder or directory.

When a zipped folder of files is uploaded to our server and unzipped, a subdirectory is created for the folder’s contents, changing the relative paths of those files. For instance, instead of seeing a file at

kongregate.com/gamez/1234/5678/live/example.txt

uploading a new version in a zipped folder named New_Game_File_Folder0001 would give it the filepath

kongregate.com/gamez/1234/5678/live/New_Game_File_Folder0001/example.txt

This can result in game files not appearing to be updated unless the filepaths in the game itself were changed. To avoid having to do this every time a game is updated, and to avoid versioning problems in general, zip archives of loose files so that new versions will replace older ones in the proper locations in your game directory.

 
Flag Post

This solved my problem. Thank you.

I don’t know what they are doing but if I’m testing something on their upload system and then make it live…

it should use the files from the test system.

Wasted a lot of time trying to figure out what is going on.

 
Flag Post

Hello,

is here someone who could explain me this article in german?

And another question: Could it be possible to delete old additional files in future? That would be great.

Greetz from Germany

 
Flag Post

I am having trouble even getting preview to update. I take all my files except the index.html and zip them together. They are scattered on desktop when i select them to be zipped( it wasn’t clear on what “When uploading a zip archive of additional files for your HTML5 game, make sure you are compressing sets of loose files rather than a folder or directory.” meant to me). I then just follow along like i did when uploading the game the first time. Preview game shows the old version and has for days now even after multiple new version attempts. I’ve cleared cache over and over and i’m about to go crazy trying to get this to work. Using Construct 2 and Game name is Wealthy. New version I am trying to get loaded is V1.0.1

 
Flag Post

That’s the same problem I have.

I tried a lot of ways: just saving als zip without compression, with folders, without folders, with same zip-archiv-name, with different names … nothing worked.
The preview has allways the same old additional files I uploaded at the first time.

I would really could update games and build my old ones in HTML5, but that way it does not make me feel happy. :(

 
Flag Post

i really don’t get it… I tried a lot of things and now it seems that the files can’t reach the images. People are complaining but i can’t fix it.

http://www.kongregate.com/games/MuffinMiceStudio/idle-computer

even tried what MePlayItOnline said, without succes

 
Flag Post

I had trouble uploading new versions as well.. fixed it by rearranging my entire additional game files into a map with a structure like this:

-game.html
-src/game.js
-src/audio/audiofile.wav
-src/audio/audiofile.mp3
-src/images/image1.bmp
-src/images/image2.png

now when prompted to supply the files for a new version upload:
-supply the html as main file
-supply a zipped file with the CONTENTS of map src and name it src.zip

 
Flag Post
Originally posted by jclor:

We have heard from a few developers about issues with updating HMTL5 games; specifically, developers not seeing the new versions of files after the normal amount of time (about 15 minutes) it takes for the server cache to clear.

Here is a tip to help prevent this problem:

When uploading a zip archive of additional files for your HTML5 game, make sure you are compressing sets of loose files rather than a folder or directory.

When a zipped folder of files is uploaded to our server and unzipped, a subdirectory is created for the folder’s contents, changing the relative paths of those files. For instance, instead of seeing a file at

kongregate.com/gamez/1234/5678/live/example.txt

uploading a new version in a zipped folder named New_Game_File_Folder0001 would give it the filepath

kongregate.com/gamez/1234/5678/live/New_Game_File_Folder0001/example.txt

This can result in game files not appearing to be updated unless the filepaths in the game itself were changed. To avoid having to do this every time a game is updated, and to avoid versioning problems in general, zip archives of loose files so that new versions will replace older ones in the proper locations in your game directory.

This does not seem to work. My zip file was called content.zip. I originally had my javascript files in a “script” folder and they were not updating. Then I moved the script files to be directly in the content.zip and they are still not updating.

 
Flag Post

ceptri: Subdirectories are okay, as long as those folders are loose within your game files. Your game files seem to be in the right place. When did you last try uploading?

 
Flag Post

I’ve got the same problem.
So if I understand, I’ve got 2 ways to update my HTML5 games :
- change the path for each version
- keep the same path (with loose files, or with zyplogames folder organisation) and wait 15mn to test the new version.

In both case, it’s not easy to figure it out by ourself…
Will this be improved?

 
Flag Post

This is what I’m doing.
I have the main project folder where the html file is, all files are loaded relative to this location.
I ctrl+a and select everything, I deselect the html and add to a zip archive.

After uploading I try to play, no update (which is odd seeing that I set my game engine to specifically deny caching of files for the development run, perhaps kongregate overrides this or chrome ignores it (works fine on my test server though so I find it unlikely chrome ignores it), after 30 minutes there’s still no update. 2 hrs, still no update, 12 hours no update, 24 no update, 48 hours later and the files are finally being used.
Quite annoying as by then I will have made new iterations that I can’t upload because I need to make sure my changes work on kong and not only my local test server.

 
Flag Post

Agree – this is pretty rough. Even a simple ftp interface would be a massive improvement here.

 
Flag Post

I had the same problem with my new game Plexr ( http://www.kongregate.com/games/kitoba/plexr-2-0 ) —I imagine it’s probably caused by some server setting that is doing some additional caching of “static” assets, i.e. js and css.

Here’s what worked for me: The index.html page seems to update immediately. The only files I was changing were my main js and css files, so I renamed those with timestamps, and edited the index file to point to the current versions.

After that, I started seeing my changes immediately.

 
Flag Post

Can anybody explain this in a simpler way? I have a hard time following

 
Flag Post

Sorry to dig up an old post, but I have the same problems as mentioned above. I am indeed zipping sets of loose files, but the game is not up to date.
Updates may take between 10 and 30 hours before showing up.
Still weirder, some players were displayed different version of the game when refreshing the page. I tried everything I might have seen, like using loose files, changing files names, etc, nothing works as expected. Updates still take tens of hours, or days, to show themselves after uploading the files.

 
Flag Post

Alright here’s what I did after @Kitoba’s suggestion and it worked. Export your project to Konstruct. Change the names of c2runtime, c2webappstart and your jquery-(usually 2.0.0) (These are the hearts of your games) and then go to the HTML file, open it and near the end it will reference those files change the reference to what you’ve renamed it.

4 example: I’m uploading an update to my game. I went and exported the game in Konstruct. I changes the names of c2runtime, c2appwebstart and jquery to c2runtime2, c2appwebstart2, and jquery2.0.1. I open my index.html file (in notepad, but any html editor should work as well( and then changed those names on the page.

So now my html file looks like so: (I bold the things I changed (added))
<!-- Pages load faster with scripts at the bottom --> <!—-

script src=“jquery-2.0.1.min.js”></script

script src=“https://ssl.kongcdn.com/javascripts/kongregate_api.js”></script

The runtime script. You can rename it, but don’t forget to rename the reference here as well. This file will have been minified and obfuscated if you enabled “Minify script” during export. —>

script src=“c2runtime 2 .js”></script

script src=“c2webappstart 2 .js”>

 
Flag Post

Thank you so much for these very precise procedure ! I did as you explained, changing these 3 files’ version, and editing their reference name in the index.html, but this does not seem to work for me:
after upload on preview, the result depends on the browser I used. First one, old files were still showing, and on second browser (maybe because the cache was cleared), game preloader got stuck as if some file was missing.
I waited 15 minutes to make sure that the new archive with the edited name files was cached, but when refreshing preview page, the results were the same.

Thank for your time, anyway !

 
Flag Post

bump
Have tried several methods. Both loose zip and re-naming to version number with mixed/inconsistent results. Please fix!

 
Flag Post

Yeah, this is a huge issue, especially for UNITY exports, where renaming files and changing their loading scripts to point to versioned files is a bit of a pain. Please get this fixed.