Page 1 of 1

dynamic updates or patches

Posted: Wed Jan 11, 2017 10:54 am
by adekto
i was wondering how to add a system to check for updates, download them and run the game with the new files.
im not even sure if this is possible

Re: dynamic updates or patches

Posted: Wed Jan 11, 2017 12:17 pm
by zorg
It is possible, but it's a bit involved; There were a few threads about this before, but the most compelling mode i saw was the following:
- Only have the auto-updater/downloader part in your project (may not be that necessary, but would be cleaner this way), or a splash screen, maybe permitting some settings.
- It would download the code and assets into the save folder (should do it in a <version_number> subfolder if you ask me) of the project, since that's the only location you can write to.
- Have a file there that contains which version you want to run
- love.filesystem.load or require in the <version_number>/game lua file, and call love.load that should exist in it, and boom, you have implemented a thing. :3

Re: dynamic updates or patches

Posted: Wed Jan 11, 2017 1:27 pm
by Tjakka5
I've been attempting to do this, and while I do not have working system yet, I can give a few pointers for sure.

First off, you'd need some kind of (async) script that can download and save code from a server.
Some kind of wrapper for http.request in a thread would do the trick.

Next, as Zorg said you can download everything at mygamedomain.com/version_x_x_x/ into a folder with the version name, and just execute that.
Alternativly you could keep track of every "version" of every file on your server, and only download the ones that are a newer version that you have locally. This may be tricky though.

Then you can run them with love.filesystem.load.

Re: dynamic updates or patches

Posted: Wed Jan 11, 2017 2:56 pm
by skyHights
Tjakka5 wrote:Alternatively you could keep track of every "version" of every file on your server, and only download the ones that are a newer version that you have locally. This may be tricky, though.
Surely you could have mygamedomain.com/latest, have that link to the latest version and have the game check if that version number is newer than the current, and if so download it.

Re: dynamic updates or patches

Posted: Wed Jan 11, 2017 6:47 pm
by Jasoco
I bought into the Concerned Joe preview and they way they did it is they used two separate Löve projects. What you would download is a launcher and update checker which would show news and updates and if you want to update the game or it's your first launch, it would download the files for the actual game into its own folder and launch that .love project separately.

Minecraft Launcher and the Steam app both work the same way. The Launcher is just a launcher which downloads the appropriate Java files into their own folders and launches them as a separate process. And Steam is just a front end that downloads all the needed files when you run it so you can have a tiny compact installer and it makes it easier for them to update later.

Re: dynamic updates or patches

Posted: Wed Jan 11, 2017 8:19 pm
by davisdude
You can also check this out to get an idea of how to make an (albeit, somewhat unsafe) auto-updater.