Patching/Updating games - How would it work?

If I had a jar file on multiple computers, how would I connect to all of them and edit files they have to update them like a patch? Would I search the whole computer for that file and delete it and replace it with the new file? Or perhaps change its’ class files?

HAAAAAAAAAAAA you wish. Only hackers can do such things.

What you should do, is before running the game, connect to your game server or something like that, check the version of client’s program against version of server’s program. If the version doesn’t match, you need to download files from the server, so that client has up to date files.

Did you seriously never notice how games patch up? Like when you start a game it says checking for updates? And if updates are available it downloads those updates and installs them? (Not games, all software does this)

This topic has been discussed at length before (both on this forum and elsewhere), there is no need to ask “how does it work?” when the information’s already been given to you.

This is also a deployment issue, meaning it is irrelevant until you have a game to deploy; you should focus on you actual project instead of side-projects like these (although I know it’s hard not to), as doing so is the fastest way to lose motivation and burn out on a project.

Woah woah woah! I noticed this, I just don’t know how it works bub :p.

How would you send files to a server? I think I understand how but I’m not sure.

But I didn’t understand the previous posts.

Oh! I think I got it! Maybe the server will send the newer jar to the client and delete the original version, replacing it with the new one. Either that or the files inside of the jar get replaced. If I’m correct, I’ll write this down for when I do need to use it.

For overwriting individual files in a zip archive (such as a .jar file) you can use ZipOutputStream and there is even a JarOutputStream especially for jar files. So there isn’t even the requirement to download whole jar files.

I think you misunderstand something… You need to have a pre-game client. It would check the version of your game. If the version is older than the server specified version, your pre-game client would download the newest .jar file from the server and replace your current version .jar with the newly downloaded .jar

Then, pre-game client would start the .jar as usual.

So I would neeed only one client? The pre-game-client to check for the updates?

  • Player opens GameLauncher.exe; (Which is actually the place to start your game)
  • A window opens up that says information of what the GameLauncher.exe is currently doing;
  • GameLauncher.exe connects to your game server;
  • GameLauncher.exe requests the version of the game currently loaded on the server;
  • If the version received from game server matches the version of Game.jar, GameLauncher.exe starts up Game.jar;
  • If the version received from game server doesn’t match the version of Game.jar, GameLauncher.exe download Game.jar FROM the game server, replaces old Game.jar and starts up newly downloaded Game.jar

Should be completely clear now.

Amazing! Based off your LICENSE text file, would I be able to use this in my own project as long as I have the license shown?

Who is that question directed at?

trollwarior

Well what license are you talking about? He just gave you an idea, I don’t see any shared code.

In one of his recent post he had a Launcher Program that linked to this post.

You can also use Java Web Start to do it automatically for you: http://examples.javacodegeeks.com/java-basics/web-start/java-web-start-getting-started/

WebStart’s surprisingly crap though. And presupposes you’ve got a working system JVM installed in the first place.

Cas :slight_smile:

I should probably be ashamed of not know about Java webstart but does it scan the clients files?

No you shouldnt, its completely obsolete and not worth your time :slight_smile:

I don’t understand why you have this notion of scanning files? There is no scanning and searching. The updater is in the same directory as the game, and it simply replaces all files (the entire JAR files get replaced too, it’s pointless to replace individual class files) that need updating.

I should have said the jar file. I really don’t know how I’m going to send a jar file with server side programming though.