Need Help Compressing

I saw this competition and decided to compete in it, and over the weekend I finished my game. It’s called Arena4k, but it’s 5-6k… I tried compressing with 4KJO and other compressors, but they always give me errors even though the jar runs fine. If someone could help me out or point me out to a good compressor, that would be great.

Thanks in advanced,
Rowdy

I have a similar problem with 4KJO… when I run it gives lots of error messages and the compression is not good. I’m currently using proguard4.3 version but the result is not good… I can get around 30% of compression.

I haven’t been able to compress mine really because I have a mac and most run .exe or .bat files, and my windows pc is terrible. Oh, and btw I have been running all of this on the pc.

Good Luck with your game luisoft,
Rowdy

Have you guys edited your manifest files as shown here: http://wiki.java.net/bin/view/Games/4KGamesDesign?

Also, after you run Proguard on your jar, run JOGA (provided in the 4KJO package) on the resultant jar.
Then extract the contents of the compressed jar to a folder, edit you manifest if you didn’t before and run BJWFlate and DeflOpt (also in the 4KJO package). [make sure you use the -r switch to recursively go through the subdirectory]

These should compress your jar nicely.

some of the optimisers used in 4KJO are a little overzealous and can “optimise” away whole code banches! others have problems even performing an optimisation with out errors. It is pretty anoying, but the only real way is to identify which of the optimisers are causing the issues and then create a custom config script using the -GUI option and removing the offending optimiser(s).

or if you want, attach your jar and i will see if i can create a script which will work for it.

If you are using Web Start, then you don’t actually need a manifest. Just put

<application-desc main-class="Main"/>

in the jnlp file.

Ok, thanks for the responses. I took Hsaka’s idea and got ProGuard and JoGa to work which brought it down to just over 4k (4101 bytes, it’s killing me), and I used both of the zip programs which compressed them in the zip file, but when I extracted them, they went back to normal size. So, im pretty sure I can go through my code more and get it down to 4096 bytes. Thanks for your help.

Rowdy

[quote]If you are using Web Start, then you don’t actually need a manifest.
[/quote]
Really? I didn’t know that.

[quote]I used both of the zip programs which compressed them in the zip file, but when I extracted them, they went back to normal size.
[/quote]
I’m not sure if I understood you correctly, but after you zip up the .class file and the manifest folder, you will get a resultant .zip file [let’s say myGame.zip]. Then you just need to rename myGame.zip to myGame.jar

You don’t extract them after you zip them up.

[quote]If you are using Web Start, then you don’t actually need a manifest.
[/quote]
Also did not know this. Would save 17+ bytes!

Oh, I misunderstood what you wanted me to do… my fault. I got it to 4077 without that though, now I can make it even smaller, thanks a lot!

Rowdy

No problem.
Good luck with your game; I look forward to playing it :wink:

I knew you didn’t techincally NEED one, but I’ve been stubbornly including one because I thought you were SUPPOSED to have it for this contest…

A quick test using my nowhere-near-4k-yet project shows that, including headers, removing the 17 byte manifest saves a whopping 133 bytes. I guess this is due to the path and file name as well as the file contents.

Guess I’ll be removing that manifest :slight_smile:

If 4KJO doesn’t perform better than, say, JOGA + winzip, I’d say you’re probably doing something wrong. If you upload & link the JAR or preferrably the unobfuscated class file I’ll be happy to see if I can compress it further for you :slight_smile:

Ok, I’ve been thinking this through all morning, and I think the rules of the contest might not let us (me) take advantage of this.

Specifically:

[quote=""]
Although, now that I read it again, it does say “runnable” not “executable” - so maybe it can be removed after all, as you can still run the game from the command line, you just have to specify the main class.

Judges, can we get a ruling? :slight_smile:

The rules of the contest say you have to supply a JNLP file. If you have one of those, you don’t need a manifest.

True, but it also says

Since my jar will definitely be over 4K when signed, I will need to provide a runnable unsigned jar that is 4k or less to prove that my game qualifies. Since java will not accept any jar file that does not have a manifest, the manifest must be present for the jar file to be runnable. As such, you cannot use an unsigned manifest-less jar file as your final determination of size - you must use either the signed jar file with no manifest, or an unsigned jar file with a manifest.

I don’t like this conclusion, as it means I haven’t gotten it as small as I thought I had, but them’s the rules until a judge says otherwise.

We definitely need a ruling on this manifest issue. Judges??

You only need to sign the jar if you need all mermisions like using the Robot class. In which case you are allowed to submit an unsigned executable jar (with a manifest) as well. The executable jar will usually be smaller than a singed jar and will be used to prove the game is 4k.

[quote]You only need to sign the jar if you need all mermisions like using the Robot class. In which case you are allowed to submit an unsigned executable jar (with a manifest) as well. The executable jar will usually be smaller than a singed jar and will be used to prove the game is 4k.
[/quote]
And about the manifest?

The executable jar must have a manifest, or it is not executable.