-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|407|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Snippet Home -> Internet


 
Afr0
Created : 12 February 2012
Edited : 12 February 2012
System : Windows
Language : Flash

Patcher

Are you writing an MMO? Use this to patch clients!

Took me about 5 hours (I think) to write this. Would have been faster if I could have figured out how to get echo() to work properly without having to comment out code to do it.
For the Unix-version of this script, see below!



The script depends on a function I found by Googling it (because I was lazy). It didn't come with a license, but if you're putting this into a closed source application, you'd better contact the author.



Clients use this by simply connecting to https://www.mywebserver.com/patch.php?Version=ClientVersion

This script will then automatically send a new manifest if one existed, or the two newest ones if the newest one depends on an earlier patch. The client will then have to check if the last oldest manifest received in the zipped file has a child that is newer than the client's version, and request it (I'll be writing a separate script for requesting specific manifests).

Here's some example code showing how a client should use this:



Unix-version


 

Comments


Sunday, 12 February 2012, 06:05
Afr0
Thanks to Jay for the idea for this script!
Sunday, 12 February 2012, 14:56
Afr0
I realized that since this script will only send the first manifest it can find that is newer than a client's version, there's a possibility that there are newer versions than the one the client received.
Therefore I added the ability to specify a parent in a manifest. If this script finds a parent in the newest manifest, it'll zip it along with the one it found and send it.
Then the client has to check if the newest manifest has a parent specified, in which case it should fetch that as well.

In case it isn't obvious from the script, a manifest's syntax is as follows: