View Full Version : Implementing Game launcher with autoupdate

Mario Donick
21-05-2010, 12:34 PM

Has anybody tried to implement a game launcher (such as in these online games like WoW) that automatically checks for updates, downloads these and patches the game files?

I never did network programming before, but as I update my game very often, such an optional feature could be conveniant for some players (I believe esp. for the Windows players).

I'm using FreePascal and I think about this

1. On the HTTP server, I store the most recent version of the game as compressed archive.

2. On the player's computer, I store the installed version number.

3. If the version number (in the filename of the archive) is higher than the player's version, the update is offered
--> Task 1: How to connect to the server and read out the file name of the archive?

4. If the player accepts to update, I initiate the download and store it in a temporary directory
--> Task 2: How to initiate that download and close the connection afterwards?

5. Once the archive is downloaded, extract it to the game's program directory.
--> Task 3: Is archive extraction supported by FreePascal, and how?

Any answers, or tutorials you could point me to, would be highly appreciated.

Edit: An alternative could be simply a webbrowser component that displays the website with the latest patch, and the player clicks on the download link manually. But then I wouldn't be able to extract it automatically, would I?

Thank you!

21-05-2010, 02:20 PM
Put a text file on the server (xml or similar) containig the version number and download link(s). Download that using a http get.

<?xml version="1.0"?>


Then download the file using Indy or similar.

And finally unzip the zipped file

Note that the blizzard downloader uses torrent instead of http download wich is good if you are limited on band width. (They do have a fallback http link in case there is no seeders)

21-05-2010, 03:08 PM
The short answer to your question is, yes this is all doable and has been done several times. In fact, it's fairly short and simple work.

The real question is: Are you wanting an off the shelf solution (IE: Someone else wrote it and your going to use it) or do you want to make your own?
The other real question is: What language do you have for your hosting environment; PHP, .NET, RoR, ???

This plays a difference. If you have PHP and MySQL and are wanting a fairly off the shelf solution, I'll post up the stuff I've been working on for you to do as you please. I have to admit though; its rough but robust as I hope to use it across all of my projects eventually.

- Jeremy

Mario Donick
21-05-2010, 03:55 PM
Thank you Andreaz and jdarling for your answers.

I think esp. the link to that Indy project may help me to better understand the theory and application of network programming. Also thanks for the the torrent hint.

Now for the questions:

1. I have some webspace with PHP and MySQL, but while I use PHP very regularly and have some experience with it, I never touched MySQL so far. The weblog software I use on the website of my game is written by me, but uses plain text files for storing articles, comments and other data.

2. Usually, I store my program archives on Google Code, because some of them are rather big (about 100 MB or more). I get direct download links for the archives, so I could put these into the XML file suggested by Andreaz.

Overall, I'm interested in both ways. If you, jdarling, have a working solution, I would appreciate to get it explained. I will, however, check out the Indy thing, to get a better understanding of networking stuff.

21-05-2010, 04:26 PM
You don't absolutely need PH/mysql for creating an autoupdater, but it would allow you to track stats, I guess. All that's really needed is a simple text / xml file that contains version info.

If you want to get even more advanced, perhaps you could look into generating file checksums so the entire game doesn't have to be downloaded every time -- just what's changed.

As for unraring, I doubt there'll be many components that do that, but there are some that do zipping. I've only fiddled with one zipping component so far, and it didn't support compression, so read the release notes of these things carefully.

And for networking, there's of course lnet, indy, synapse...

21-05-2010, 05:18 PM
One of these days Chad or one of the other Indy members is going to see me posting about Synapse and chew me one, but until then, If your looking cross platform Synapse is the best solution. Indy is the best solution when it comes to Delphi on Windows.

The PHP/MySQL requirements are just what I'm using for my updater, there are of course, other ways of doing things. But I needed a way to update any product/project and wanted a basic launcher that I could just place in with the app and then forget.

Currently the parts I still need to complete are:
1) Compression - I'm using raw blocking right now, bloated but works
2) Comprehensive vs Patch downloads (IE do you bring down v1, v1.1, v1.2, and v2 or just v2)
3) Making it look better :)

Give me a few days and I'll see if I can't get something up so you can see it.