Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (292)
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  
  Shaving  (Read 1841 times)
0 Members and 1 Guest are viewing this topic.
Offline Matzon
« League of Dukes »

JGO Knight


Medals: 13
Projects: 2


I'm gonna wring your pants!


« Posted 2003-12-18 06:08:18 »

In my quest for ever decreasing jar files I found one "simple" optimization which gave me a 10% decrease in file size!

I use antenna and proguard with my ant scripts. I use the wtkpackage task with preverify and obfuscation.

To make this optimization work, you need to give proguard two arguments:
1  
2  
<argument value="-defaultpackage ''"/>
<argument value="-overloadaggressively"/>


You will also need a -keep argument for the obfuscate task (previously done by the wtkpackage task)

1  
<argument value="-keep public class my.package.MIDlet"/>


Unfortunatly you then have to use the wtkobfuscate task, since the wtkpackage doesn't accept arguments. And by using the obfuscate task, you manually need to preverify it :/

So, do a wtkpackage without preverify and obfuscation. then obfuscate and finish off with a preverify.

Offline mhnsp

Junior Newbie




Java games rock!


« Reply #1 - Posted 2003-12-18 14:40:37 »

One thing I've noticed - (and this may already be known to some/most here) - is that using local variables seems to decrease the size vs. using global variables.  For instance, I have a program that contains two methods which use two global variables for temporary purposes.  When I remove them and use two local pairs for the same purpose, my *.jar file shrunk by 20 bytes.  In both instances, I use ProGuard to shrink the file, also, so I'm not sure of the savings beforehand (if any).
Offline jeevan_gr

Junior Newbie




Java games rock!


« Reply #2 - Posted 2003-12-19 08:49:40 »

Hi,

       pls let me details about his, can we implement it to all J2ME application. my usual application will be J2ME Games

Regards
GR
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ribot

Junior Member




Ribot - mobile UI specialist


« Reply #3 - Posted 2005-08-02 18:23:50 »

I'm trying to use antenna and proguard and using wtkobfuscate and wtkpreverify in an attempt to package up my jars.  But I'm having troubles with the preverification part:

JAR file creation failed with error -1
The preverified classes if any are in tmp41.

The preverify part of my ant script looks as follows:

<wtkpreverify jadfile="game.jad" jarfile="game.jar" classpath="C:\kmidp20.zip" verbose="true" />

Whatever I do, the ant build seems to fail on the above line with the "JAR file creation failed with error -1...."

Any tips would be much appreciated.

http://ribot.co.uk - design agency focused on mobile
http://www.retrospecs.co.uk - online vintage eyewear store
Offline Abuse

JGO Coder


Medals: 2


falling into the abyss of reality


« Reply #4 - Posted 2005-08-03 02:19:37 »

JAX'ing ontop of proguard is another incredibly quick and easy way to save another few Kb (~5%)

And - if you don't have to pass T-mobiles utterly ridiculous acceptance criteria - you can 7zip/kzip the jar to save another 10-15%.

pack all your asset files to reduce the zips table of contents, another 1-2% saving.

Write your code with size in mind - no hardcoded array allocations - minimal member variables, structure your classes so JAX can eliminate & merge them.

Do agressive color reduction on your images (but leave your images in 8bpp)
Match the images palette to the color model used by the phone you are targeting.
pngout/pngcrush all your image assets to remove any ancillery png chunks

etc etc etc

The list is endless.

w00h000, my 1000th post  Shocked Shocked Shocked

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here!
Offline shmoove

Junior Member




Doh!


« Reply #5 - Posted 2005-08-03 09:52:03 »

Mind you, I remember running into a couple of phones that didn't like the 7zip-compressed jars and agressive obfuscation. A pair of Samsungs and an LG, but I can't recall the specific models. If you use these methods and your game misteriously doesn't work on a few phones, try without the added compression.

And while we're on the topic:
A tool that automates a lot of the image compression.
A thread with some nice information on saving jar space, especially through image manipulations.

shmoove

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

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Try the Free Demo of Revenge of the Titans

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (66 views)
2013-05-17 21:29:12

alaslipknot (75 views)
2013-05-16 21:24:48

gouessej (106 views)
2013-05-16 00:53:38

gouessej (103 views)
2013-05-16 00:17:58

theagentd (113 views)
2013-05-15 15:01:13

theagentd (103 views)
2013-05-15 15:00:54

StreetDoggy (148 views)
2013-05-14 15:56:26

kutucuk (171 views)
2013-05-12 17:10:36

kutucuk (169 views)
2013-05-12 15:36:09

UnluckyDevil (178 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.107 seconds with 22 queries.