automatic updates/patches ... how?

Can anyone give me a start point for how to either find or write an automatic patcher for an online game?

Specifically there are three things that need to be addressed: code changes or additions in my “client.jar” or “common.jar” jar files, resource changes in one of several .jar files that hold image resources, and resources that are not included in those jars but are in a resource directory structure, for size and loading speed reasons.

All I really want to do is find if there is a new update available, and if there is, download, and possibly update, existing files. Yes, it is to be a forced update.

Any thoughts? Muchly appreciated.

It depends on the specific security needs. For my client, having an older version is harmless (often it won’t work anyway) so what I do is this:

For each jar I want to have updatable, I give it a version field in the manifest of the jar file. When the client is started, I have it download a versions file which consists strictly of version numbers for the jar files as floats. If there is a newer version, I download the new jar from the server and overwrite the older one. Then I call System.exit(0) after telling the user they will need to restart the client for the changes to take effect.

If you need more security, I’m probably not the person to ask.

For the jars - use WebStart. Does exactly what you need. We do it for code and resource jars.

For resources - hm - you could use ‘tagging’ jars that describe what resources have to updated and again exploit webstart installation (jars run first time only when config changed).

I somewhere have a link to a utility lib that allow to address single files from a server via JNLP. I think I have it at work and can provide it tomorrow.

Or simply put the resouces to be update into a jar and let a webstart installer deflate them on the target machine.

Hach, so many ways - life is so beautyful with WebStart (don’t tell C++ world we have it, I think they do it by hand comparing file dates and such …)

Only issues with Webstart that I’m not sure about is that a) I’m using InstallAnywhere Now! and b) doesn’t Webstart cache things? As in there is no definite application install directory?

Yes, this is an app and not an applet.

[quote]b) doesn’t Webstart cache things? As in there is no definite application install directory?
[/quote]
Yes, sure, WebStart caches things. That’s it’s main task. From my point of view I’m not interested in WHERE things are installed. We maintain a 10MB jar application with this easily.
Additionally, WebStarted apps can very well install custom data to custom directories.

For resources - I put them into jars and add a simple class to it that provides me with the resp. URL to the data. That very convenient and makes completely independent of the place things are stored. No directories in my code!

Here is the link I promised:

http://rachel.sourceforge.net/

Maybe take a look at the JCanyon demo?

http://java.sun.com/j2se/1.4/demos.html