Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (497)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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  
  Let's talk distribution!  (Read 5159 times)
0 Members and 1 Guest are viewing this topic.
Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Posted 2012-04-16 22:25:08 »

Since the jerk I bought my DSi off on Ebay decided to not mail it, I'll talk to you guys until it lands. Smiley

We've probably all seen comments about what types of java distributions are broken, and I'm sure many has thought "Then what do I do?"
I want to ask that question, now. I fear that much of these comments contains outdated information, so let's try to assemble the options we have, as of this post.

To my knowledge, there are problems with applets tearing on Macs, and being unsafe. Also, JNLP simply not launching in some instances.
So far, I've just packaged it all manually inside a zip. This is a pain to do manually, and updating an application becomes hell.

Is there an easy way to put all resources, libraries and binaries into a single jar that will launch?
Also, is there a way to set up our IDE's to do this, upon distribution?

Lastly, I'd like to know more about our options for distributing just the updater, that will launch the application as well - like Minecraft does it.
I understand you could do it yourself, but being indies I understand we would like to avoid spending more time on distribution than on the actual game development.

If you've distributed a game ever, please share your experiences. This is from IDE, to consumer. We'd like to minimize the steps.

Let the discussion begin. Smiley

Offline princec

JGO Kernel


Medals: 378
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #1 - Posted 2012-04-16 22:40:32 »

Applets - shit.
JNLP - shit.

Distribute proper installers/packages for whatever platform(s) you are targeting. On Windows that's a .exe or .msi installer; on MacOS a zipped .app or a .dmg; and on Linux, .debs, .tar.gz and maybe .rpms. If you were properly nifty you'd install an autoupdater and get it to autoupdate on first run and thereafter. That's something we're going to look into.

Cas Smiley

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #2 - Posted 2012-04-16 22:47:39 »

I have a commercial application, where I simply made an installer that contained an .exe that kicked off (the embedded) JVM with certain hardcoded arguments. It also contained a tiny jar, which was only able to download 1 file, and had some addional logic.

The actual application was not in the installer.

That tiny app was able to download a hardcoded URL, containing plain text like:
1  
2  
3  
4  
lib/my-data.jar
lib/some-stuff.jar
lib/other-tools.jar
res/splash.jpg

the app would then iterate over these URLs, using the If-Modified-Since header, and overwriting any files that were updated on the server. Then it would kick off the main application. That's it. It's easy to 'deploy' a new version of your app (just FTP some files).

The user still thinks it's a proper installer (compress the installer with LZMA, once!), and the auto-update typically takes only a few seconds on a reasonably fast connection. Otherwise, render a fancy progressbar. You could say that the 'tiny app' is a JNLP client, but it's much simpler, and well, works.

I haven't had a single complaint and many happy customers.

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 davedes
« Reply #3 - Posted 2012-04-16 23:00:48 »

Quote
To my knowledge, there are problems with applets tearing on Macs
My 10.6.6 iMac can't even play Left 4k Dead without an incredible amount of lag.

And occasionally I run into problems where an applet isn't destroyed properly and begins slowing my computer down to a crawl (even if I've quit Chrome).

Haven't really found problems with JNLP, except that it performs significantly slower than a downloaded JAR.

Offline princec

JGO Kernel


Medals: 378
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #4 - Posted 2012-04-16 23:05:57 »

Riven's technique is spot on and you might be interested to know about Getdown which is an open sourced library that does more or less what he's done. LWJGL also has some code (in the LWJGL applet stuff) that does similar.

Cas Smiley

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #5 - Posted 2012-04-16 23:14:51 »

Further advice: do not rely on URLConnection. It will fail, every once in a while. I don't know why, I just know it does from years of experience.

With your own HTTP/1.0 client in under an hour and you'll have a robust downloader.

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

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #6 - Posted 2012-04-16 23:39:55 »

Further advice: do not rely on URLConnection. It will fail, every once in a while. I don't know why, I just know it does from years of experience.

With your own HTTP/1.0 client in under an hour and you'll have a robust downloader.

I was unaware! Thank you for sharing.

I have a commercial application, where I simply made an installer that contained an .exe that kicked off (the embedded) JVM with certain hardcoded arguments. It also contained a tiny jar, which was only able to download 1 file, and had some addional logic.

The actual application was not in the installer.

That tiny app was able to download a hardcoded URL, containing plain text like:
1  
2  
3  
4  
lib/my-data.jar
lib/some-stuff.jar
lib/other-tools.jar
res/splash.jpg

the app would then iterate over these URLs, using the If-Modified-Since header, and overwriting any files that were updated on the server. Then it would kick off the main application. That's it. It's easy to 'deploy' a new version of your app (just FTP some files).

