Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (797)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (864)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Game Patcher?  (Read 8118 times)
0 Members and 1 Guest are viewing this topic.
Offline StonePickaxes

JGO Coder

Medals: 5
Projects: 2

Nathan Kramber

« Posted 2013-02-06 16:57:26 »

All I want is to program a simple launcher that will allow players to launch the game and change settings. This launcher will also function as a game patcher.

For this, all I want is for the game to be able to download a new, updated .jar file.

Is there an established way for doing this? Also, how can I track the completion of the download to make a status bar?

Thanks a bunch,


Check out my website!
Offline princec

« JGO Spiffy Duke »

Medals: 1101
Projects: 3
Exp: 20 years

Eh? Who? What? ... Me?

« Reply #1 - Posted 2013-02-06 17:08:59 »

No, there is no established way, but take a look at
and see how they work. (Code's not obfuscated, just decompile installer.jar which also contains the tools used to build the deployment jars and index files)

Cas Smiley

Offline StonePickaxes

JGO Coder

Medals: 5
Projects: 2

Nathan Kramber

« Reply #2 - Posted 2013-02-06 18:17:18 »

Much appreciated.

Check out my website!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline BlacKcuD

Innocent Bystander

« Reply #3 - Posted 2013-03-07 16:13:46 »

I am wondering about that for a while now for my current project. I want to easily distribute the game to friends. I have the server+bandwith but not the tools. Is there really no established way?
It's about time somebody wrote something. Maybe I will provide mine if I can come up with something useful.
Offline Agro
« Reply #4 - Posted 2013-03-08 00:38:00 »

What I would do is ask the server how many bytes are in the patch. Then as you download the new JAR, calcualte how many bytes you are downloading, and make a proportional prgoress bar out of that

Offline HeroesGraveDev

JGO Kernel

Medals: 382
Projects: 11
Exp: 4 years

┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻

« Reply #5 - Posted 2013-03-08 03:20:36 »

Each version will require a version.txt file or something similar which contains the version number.

The patcher downloads the current version.txt from the server and compares the version numbers.

If they are different (or the client-side version is corrupt (not a number) or missing) then it downloads the new game files.

To download the files from the internet, you use create a URL and use url.openStream() as the input stream, and the output stream is just a file.

Then, you need to use ProcessBuilder.

You set the directory to the folder that the game jar is in.
You set the application to "java", the commands to "-jar Game.jar"
Then you execute the processbuilder (which launches the game) and exit the launcher.

(if you use the err/out streams then you may need to handle those from the launcher)

Offline Agro
« Reply #6 - Posted 2013-03-08 03:27:19 »

Some people write that JAR as an applet and add it to the frame.

Offline Cero
« Reply #7 - Posted 2013-03-08 20:53:56 »

One should use GetDown for patching n stuff. Things that can be tricky are: to have write access in the folder, because its usually in a protected area. Also if you just have one jar you couldn't replace the self jar while its running n stuff.

I personally dont use it YET, is simply because of server cost - you would have to have stable server with enough traffic bandwidth and so on.

Offline Sammidysam
« Reply #8 - Posted 2013-03-09 23:10:43 »

I've been working on making my own GameUpdater libraries and I started with C# because it looked easier to me.  I just finished and am now going to make one in Java (mainly because C# apparently isn't easily multi-platform, if it wasn't I would just use the C# one).  The source may help you if you'd like to make your own.  I'll update this post with my Java one when I finish that, but for now I will just have my C# one posted.

EDIT: I finally finished the Java version.  I stayed up way later than I normally do because I forgot to add 1 to Calendar's month lol.  I'll add a README to the repository tomorrow because I'm too tired right now.  This is a library, by the way, so if you want to use this as your library, go ahead.  Do you think it should go into tools or something?  I would be amazed if this was good enough for that (though it is incredibly basic).  It requires Java 7 as Java 7 added really helpful file functions.  That shouldn't be too much of a problem however.  If you use it as a library, be sure to use it in a separate JAR than your game JAR, so that it can update your game JAR.  It can't update itself (I assume that would cause an error but I never tried that).  It wouldn't be too troubling to have (for an example I'm using my game PixelZombies as the title) PixelZombiesLauncher.JAR and PixelZombies.JAR.  Likely you could put PixelZombies.JAR in a folder so that noobs don't see it and click on it (though that wouldn't be the end of the world if they did).  I'll say most of this in the README I make tomorrow but it will be in more depth, so stay tuned for that.
Offline Sammidysam
« Reply #9 - Posted 2013-03-10 14:39:29 »

Both READMEs are now high quality.  I'm pretty proud of the libraries, I think they could be used for game launchers pretty easily.  If you'd like to get information on either one of my two libraries, click on the link and the README is quite massive for both.

EDIT:  As I saw your (StonePickaxes) post request a progress bar, I am implementing a progress bar, although it's just via the console.  To make it work nicely, you could write a batch script that users click on so that they can see the progress on the cmd screen.  It's done on the Java version now I believe and I will now work to put it in the C# version.

EDIT2: I have now finished adding the printing of progress.  I think I'll make a topic for these two libraries in a few hours, since I see them as good enough to do so.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline endolf

JGO Coder

Medals: 7
Exp: 15 years

Current project release date: sometime in 3003

« Reply #10 - Posted 2013-03-11 08:38:25 »

I've used getdown in the past, it's not perfect, but it does save me writing my own. It seems to work quite well for the little I've done with it.


Pages: [1]
  ignore  |  Print  

hadezbladez (3631 views)
2018-11-16 13:46:03

hadezbladez (1296 views)
2018-11-16 13:41:33

hadezbladez (3636 views)
2018-11-16 13:35:35

hadezbladez (697 views)
2018-11-16 13:32:03

EgonOlsen (4002 views)
2018-06-10 19:43:48

EgonOlsen (4530 views)
2018-06-10 19:43:44

EgonOlsen (2688 views)
2018-06-10 19:43:20

DesertCoockie (3549 views)
2018-05-13 18:23:11

nelsongames (3701 views)
2018-04-24 18:15:36

nelsongames (4727 views)
2018-04-24 18:14:32
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!