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.

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.

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]

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.

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.

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.

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

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.

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

# If your JAR is below 4K until you sign it, you must provide a runnable unsigned JAR to demonstrate the game meets the competition rules.

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.

# If your JAR is below 4K until you sign it, you must provide a runnable unsigned JAR to demonstrate the game meets the competition rules.

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.

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.

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.

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