The user still thinks it's a proper installer (compress the installer with LZMA, once!), and the auto-update typically takes only a few seconds on a reasonably fast connection. Otherwise, render a fancy progressbar. You could say that the 'tiny app' is a JNLP client, but it's much simpler, and well, works.

I haven't had a single complaint and many happy customers.

What is the benefit from having an executable? I suspect it could just as well be written in Java?
Also, how does one embed a JVM?

Offline ra4king

JGO Kernel


Medals: 345
Projects: 3
Exp: 5 years


I'm the King!


« Reply #7 - Posted 2012-04-17 00:07:57 »

Making an executable gives the application a native feel. Plus the additional bonus of a file icon Wink

Embedding a JVM is as simple as including the JRE folder that came with your install.

The best way to make executables for all platforms is to use Launch4J.

Offline sproingie

JGO Kernel


Medals: 202



« Reply #8 - Posted 2012-04-17 00:56:27 »

I've never heard of URLConnection just randomly failing.  What was an issue (fixed by 1.5) was that if you had even slightly flakey DNS, negative results were cached too aggressively.  That would affect everything doing hostname lookups, not just URLConnection.  URLConnection is broken in other ways though, like setReadTimeout() not working once you've started to receive data.   Rolling your own HTTP client is lunacy -- use Apache HTTPComponents instead.  I fetch many thousands of URLs a day with it, many of them from sites that are not the most cooperative in the world.

Offline JESTERRRRRR

Senior Member


Medals: 7
Exp: 1 year



« Reply #9 - Posted 2012-04-17 03:07:50 »

Thanks r4aking, thats getting bookmarked
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #10 - Posted 2012-04-17 04:22:19 »

I found that using Ant is a must, if you want to use any tools.
However, it seems there are millions of sh*t tutorials out there, and it's impossible to find anything objective.
I have tried for several hours now, to find a solution to this.

What do I have to do, to compile my sources in Eclipse - however, and this is where half the internet fails apparently, I want to reference libraries
that I don't have the source of, Such as Slick-Utils.
It's been absolutely unheard of, during my google searches.

I also want to put the natives into a folder somewhere, where it can be used, and seen, and not cause a brazillian errors.

If anyone could post an ant script that works with Eclipse, and builds a LWJGL/Slick app, that would be great.

Sorry for unnecessary rage. Nothing is going as it should today.

TIL, Ant causes more frustration than this. http://www.youtube.com/watch?v=ww_PjqYQi5E

Offline sproingie

JGO Kernel


Medals: 202



« Reply #11 - Posted 2012-04-17 04:47:57 »

I found that using Ant is a must, if you want to use any tools.

Actually, the majority of java libraries these days are built with Maven.  I hardly ever touch ant.

http://lwjgl.org/wiki/index.php?title=Setting_Up_LWJGL_with_Maven

The sample pom on that page includes slick too.
Offline 65K
« Reply #12 - Posted 2012-04-17 06:36:48 »

What do I have to do, to compile my sources in Eclipse - however, and this is where half the internet fails apparently, I want to reference libraries
that I don't have the source of, Such as Slick-Utils.
Not sure If I understand your problems, but I do my whole application bundling with Ant.
Just specify a classpath built of required libraries:

<path id="classpath">   
   <pathelement location="${libdir}/gdx.jar"/>
   <pathelement location="${libdir}/gdx-backend-lwjgl.jar"/>
   ...
</path>

Use it for compiling:

<target name="compile">
   <javac destdir="${bindir}" target="1.7">
   <classpath refid="classpath"/>


And copy the libraries in your zip-bundle or whatever with appropriate Ant tasks.


Offline gimbal

JGO Knight


Medals: 25



« Reply #13 - Posted 2012-04-17 07:55:06 »

I found that using Ant is a must, if you want to use any tools.

Actually, the majority of java libraries these days are built with Maven.  I hardly ever touch ant.

http://lwjgl.org/wiki/index.php?title=Setting_Up_LWJGL_with_Maven

The sample pom on that page includes slick too.


Maven indeed. Ant also works, but since Eclipse is in play, m2eclipse is a really great plugin to integrate Maven support into Eclipse. I'm not sure, but I think you need the Eclipse for JEE developers distribution to be able to use it though.

The real powerhouse is a combination of Maven and ANT though. There are some things that Maven just cannot do (without developing another plugin) and you need the flexibility of ANT. As an example, I needed a way to generate a properties file per project with the maven pom version in it for displaying purposes in a webapp - so it was easy to see what versions of components were installed and if they were snapshot or release versions. A simple combination of Maven invoking ANT's 'echo' task in the pre-package phase already did the trick.
Offline nsigma
« Reply #14 - Posted 2012-04-17 09:06:16 »

