Sign in to follow this  
ehmdjii

updating client software

Recommended Posts

hello, in order to regularly deploy an updated version of my game to my clients, i am looking for a way to release updates, without the user having to redownload all of the game. like the update-mechanisms in todays mmog... are there and free or open source versions out there, to avcoid rolling my own? thanks!

Share this post


Link to post
Share on other sites
Depending on how robust an update system you need, it could vary.

The simplest way is for you to archive a "v1.0" version, and use a shell script which finds each file that is unchanged between a v1.0 folder and the "current" version, and creates the cumulative patch for the change in another folder.


#!/bin/bash
######################################################################
# Usage: {} <reference> <target>
# Creates a folder <target> populated with only those files which
# are new or changed in the current folder, as compared to those in
# <reference>. <target> will be created if it does not exist.
#
# Use this script from your 'release' or 'snapshot' folder. Always
# use a "version 1.0" reference folder if you want to publish
# cumulative patches; use any previous version to create patches
# from one version to another.
#
# Example:
# Assuming {} is on your path
# {} ../archive/1.0 ../archive/1.3
#
# Warning; filenames containing spaces will break this script.
######################################################################
# Changelog
# Tiogshi Laj, 2007-10-15
# Initial version; no support for filenames with spaces.
# NEW MODIFIER, NEW DATE
# NEW NOTES, BUG REPORTS, ETC
######################################################################

# Pull our arguments.
ORIG="$1"
TARG="$2"

# Give a usage message if needed.
if [ -z "$ORIG" -o -z "$TARG" ]; then
sed -n -e "s\ {}\ $0\ " -e '3,/^##/s/#[^ ]* \(.*\)$/\1/p' < "$0";
exit;
fi

# Create the target directory if it doesn't exist.
mkdir -p $TARG

for f in `find . -type f`; do
# Create folder structure for the file.
SRCPATH=`echo $f | sed 's/^\(.*\)\/[^/]*\$/\1/'`;
mkdir -p "$TARG/$SRCPATH";

# Does this file exist in the reference version?
if file "$ORIG/$f" > "/dev/null"; then
NEWSUM=`md5sum "$f" | grep -o '^[0-9a-fA-F]*'`;
OLDSUM=`md5sum "$ORIG/$f" | grep -o '^[0-9a-fA-F]*'`;

# Compare the checksums.
if test ! "$NEWSUM" == "$OLDSUM"; then
echo "C $f";
fi
else
# No; just copy it; preserve timestamps and permissions.
# cp -p "$f" "$TARG/$f"
echo "N $f ";
fi
done




To shrink size further, you'd need to create a more complex patching utility... the option above creates complete patches or incremental ones, depending on what 'orig' folder you use, but it still creates whole-file pieces. If you have lots of plaintext files, or binary files which are modified in particular ways, then you could use diff and binary diff to create incremental patches (though not usually complete ones).

(I was going to leave the shell script as an "excercise for the reader", but then I realized I would need this tool in a few weeks, myself)

Share this post


Link to post
Share on other sites
Any particular reason you're reinventing rsync, Wyrframe? :-)

Personally, I'm just using SVN while my game is in "alpha". It's incredibly easy to just merge changes to the alpha branch, then let players update with the pysvn client integrated into the launcher. SVN isn't really the best solution for distributing binaries, though. That's where rsync comes in.

Here's a link to a stripped-down, distributable version for Windows.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this