Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (524)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (593)
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 2148 times)
0 Members and 1 Guest are viewing this topic.
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Posted 2003-12-18 05: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 13: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 07: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 Devvie




Ribot - mobile UI specialist


« Reply #3 - Posted 2005-08-02 16: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 Knight


Medals: 14


falling into the abyss of reality


« Reply #4 - Posted 2005-08-03 00: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! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline shmoove

Junior Devvie




Doh!


« Reply #5 - Posted 2005-08-03 07: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.

 

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

The first screenshot will be displayed as a thumbnail.

toopeicgaming1999 (28 views)
2014-11-26 15:22:04

toopeicgaming1999 (25 views)
2014-11-26 15:20:36

toopeicgaming1999 (7 views)
2014-11-26 15:20:08

SHC (24 views)
2014-11-25 12:00:59

SHC (24 views)
2014-11-25 11:53:45

Norakomi (24 views)
2014-11-25 11:26:43

Gibbo3771 (23 views)
2014-11-24 19:59:16

trollwarrior1 (36 views)
2014-11-22 12:13:56

xFryIx (74 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50
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!