The best way to make executables for all platforms is to use Launch4J.

You sure about that???  The website seems to say you can only make Windows executables, though you can build them cross platform.

On the installer and update front, I'm a great fan of the NetBeans runtime container, which is fairly lightweight, provides cross-platform installers, and has a great module system which would allow you to easily push updates.  You can also ship with an embedded JVM.

Another installer I've been investigating recently for a different purpose is IzPack.  It's cross-platform, and written in Java, though with native wrappers.  Not sure you can embed a JVM yet - seems to be an outstanding issue.

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline gimbal

JGO Knight


Medals: 25



« Reply #15 - Posted 2012-04-17 11:25:07 »

izPack seems really cool, but the downside is that it generates an installer that requires a Java runtime to execute; exactly the one thing you'd like the user not to be bothered with.

I see all the different packaging tools and they are all about 50% of what I'd really want to have. I think it is not as difficult as having to generate launchers or wrappers at all. I think for a decent solution that covers most if not all needs, you'd need:

- a tool that can package up an application with a minimized bundled runtime of your choice
- configurable launcher applications (windows/linux/mac, compiled for 32 bits and 64 bits), for which the packaging tool can bundle one that matches the bundled runtime

The first requirement shouldn't be too difficult to create, although it should be flexible enough that it can understand "JVM configurations" like Java 6, Java 7, Java 8 - to be able to deal with Oracle changing the layout. If you could for example setup some kind of index file for each runtime then new runtimes can be supported without having to create a new version of the packaging tool.

The second requirement will probably require some teamwork to create matching launchers with identical behavior for the different platforms, but it is a far easier way of doing it than generating executables on the fly. Probably create the Windows version, offer the source code and then someone with knowledge of another operating system environment could port it. Anything that needs to be project specific, stick it in a configuration file that the launcher application can read and then use to for example fork the JVM process. The packaging tool can wrap that all up so the user doesn't have to be bothered with it. But the configuration file still leaves open flexibility to change properties after installation, such as heap space settings.


Like this, the "hard work" is left up to us in stead of the end user. What we'd need to do is:

- generate downloadable packages for each viable environment that you want to support
- create a download page which will automatically choose the proper download package based on the HTTP headers sent by the browser (if possible)

The user basically only has to download, install and then run without having to think much about it. Like any other application. It seems like I covered everything. That is unlikely however, so what did I miss? Yeah a version 2.0 feature: the launcher applications can check for updates the Minecraft launcher way Smiley
Offline ra4king

JGO Kernel


Medals: 345
Projects: 3
Exp: 5 years


I'm the King!


« Reply #16 - Posted 2012-04-17 11:27:37 »

The best way to make executables for all platforms is to use Launch4J.

You sure about that???  The website seems to say you can only make Windows executables, though you can build them cross platform.

On the installer and update front, I'm a great fan of the NetBeans runtime container, which is fairly lightweight, provides cross-platform installers, and has a great module system which would allow you to easily push updates.  You can also ship with an embedded JVM.

Another installer I've been investigating recently for a different purpose is IzPack.  It's cross-platform, and written in Java, though with native wrappers.  Not sure you can embed a JVM yet - seems to be an outstanding issue.
Quote
It's possible to wrap applications on Windows, Linux, Mac OS X and Solaris!
Grin

Offline gimbal

JGO Knight


Medals: 25



« Reply #17 - Posted 2012-04-17 11:28:34 »

-snip-

Somehow I managed to double post.
Offline nsigma
« Reply #18 - Posted 2012-04-17 12:15:36 »

Quote
It's possible to wrap applications on Windows, Linux, Mac OS X and Solaris!
Grin

Yes, I read that, and also this -

Quote
The wrapped program works on all Windows platforms (98/Me/NT/2K/XP/Vista), Launch4j works on NT/2K/XP/Vista, Linux, Mac OS X (build on 10.4) and Sparc Solaris 8-10.

which as I said suggests that you can build on any platform, but the executable only works on Windows.

@gimbal - IzPack looks great, and allows you to create platform-specific executables, but does have that issue with needing a JVM installed.  Hopefully there'll fix that one day!  The NetBeans installer infrastructure does support most of what you want.  Bundling the JVM can be a bit awkward to set up though - http://wiki.netbeans.org/NBIBundledJVM


Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #19 - Posted 2012-04-17 13:32:54 »

I've never heard of URLConnection just randomly failing.  What was an issue (fixed by 1.5) was that if you had even slightly flakey DNS, negative results were cached too aggressively.  That would affect everything doing hostname lookups, not just URLConnection.  URLConnection is broken in other ways though, like setReadTimeout() not working once you've started to receive data.   Rolling your own HTTP client is lunacy -- use Apache HTTPComponents instead.  I fetch many thousands of URLs a day with it, many of them from sites that are not the most cooperative in the world.
I've used URLConnection to fetch tens of thousands of files from the web. About 1.0% of them failed. Then I wrote my own less-than-100-lines HTTP/1.0 implementation, and 0.0% failed. That's all I needed to know. To be fair, my latest tests were in december 2010, but that's not anywhere near 'the 1.5 era'.

