Workflow, updating scripts etc

Hello all playcanvas’ers. I’m currently developing an engine-only game, and need some advice.
As my game project gets more complex, I’ve had to get creative with how to upload the game to my webserver. The first step was to write a python script to FTP upload all changed files.

But one problem has arisen:

  • A player who tests my game, then comes back a couple updates later will use some cached scripts and some not-cached scripts. How can I deal with this?

One way I’ve thought of doing it is using the query string to request scripts using:

url/script.js?v=1

which should force the browser to update that cached file. But I don’t want to have to manually decide a version number. I do use a git repository, and so it may be possible for my python script to get some data from there?
Now, it is possible for my python script to search through, and modify all the relevant files, but to do so it will have to take a copy of the game project, parse them, and save them before uploading. It makes the process a lot more complex.

So I guess my question is:

  • How do you manage uploading your game to a webserver?

Hi @sdfgeoff. This is purely web server settings you need to change, that is serving your static files.
If you are using nginx, then it is as easy as adding: expires modified 365d; to location section that is serving your files.

Once you’ve set it up as needed, then you wont have any problems with cache. Computers that currently do have cached version will have to force-refresh page or clear cache manually. After that, all will be fine for them.

You’ve noticed that launching from editor has no such problem, that is because we have proper caching policy set up on the web server.

Unfortunately I don’t have access to the internals of my webserver, I’m just hosting it on a free webhost and they don’t expose that level of control to me.

Maybe it’s time for me to shell out and rent a VPS. It would mean I could host the tracker (a python script) online as well. Or, seeing as it’s all just small static pages, I could use a raspberry pi from home…

If you can afford it, something like Digital Ocean is a good option. $10 a month for their smallest server.

I have just bought a little server from digitaloceans (the smallest was actually $5, and has sufficient specs for the number visitors I am having currently). I’m also going to host the tracker there.

I haven’t changed where the domain name points yet, I’ll do that sometime over the next few days.
edit: Done!


And if you’re thinking: wow! he did that fast, well, in some ways you’re right. But in my defense I was unsatisfied with my current host and was already looking renting a VPS. You just gave me the impetuous to do so.

Thanks for all the help guys.


Previously the tracker was running on a raspberry pi from my home network. I’m considering forwarding it through the router and letting it be the host. Then I’ll compare with the VPS and see if it’s worth it. Spec-wise, the raspberry pi is better (2tb hard drive, 1gb ram, quad-core), so it just comes down to seeing if my internet connection is up to it.