Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (491)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (555)
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 2136 times)
0 Members and 1 Guest are viewing this topic.
Offline StonePickaxes

JGO Coder


Medals: 4
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,

Nathan

Check out my website!
Offline princec

JGO Kernel


Medals: 369
Projects: 3
Exp: 16 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
http://downloads.puppygames.net/SetupDroidAssault.exe
http://downloads.puppygames.net/DroidAssault_MacOSX.zip
http://downloads.puppygames.net/DroidAssault.tar.gz
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: 4
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.
Online 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: 246
Projects: 11
Exp: 2 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)

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

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

Online 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.

https://github.com/Sammidysam/GameUpdater

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.

https://github.com/Sammidysam/GamePatcher
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


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.

Endolf

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Nickropheliac (15 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (29 views)
2014-08-22 19:31:30

atombrot (41 views)
2014-08-19 09:29:53

Tekkerue (38 views)
2014-08-16 06:45:27

Tekkerue (35 views)
2014-08-16 06:22:17

Tekkerue (24 views)
2014-08-16 06:20:21

Tekkerue (34 views)
2014-08-16 06:12:11

Rayexar (72 views)
2014-08-11 02:49:23

BurntPizza (48 views)
2014-08-09 21:09:32
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!