LWJGL ditched URLConnection due to similar issues and bugged caching.

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

JGO Knight


Medals: 25



« Reply #20 - Posted 2012-04-17 13:43:04 »

I've used URLConnection to fetch tens of thousands of files from the web. About 1.0% of them failed. Then I wrote my own less-than-100-lines HTTP/1.0 implementation, and 0.0% failed. That's all I needed to know. To be fair, my latest tests were in december 2010, but that's not anywhere near 'the 1.5 era'.

LWJGL ditched URLConnection due to similar issues and bugged caching.

I've never really had an issue with URLConnection in any release of Java, but I have no reason not to believe your test results (one does wonder what URLConnection can do wrong that it sometimes fails though). I usually recommend using Apache HttpClient for JEE purposes as it is more feature complete, but like any other general purpose API it is of course also automatically bloated and you get transitive dependencies.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #21 - Posted 2012-04-17 14:25:03 »

URLConnection is backed by non-blocking NIO and a caching layer, both implementations seem to cause problems.

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

JGO Kernel


Medals: 202



« Reply #22 - Posted 2012-04-17 16:34:00 »

Maven indeed. Ant also works, but since Eclipse is in play, m2eclipse is a really great plugin to integrate Maven support into Eclipse. I'm not sure, but I think you need the Eclipse for JEE developers distribution to be able to use it though.

Nope, it works with any eclipse version.  Just grab it from the marketplace.

The real powerhouse is a combination of Maven and ANT though.

Yah the antrun plugin is pretty handy, though programming in XML is ... not fun Tongue  One reason I like SBT, after getting used to its insane internal model, is that you can create commands and attach hooks to existing commands with arbitrary scala code.  Gradle is also like that except with groovy of course.
Offline Cero
« Reply #23 - Posted 2012-04-17 17:05:46 »

I only use Eclipse's export function, which uses ANT I believe.
Works great.

Offline ra4king

JGO Kernel


Medals: 345
Projects: 3
Exp: 5 years


I'm the King!


« Reply #24 - Posted 2012-04-17 17:58:15 »

Eclipse doesn't use Ant by default.

Concerning Launch4j, you're right it only creates a Windows executable. For other platforms you simply supply a .sh file or the jar file.

Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #25 - Posted 2012-04-17 21:47:45 »

I've used URLConnection to fetch tens of thousands of files from the web. About 1.0% of them failed. Then I wrote my own less-than-100-lines HTTP/1.0 implementation, and 0.0% failed. That's all I needed to know. To be fair, my latest tests were in december 2010, but that's not anywhere near 'the 1.5 era'.

LWJGL ditched URLConnection due to similar issues and bugged caching.

Is there any way we can get to see said implementation? It would be nice, since URLConnection is a little broke.

Offline Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #26 - Posted 2012-04-17 23:54:35 »

Is there any way we can get to see said implementation? It would be nice, since URLConnection is a little broke.

Well, I did not own the copyright of my own code, so I wrote a new implementation, just for you Smiley

http://pastebin.java-gaming.org/54a6b5d64 (see github, in next post)

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Z-Man
« Reply #27 - Posted 2012-04-18 02:59:54 »

Is there any way we can get to see said implementation? It would be nice, since URLConnection is a little broke.

Well, I did not own the copyright of my own code, so I wrote a new implementation, just for you Smiley

http://pastebin.java-gaming.org/54a6b5d64
Might I use that? Cheesy
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 799
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #28 - Posted 2012-04-18 09:26:30 »

@Z-Man: Ofcourse, what else would be the point of this rewrite Smiley


I shoved it into github, you can grab the source from: https://github.com/riven8192/http-cache (added support for: HTTP/1.1, chunked encoding, ETag)
</derail>

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.

BurntPizza (22 views)
2014-09-19 03:14:18

Dwinin (35 views)
2014-09-12 09:08:26

Norakomi (62 views)
2014-09-10 13:57:51

TehJavaDev (88 views)
2014-09-10 06:39:09

Tekkerue (43 views)
2014-09-09 02:24:56

mitcheeb (65 views)
2014-09-08 06:06:29

BurntPizza (47 views)
2014-09-07 01:13:42

Longarmx (35 views)
2014-09-07 01:12:14

Longarmx (40 views)
2014-09-07 01:11:22

Longarmx (36 views)
2014-09-07 01:10:19
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!