Rowdy
Senior Newbie 
High School Student, wanting to make games.
|
 |
«
Posted
2009-01-27 22:28:31 » |
|
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
|
|
|
|
luisoft
|
 |
«
Reply #1 - Posted
2009-01-27 22:38:57 » |
|
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.
|
|
|
|
Rowdy
Senior Newbie 
High School Student, wanting to make games.
|
 |
«
Reply #2 - Posted
2009-01-27 23:54:01 » |
|
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
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Hsaka
|
 |
«
Reply #3 - Posted
2009-01-28 01:13:02 » |
|
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.
|
|
|
|
moogie
|
 |
«
Reply #4 - Posted
2009-01-28 01:59:54 » |
|
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.
|
Java4k RIP 2014
|
|
|
halfwitgoat
|
 |
«
Reply #5 - Posted
2009-01-28 18:51:10 » |
|
If you are using Web Start, then you don't actually need a manifest. Just put 1
| <application-desc main-class="Main"/> |
in the jnlp file.
|
|
|
|
Rowdy
Senior Newbie 
High School Student, wanting to make games.
|
 |
«
Reply #6 - Posted
2009-01-28 21:23:37 » |
|
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
|
|
|
|
zeroone
|
 |
«
Reply #7 - Posted
2009-01-28 21:49:23 » |
|
If you are using Web Start, then you don't actually need a manifest. Really? I didn't know that.
|
|
|
|
Hsaka
|
 |
«
Reply #8 - Posted
2009-01-28 22:16:16 » |
|
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 You don't extract them after you zip them up. If you are using Web Start, then you don't actually need a manifest. Also did not know this. Would save 17+ bytes!
|
|
|
|
Rowdy
Senior Newbie 
High School Student, wanting to make games.
|
 |
«
Reply #9 - Posted
2009-01-28 22:26:52 » |
|
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
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Hsaka
|
 |
«
Reply #10 - Posted
2009-01-28 22:32:27 » |
|
No problem. Good luck with your game; I look forward to playing it 
|
|
|
|
EnderGT
|
 |
«
Reply #11 - Posted
2009-01-29 11:21:00 » |
|
Also did not know this. Would save 17+ bytes!
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 
|
|
|
|
Morre
|
 |
«
Reply #12 - Posted
2009-01-29 12:08:25 » |
|
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 
|
|
|
|
EnderGT
|
 |
«
Reply #13 - Posted
2009-01-29 13:16:27 » |
|
I knew you didn't technically NEED one, but I've been stubbornly including one because I thought you were SUPPOSED to have it for this contest... 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: # 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. Judges, can we get a ruling? 
|
|
|
|
pjt33
|
 |
«
Reply #14 - Posted
2009-01-29 13:36:38 » |
|
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.
|
|
|
|
EnderGT
|
 |
«
Reply #15 - Posted
2009-01-30 00:22:41 » |
|
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 # 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.
|
|
|
|
zeroone
|
 |
«
Reply #16 - Posted
2009-01-30 14:31:00 » |
|
We definitely need a ruling on this manifest issue. Judges??
|
|
|
|
tom
|
 |
«
Reply #17 - Posted
2009-01-30 16:49:23 » |
|
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.
|
|
|
|
zeroone
|
 |
«
Reply #18 - Posted
2009-01-30 19:19:47 » |
|
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. And about the manifest?
|
|
|
|
tom
|
 |
«
Reply #19 - Posted
2009-01-30 21:20:42 » |
|
The executable jar must have a manifest, or it is not executable.
|
|
|
|
EnderGT
|
 |
«
Reply #20 - Posted
2009-01-31 01:32:06 » |
|
The executable jar must have a manifest, or it is not executable.
I was afraid of that. Oh well, guess I need to find another way to drop 133+ bytes 
|
|
|
|
Abuse
|
 |
«
Reply #21 - Posted
2009-01-31 01:53:39 » |
|
I was afraid of that. Oh well, guess I need to find another way to drop 133+ bytes  Remove whatever feature it is that requires functionality protected by the security model?
|
|
|
|
EnderGT
|
 |
«
Reply #22 - Posted
2009-01-31 04:58:18 » |
|
Remove whatever feature it is that requires functionality protected by the security model?
Not an option, it's kinda the whole core of the game 
|
|
|
|
|