How to update the files of my game

Hello folks,

i have a question about How could I update the files of my game or any other software if the version changes?
That is to general that is why i’m going to explain what i have thaught of:

My Software/Game downloads a file called versionNew.txt If the content of the VersionNew.txt is not the same as the content of VersionOld.txt then:

  1. the content of VersionOld.txt should be the same as the content of VersionNew.txt
  2. VersionNew.txt should be deleted.
  3. The UpdatePrograme should download a Folder e.g. “NewFiles”
  4. Old Files&Folders should be deleted
  5. New Files&Folders should be copied into the root directory of the software.

Now I have 2 Problems.

  1. How should I do this?
  2. Is there another way to do it easier?

P.S.: It is for Updating Events or changes for my RPG that I am currently working on.

Realy need your help.
Thanks,
error777

yes, infact there is an easier way ;).

webstart/applet is the answer.

if you dont like them having to run formt eh saite. then just give them the jnlp file.

I did this very thing with Martians Vs. Robots. But rather than deleting, moving, copying, whatever, I just have the app download over the current stuff and then dynamically load the jars.

I should warn you however, Windows Vista won’t let you do this unless your application is installed somewhere under the current user’s home directory. If you try to do it somewhere else, it’ll act like it’s working, but then fail miserably (Vista automatically redirects the downloads to some obscure user directory). Webstart still ends up being the best bet for autoupdates because of this… too bad it’s so ugly.

Don’t download the updated jars to the application directory, but to a dedicated “updates” directory somewhere under FileSystemView.getFileSystemView().getDefaultDirectory() like


File updateLocation = new File(FileSystemView.getFileSystemView().getDefaultDirectory(), "My Fancy Game Title/updates")

In the launcher, set up two URLClassloaders, one with the updated jars (updatesClassloader) from this location and one with the original application jars (appClassloader). Important: set the updatesClassloader as parent of the appClassloader to make sure, your updated classes are loaded first. Then you can load your games main class from the appClassloader, and call the main-method via reflection.

ok so it seams that i will use the jnlp thing.
But i got some problems:

  1. How does a jnpl work? I’ve seen it in games but still i don’t know how to use it.
  2. Can you unpack a jnpl file?
  3. Are there only class files

Or let me put the question simpler: Where can I find a good explanation to how i create this jnpl file and how i use it and a description will also be very useful.

Thank you,
error777

http://java.sun.com/developer/technicalArticles/Programming/jnlp/

Also Netbeans can generate webstartable apps out of the box.

java can not supply this function,but if you are base on c++ as mtk or symbian you can do this
three years ago i have the idea as you …

Webstart isn’t a viable deployment strategy. When I tried it over facebook, only 40% of users were able to launch my game.

If your game is deployed as a downloaded application, build a stable updater that does what you describe. Then use classloaders to launch your app.

The advice given about Vista is spot on. I just have the patcher sit in the applications folder, and download the entire game to a folder in their documents tree and run it from there.

Applets aren’t bad, but they have an annoying habit of caching old files. I’ve yet to find a setting that will reliably force browsers to update it.

If you offer a download, only 10% might be willing to download the game. That would be less than 40%… I think I would be too lazy to download a facebook game. Other games yet, but facebook?

I was calling .getDefaultDirectory() in an unsigned applet, as parameters to a java.awt.FileDialog, and it started throwing SecurityExceptions in Windows 7 :-\