-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|635|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Article Home -> Presentation and Organisation

Created : 13 February 2012
Edited : 15 February 2012
System : Cross Platform
Language : Flash

Patching for MMOs: A general approach

Description of a general approach to patching clients

For the last few days (since Saturday) I've been working on a patching-system for Project Dollhouse.
Originally it was going to consist of an FTP server and client, but after giving up on implementing FTP, I started writing a PHP-script (as suggested by Jay).
What the script does is:

  • Check the available manifests serverside against the client's version.
  • If a manifest is found that is newer than a client's version, the script opens it and checks if it has a child and/or a parent. If it does, the child and/or parent is sent in a zipped file to the client.

The script is called 'patch.php', and looks like this (Unix-version):

A manifest basically dictates which files a patch/update consists of. They are ASCII files with their version as the name and a *.manifest extension.
Example manifest (generated by Manifestation):

As you can see, this manifest has a parent, which is the next patch/update released.
It has no child because it is the first patch released.
Then it specifies the number of files to follow.
Each file consists of a full path + filename, followed by a checksum. The checksum is used by the client to verify that a file was successfully downloaded.
What's important to note is that the path to a file is assumed to be where the file will be located on the client's side.
Serverside, files are always assumed to be located at https://www.webserver.com/patches/PatchVersion/File1.file

In addition to 'patch.php', the patching-suite for Project Dollhouse also consists of a tool for generating patches called Manifestation and another script called 'getmanifest.php'. Manifestation can be downloaded here.

Here is the design for how a client should behave in order to ensure it is fully up-to-date (since this article is supposed to be general-purpose, I won't delve into the sourcecode for the client here);

Now to the last step in this general approach to patching;
fetching manifests. Arguably, a patch-client could do this manually, but I feel it would be a little safer to have a script do it instead. So I wrote 'getmanifest.php';

This script is invoked by a client as such: https://www.webserver.com/getmanifest.php?Manifest=Manifestversion.manifest

It will then send the requested manifest to the client, or an error if the manifest wasn't located.

This might not be the most effective, safe, or even reliable way of patching clients, but it works. If you have any questions, post them below.