Java 5 Web Start import feature

Hi,

We’re soon to be releasing Tribal Trouble (yay!) and are currently looking hard at the distribution options we have available. We’re focusing on web start since that gives us the nice update feature a multiplayer focused game needs to keep its players in sync when game-state affecting changes are made. However, we think that a web start link on our site is still too risky, because all users with a broken java and/or browser will never be able to run it.

So we’re creating separate linux and win32 installers that do the following steps:

  1. Install a private 1.5 jre
  2. Unpack TT web start files (jnlp and jar files) to some temp. dir.
  3. Use the new java 5 import feature (javaws -import) to inject TT into the web start cache.

It all works nicely, except for updates, which is whole reason for using web start in an offline installer. On the first run, it either updates the entire game or no files at all, regardless if we’ve made changes to the game on the web server after the installer was created. This makes sense, since web start is probably comparing the time stamps for the temp files with the server time stamps.

So how can this problem be solved? I’ve considered versioned jar files, but this requires a lot of setup for the JnlpServlet and as far as I can see, it won’t solve the problem for the jnlp file, which is not versioned.

  • elias

Not sure if I quite understanding the problem here…

Ugly solution 1:

Create a manifest file of somesort that lists the file dates for each of the installable files. As a post-step to installation reset the date/time on each installed file before running javaws -import.

Kev

Couple of questions (which dont help you yet) :

  1. Does it actually require java 5, or is this just a clever cunning hack to get webstart installed?

  2. Have you tried the “automatic webstart installer (windows-only)” from Sun?

  3. Will TT be able to run from JGF under the following conditions:
    a. All binaries have to be on the JGF server
    b. JNLP file is auto-generated from whatever options you told the server about your game (which JVM it uses, what JVM args it needs, what system properties, what 3rd party libs + versions, etc)
    c. JGF server versions the binaries and holds old versions around and automatically JARdiff’s them against your new versions so that your players get the incremental update … without you lifting a finger to make it work
    ?

I have spent much of the last week fighting the 7-headed Tiermat that is “Sun’s auto-jws-installer”. It’s crap javascript browser-detect code that Sun hasn’t altered since Java 1.2 by the looks of things and certainly doesn’t frickin work with modern browsers. They haven’t even bothered to update their own webpages detailing which JVM’s are available for download - even the java 5 one is out of date! (if you type in “guess” URL’s for recent JVM’s they work, even though not listed on Sun’s own pages. The java 4 docs dynamic list doesn’t even go beyond 1.4.2_00!)

So…I feel the pain of trying to get this to work, BUT I think I’m very nearly there on making a link which:

  • when you click, if you don’t have JWS but you do have windows + MSIE, it auto-installs JVM approrpiate to the game (could be 1.4, could be 1.5 - either way, correctly picks latest version it can) and runs the game
  • if you don’t have JWS and don’t have windows, it redirects you to Sun’s secret, “officially you are not allowed to use this but we do”, page that automatically works out the current JVM version and downloads it
  • if you have JWS, it just goes to an auto-generated JNLP service which will give you a versioned JNLP and all is happy

Along the way, I have encountered considerable stupid design decisions in JNLP file format and JNLP protocols, so I feel your pain, and on the whole I’m glad our JNLP server is actually a java app rather than just serving a file - because of similar problems to the timestamping you refer to, it’s easier to have fine control of exactly what HTTP headers are being returned.

Apart from the general issue that I want every true java game to go on JGF (so has to be compatible with people like you), I would also like to have a one-stop solution to all this crazy JWS and versioning crap so no-one ever has to think about it again - you just get JGF to do all the hard work for you.

