Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (120)
games submitted by our members
Games in WIP (577)
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  
  Updating API without JWS  (Read 3322 times)
0 Members and 1 Guest are viewing this topic.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Posted 2005-03-04 11:56:50 »

Hi fellow game-devs,

After some serious working with JavaWebStart for a
long time, I found it too much hassle. There are a lot
of features that are not required, and there are a lot
restrictions that are a pain in the back. Not to mention
the annoying bugs (pop-under dialogs, shortcut
dialogs behind fullscreen window). All destroying the
firsttime impression of the end-user, which is very
dangerous if we're trying to make money.

From my experience: the most reliable way to deploy
your application is to have native-launchers (that is, an
app to launch the JVM, nothing more). But then you
loose that magic auto-update that, I have to say,
really kicks butt in JWS.

To fill the gap (at least it was a gap for me), I have
written an AutoUpdate API that is similar to the one in
JWS, but with a few additional features:

- you have full control where the update-files are deployed (subdir="/")
- you can simply store the downloaded file (action="store"),
- you can extract downloaded zip-archives 'on the fly' (action="extract")
- check for conditions before the file is downloaded:
  <condition property="os.name" contains="Linux" />
  <condition property="java.vm.version" contains="1.4" />
  (linked to System.getProperty()...)

Update: check next posts for improved syntax

There is a file on a http-server with data like:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
<netupdate>

   <resource>
      <remote url="http://yourserver.com/engine.jar" />
      <local subdir="/lib/" file="engine.jar" action="store" />
   </resource>

   <resource>
      <remote url="http://yourserver.com/logo.png" />
      <local subdir="/" file="image.png" action="store" />
   </resource>

   <resource>
      <condition property="os.name" contains="Windows" />
      <remote url="http://yourserver.com/game-bin-win32.zip" />
      <local subdir="/bin/" file="game-bin-win32.zip" action="extract" />
   </resource>

   <resource>
      <condition property="os.name" contains="Linux" />
      <remote url="http://yourserver.com/game-bin-linux.zip" />
      <local subdir="/bin/" file="game-bin-linux.zip" action="extract" />
   </resource>

</netupdate>


Once you launched your deployed application, simply do:

[Update: whenever you want, or let the end-user choose]

1  
2  
3  
4  
5  
String url = "http://yourserver.com/your_info_file.txt";
String applicationDirectory = "D:/your_app/";
NetFeedback feedback = ...;

NetUpdate.update(url, applicationDirectory, feedback);


NetFeedback is an interface that gives 'feedback' about
the updating-process:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
// called when something happens:
// - "file {...} already up-to-date"
// - "condition for file {...} not met",
// - "downloading file {...}"
// - etc etc
public void notification(String message);

// called every 250ms, if downloading/extracting
public void statistics(int kbps, int size, float progress);

// called on error
public void error(Exception exc);

// called when done
public void finished();


This enables you to fit this in your own app, with your
own GUI, just listening to the feedback.



A single addition file is created in the Application-dir,
containing the lastModified values of all relevant files.
Deleting this file will result in a complete update the
next time the update process is launched.

To check if an update is required, these values are
compared against the URLConnection.lastModified();
of each Resource (in the xml file).

Side note: java.io.File.lastModified() cannot be used if
a zip-archive was extracted - and deleted after that.


Everything is completely transparant to the dev!
No magic behind the scenes!

--------------------------------------------------------

So... is there a demand for this API, should make it public?

I would like to hear feedback! Kiss

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline c_lilian

Senior Duke


Projects: 1


Java games will probably rock someday...


« Reply #1 - Posted 2005-03-04 12:15:48 »

Feature I think is missing :

- manual update : let the client manage its updates (and telling him what to expect of the updates). This is also missing from JWS.

But I think i'd keep JWS because I don't want to mass with native installers.

Lilian

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #2 - Posted 2005-03-04 13:34:45 »

Quote
manual update : let the client manage its updates (and telling him what to expect of the updates). This is also missing from JWS.


As I said, there is nothing behind the scenes.
You, as a dev, can run the update whenever
you want through code, or let the client
choose. So that feature isn't missing, it's there,
by design.

Quote
But I think i'd keep JWS because I don't want to mass with native installers.


Nothing forces you to have native installers.

