Download size

Hello,



we are evaluating JME for use in a commercial game

which is meant to be downloaded from the web.



We want to keep our download as small as possible,

and are looking into how to reduce the size

of the JME distro that we package with our game client.



It seems that there are quite a lot of JARs and libs that come

with the standard JME distribution (junit, etc) that might not

be needed on the actual user game client, and that could

potentially be omitted.



Does anyone have experience with this?



How large might a "stripped down" minimal JME version be

that includes only those things that are absolutely necessary?

Like other games, the library will probably be the least to worry about in download size, since the game data (textures, models and audio) are the vilains. In the demo I recently made for a Java programming magazine I could make it as little as 10Mb, with the native libs for Win, Mac and Linux, but this demo had restricted game data.



If you look at the jmetestdata.jar, it's the biggest one and it's not needed if you're not going to use the game data included in the jme distribution. Junit is not needed also. Somebody else can have more experience with webstart demos and stuff… Remember that if you're planning a "full" release for dummies you should make a installable package with the system JRE, which is a completely different story.

The jme jars we are using zip down to about 2MB, most of that coming from jme-effects having some large textures for water in it (~1.5MB alone)

just use the jar files, thats like what…5mb max i guess~

stripping out the data renanse mentions they get pretty small, but can be even further minimized by using optimizers/obfuscators like proguard. http://proguard.sourceforge.net/

Thanks.



By removing jmetestdata.jar and the textures from effects.jar, i get it as small as 1.5 MB (not obfuscated) which is pretty good.



However, I noticed that the libraries and native DLLs (LWJGL, OpenAL and all that) contribute another 2.3MB which is makes the overall package a bit too bulky for our purpose (we have a maximum of 3MB for our app including all game assets).



Any ideas on how to reduce that part of the distro? Do I need everything thats in the lib/ folder?

Well, you only need the user to download the binaries that are for their own platform… so you are talking a few hundred KB there.  Honestly though, for any game, your assets are likely to be in the several MBs by themselves.

Our assets will be streamed to the harddrive in the background, while the applet is already running & the user can already interact with the app.



According to our experience, start-up time is critical, especially for users who have limited bandwidth. A few 100kb can in fact make a difference.

One option is to run your app through a code-path reduction/obfuscation tool (analyzes actual byte code usage and removes the parts not directly used).  This can lead to problems if reflection is used (should be options to force inclusion if needed), but is generally safe otherwise if you fully test the minified app.



Have never actually used one of these in production but poked around a couple times over the years, here are a couple links to get you started:



Free: http://www.nq4.de/index.php?option=com_content&task=view&id=12&Itemid=27



Commercial: Jshrink: Java Shrinker and Obfuscator



HTH,

-Millisecond

jME is pretty nicely split up on almost every level. We have several jars you can add or remove if you do/don't want to use them, but we also have a pretty good package structure (I remember quickly throwing away a lot directories (packages) inside my jars to free up some space for a demo I released, and everything still working well afterwards). On the class level we also don't have much silly depencies (you can make a Sphere without have the Box class and that kind of thing) and it's well split out (no methods with huge switches in them that make them depend on other methods/classes).



Thankfully there are tools that can do this sort of thing for you, and mrCoder already mentioned the best one, Proguard. It's free + open source.

renanse said:

Well, you only need the user to download the binaries that are for their own platform...


is it correct that i only need to include the .dll files from libs folder when running on windows? (not the .so, .jnilib and .dylib files?)

Yes.