[quote]Couple of questions (which dont help you yet) :

  1. Does it actually require java 5, or is this just a clever cunning hack to get webstart installed?

  2. Have you tried the “automatic webstart installer (windows-only)” from Sun?

  3. Will TT be able to run from JGF under the following conditions:
    a. All binaries have to be on the JGF server
    b. JNLP file is auto-generated from whatever options you told the server about your game (which JVM it uses, what JVM args it needs, what system properties, what 3rd party libs + versions, etc)
    c. JGF server versions the binaries and holds old versions around and automatically JARdiff’s them against your new versions so that your players get the incremental update … without you lifting a finger to make it work
    ?
    [/quote]
    It seems like you’re doing a lot of work to make distribution of java games easier. More power to you! I’ll answer your questions:

  4. The installer has two puposes:
    a. Create a stand-alone, self-contained (can get the game running on an offline machine) installer for those that feel most comfortable with that, even those with perfectly “healthy” java installations.
    b. To make sure a Web Start is available in a robust way (that’s why we simply use a private JRE always, I don’t have time to worry about broken java installs), to make the game run in Web Start.

    So yes, the only java 5 feature we need is the javaws -import (alternatively, we would need to make assumptions on the cache file format and inject it ourselves). Java 5 web start is faster (initiates download of all jar files at once, instead of serially, which is the 1.4 behaviour) and more smooth, though we don’t directly depend on it. The game itself only requires a recent 1.4 VM.

  5. No. The very fact it is severely limited (MSIE + Windows only) made it immediately uninteresting to us. In these days, I’m not even sure a lot of people is capable of running activex stuff anymore.

  6. I don’t see why not. Currently, the game is just an ordinary basic bunch of static jar/jnlp files.

Kev: A hack, yes, but it might work. Thank you.

  • elias

Inspired by Kev, I ended up carefully using the exact same jar files as is served on the server so the timestamps are equal. The installer unpacks them and preserves the stamps, so web start ends up importing the files with correct timestamps. I can’t imagine how versioned jar files would ever work without a local http server, though.

  • elias

Check out the PatchUpdate API, free to use. Make easy, nice looking updating of your software.

http://patchupdate.mythicscape.com

Free to use for non-commerical products. :frowning:

Kev

Oh, go on then, I’ll take the bait (since I’ve no mod access): tell us WTF your product has to do with this, and what it does that makes it better than jws.

[quote]Oh, go on then, I’ll take the bait (since I’ve no mod access): tell us WTF your product has to do with this, and what it does that makes it better than jws.
[/quote]
Well if you read the original poster, he is using jws to get “updating” of the software, but does not like it.
Here is a quote from his post:

[quote]We’re focusing on web start since that gives us the nice update feature a multiplayer focused game needs to keep its players in sync when game-state affecting changes are made. However, we think that a web start link on our site is still too risky, because all users with a broken java and/or browser will never be able to run it.

So we’re creating separate linux and win32 installers that do the following steps:

  1. Install a private 1.5 jre
  2. Unpack TT web start files (jnlp and jar files) to some temp. dir.
  3. Use the new java 5 import feature (javaws -import) to inject TT into the web start cache.

It all works nicely, except for updates, which is whole reason for using web start in an offline installer.
[/quote]
With PatchUpdate you dont need webstart. I personally don’t like webstart at all for keeping software updated. (Having only jar files for your app really s u c k s imo). Seems like the original poster doesn’t like it that much either, and is looking for another solution with their own installers.

PatchUpdate was created for such solutions. We actually created if for our own online game since webstart was a real mess when it comes to updating. The game is continously changing and files are added all the time, megabytes of music and graphics etc. And with a game consisting of 100+ mb of data, you dont really like webstart :stuck_out_tongue: Also, you wish to update single files and not complete jar files (i heard you can use jardiff and shit with jws, but it was a mess too).

You can use PatchUpdate for free for non-commercial software.

Would you mind explaining? … what does it actually DO that’s any different, HOW it is better, etc? Cruising the website I found lots of marketing but couldn’t find any actual details. Which is why I asked.

Funny you should mention it because actually jardiff is extremely easy :). Compared to JNLP building, it’s so easy it’s sickening :(…shortly after the JNLP service on JGF finally works, I’ll be putting up an automated jardiff on everyone’s games - and no-one needs to lift a finger, it Just Works.

Yes, but for someone that does not have their games on your site, jnlp stuff, jardiff, even coding the program to be suited to be completely jar bundled etc etc, might not be a great solution…

I do however agree that the click to run thing is nice from a webserver. Actually thinking about how to use it as an alternative installer solution for our game. (That is, just download a very small jar file, that unzips a small program, which will then automatically run our patchupdate to download the appropriate patch (the whole game)). Just to get the game into the operating system, start menus etc. For now we have been using InstallAnywhere as installation solution (and probably will in the future too), but I is tempting to perhaps make a webstart version as well.

Anyone done anything like it?

(Sorry for drifting off the topic, sue me :P)

You might like the API I built especially for this: no JWS, but keep auto-update (and add other things).

http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=share;action=display;num=1109948210