It's like:
before: you need Java to run JWS (and let it do it's magic)
after: you need (Java + your deployed app) to run NetUpdate through code

Native installers have nothing to do with it.

Thanks for your feedback though Smiley

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline c_lilian

Senior Duke


Projects: 1


Java games will probably rock someday...


« Reply #3 - Posted 2005-03-04 14:41:40 »

Another thought : use JavaWebStart for initial deployment of a 'game portal', and your API for installing / updating new games on the portal.

Could be a nice application (a replacement/complement for blah^3's JGF ;-) ).


Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #4 - Posted 2005-03-05 23:09:44 »



Updating means: a file is downloaded and stored in specified (sub)dir
Deploying means: a file is downloaded and extracted in specified (sub)dir

Max 4 files are downloaded in parallel, the others are queued, until files are finished.

Exception-handling:



See how that ugly message-box is only displayed in case of an error Smiley

The GUI isn't even launched when no files need updating, and will disappear by itself (4s countdown) when all files are updated and no errors occured - if they did occur, you have to press a button to continue, so you can take your time to see what happened.

This is 'just' and implementation of the NetFeedback interface. So you can write your own. I just tried to show what's possible.

Current reference-file format:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
<netupdate>

   <resource>
      <info name="openal_libraries" />
      <condition property="os.name" contains="Windows" />
      <remote url="http://yourserver.com/lwjgl-win32.zip" />
      <local subdir="/lib/" file="temp0.zip" action="extract" />
   </resource>

   ...

</netupdate>


Call through code:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
String url = "http://yourserver.com/net_update.txt";
String appdir = "D:/my_app/";

String appname = "Bogus";
boolean present = new File(appdir + referenceFile).exists();
String action = present ? "Updating" : "Installing";

NetFeedback feedback = new NetUpdateGUI(appname, action, null); // last argument is "parent frame" for dialog

NetUpdate.update(url, appdir, feedback);


Still nobody thinking this could be an interesting API for the community?

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline darkprophet

Senior Duke




Go Go Gadget Arms


« Reply #5 - Posted 2005-03-06 18:15:00 »

nice one!

But is this just a strickly updating facility? I mean webstart was meant to be more than that...it was meant for distribution too.

Do you reckon you can do that too?

DP

Friends don't let friends make MMORPGs.

Blog | Volatile-Engine
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #6 - Posted 2005-03-06 21:53:58 »

It's meant to be seperated, to make the process fully controllable by the dev / end-user. However, you are right that there has to be a Deploy API too - distributing JARs/JNLPs is just not-done (only among devs). Therefore, I have made an application-kicker generator too, as described in:

http://www.mindprod.com/jgloss/nativecompiler.html
- see: Point 4, 2nd part

It's a fully automated process, but you need a c-compiler, so I might make it a web-service (upload jar and parameters, download exe/bin/whatever)

It's basicly merging exe & jar together into an exe - I will support other platforms ASAP. Like JWS, it needs a pre-installed JVM.

The combination of these two might be very powerful, without losing control like with JWS. An update-process can survive errors, display them in an end-user friendly manner, and without blocking the entire usage of the product.

The only thing that won't be available is the web-start part, and to be honest, I doubt that's a great miss, as that's very likely to go wrong (too many unreliable factors - webserver+browser+jvm - results in bad end-user impression).

Maybe the most important:
A proper installer looks way more professional than click-and-go-apps. For a dev this sounds like crap, but to the end-user it feels much more natural and comfortable to interact with an installer.

More thoughts about this? I'd like to hear it!

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline markush

Senior Newbie




Plöp!


« Reply #7 - Posted 2005-03-07 20:54:42 »

I like your updater. I could really use it in my project. Any thoughts what licence you will use?

Would love to get a jar or something to try it out.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #8 - Posted 2005-03-08 10:35:32 »

I never licensed anything in my life, so you can 'just use it' until I figured out which I'll choose.

Check your private-messages for an early-access  Kiss

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline role

Junior Duke




Java manmoth is coming!


« Reply #9 - Posted 2005-03-09 09:41:14 »

Wow this is great! Making JWS that game oriented Wink And the interface seems very nice than JWS!
Anyway how to launch the game after it's been download? Is it like JWS that has control panel or it's put the shortcut to launch it in user start menu/desktop?
Make it public please Smiley

Golden T Game Engine - Java2D/OpenGL Game Engine
Golden T Website | Golden T Forum
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online kevglass

JGO Kernel


Medals: 188
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #10 - Posted 2005-03-09 10:01:24 »

Quote

Still nobody thinking this could be an interesting API for the community?


I don't think thats it. Just writing a bespoke updating API isn't viewed as being alot of work. I think the attitude may more likely be "If I wanted a bespoke updating API, I would just write one".

The nice thing about JWS (bar all its downsides) would be the standardisation.

(Not nessecesaryly my views).

Personally, I think your implementation looks very nice.

However, I'd probably just write something quick if all it needs to do is grab an XML file, process it and then check some URLs and potentially download files.

- Some questions

* Does your implementation check signatures on files?
* Does it support any form of extension mechanism?

Kev


Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #11 - Posted 2005-03-09 21:01:17 »

Quote
I don't think thats it. Just writing a bespoke updating API isn't viewed as being alot of work. I think the attitude may more likely be "If I wanted a bespoke updating API, I would just write one".


That's a very valid point. I think I'll release it in public on
YetAnotherWebsite and not expect _this_ community to
have any ties to its development. I'll post a URL on this
thread though Smiley

Quote
* Does your implementation check signatures on files?
* Does it support any form of extension mechanism?


With signatures you mean signing? No it doesn't. There
should not be any need for a security-check (besides
writing outside of the app-dir, with a subdir like "/../whatever.zip")
because you already installed the application, hence
considered it's potential danger - you are only updating
an application that you trust.

About the extension-mechanism: you can use the
NetFeedback interface to, well, respond to feedback in
any possible way. There is no way to give input into the
updater, so that is kinda limited.

What kind of extensions did you have in mind?

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Online kevglass

JGO Kernel


Medals: 188
Projects: 24
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #12 - Posted 2005-03-10 05:51:16 »

I'm really just giving it a comparison to JWS.

Signing - used to identify the source of the jars. Its partly to make sure no one has popped some jars into your process without your knowledge. Partly its to give the end user a name to track with any problems. I think in the case of JWS it was driven from the applet kinda sandbox idea.

Extensions - This might be considered more important. JWS has this nice idea where the provider of a library can setup a JWS extension which other people reference. So intead of having lines of JNLP to describe all the jars and settings you need, you just palm it off to their extension website.

Personally I think extensions are flawed since I develop against a particular version of a library and the extension can be changed by the vendor at any time which might screw my product up.

Kev

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #13 - Posted 2005-03-10 06:57:31 »

Quote

With signatures you mean signing? No it doesn't. There
should not be any need for a security-check (besides
writing outside of the app-dir, with a subdir like "/../whatever.zip")
because you already installed the application, hence
considered it's potential danger - you are only updating
an application that you trust.

You still need to check signitures when updating to prevent man-in-the-middle attacks.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline JuddMan

Senior Duke


Medals: 1


Your Ad Here


« Reply #14 - Posted 2005-03-12 13:08:17 »

it's very nice, after all the hours spent getting JWS to work correctly with native libs and stuff, i can see why it would be useful to use something like this but i do also agree it could really use signing.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #15 - Posted 2005-03-13 12:41:35 »

NetUpdate
NetUpdate javadocs
NetUpdate with Java 1.4 classfiles
NetUpdate with Java 1.5 classfiles

No signing - yet.


--------------------


Part of this effort was a native-launcher... so here it is:

JKicker-generator
- Only generates win32 EXEs for now*
- Only works for single JAR for now.

http://62.251.124.32:81/form.html

The generated files are put in a unique directory (MD5
hash of generated file as dir-name) so you can't check
out EXEs other people made by typing 'random' names.

This is my dev-machine, so it can be offline quite often.
Once the first (reported) bugs are fixed I'll put it on a
server that's online 24/7.


* Anyone knows how I can compile c-code for
other Linux/MacOSX platforms on a win32 machine?


Update: serverside-exception-handling is crap right now.
Will add that later.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
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.

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (42 views)
2014-10-16 15:22:06

Norakomi (33 views)
2014-10-16 15:20:20

lcass (37 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (66 views)
2014-10-14 00:35:47

TehJavaDev (59 views)
2014-10-14 00:32:37

BurntPizza (73 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45

BurntPizza (85 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!