Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  Need Help Compressing  (Read 3676 times)
0 Members and 1 Guest are viewing this topic.
Offline Rowdy

JGO n00b
*

Posts: 14


High School Student, wanting to make games.


« on: 2009-01-27 17: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
Offline luisoft

Sr. Member
**

Posts: 286


Java games rock!


« Reply #1 on: 2009-01-27 17: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.
Offline Rowdy

JGO n00b
*

Posts: 14


High School Student, wanting to make games.


« Reply #2 on: 2009-01-27 18: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! Go get 'em!
Offline Hsaka

Jr. Member
**

Posts: 95
Medals: 2



« Reply #3 on: 2009-01-27 20: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.
Offline moogie

JGO Strike Force
***

Posts: 775
Medals: 5


Java games rock!


« Reply #4 on: 2009-01-27 20: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.
Offline halfwitgoat

Jr. Member
**

Posts: 62



« Reply #5 on: 2009-01-28 13:51:10 »

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

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.

Offline Rowdy

JGO n00b
*

Posts: 14


High School Student, wanting to make games.


« Reply #6 on: 2009-01-28 16: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
Offline zeroone

Sr. Member
**

Posts: 295
Medals: 10



« Reply #7 on: 2009-01-28 16:49:23 »

Quote
If you are using Web Start, then you don't actually need a manifest.

Really?  I didn't know that.
Offline Hsaka

Jr. Member
**

Posts: 95
Medals: 2



« Reply #8 on: 2009-01-28 17:16:16 »

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.

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.

Also did not know this. Would save 17+ bytes!
Offline Rowdy

JGO n00b
*

Posts: 14


High School Student, wanting to make games.


« Reply #9 on: 2009-01-28 17: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! Go get 'em!
Offline Hsaka

Jr. Member
**

Posts: 95
Medals: 2



« Reply #10 on: 2009-01-28 17:32:27 »

No problem.
Good luck with your game; I look forward to playing it  Wink
Offline EnderGT

Jr. Member
**

Posts: 98



« Reply #11 on: 2009-01-29 06: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 Smiley
Offline Morre

JGO Ninja
***

Posts: 507


I'm Dragonene on IRC.


« Reply #12 on: 2009-01-29 07: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 Smiley

Offline EnderGT

Jr. Member
**

Posts: 98



« Reply #13 on: 2009-01-29 08: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:

Quote from: www.java4k.com
# 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? Smiley
Offline pjt33

JGO Strike Force
***

Posts: 913
Medals: 17



« Reply #14 on: 2009-01-29 08: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.
Offline EnderGT

Jr. Member
**

Posts: 98



« Reply #15 on: 2009-01-29 19: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

Quote from: www.java4k.com
# 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.
Offline zeroone

Sr. Member
**

Posts: 295
Medals: 10



« Reply #16 on: 2009-01-30 09:31:00 »

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

JGO Neuromancer
****

Posts: 1113
Medals: 5



« Reply #17 on: 2009-01-30 11: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.

Offline zeroone

Sr. Member
**

Posts: 295
Medals: 10



« Reply #18 on: 2009-01-30 14:19:47 »

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.

And about the manifest?
Offline tom

JGO Neuromancer
****

Posts: 1113
Medals: 5



« Reply #19 on: 2009-01-30 16:20:42 »

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

Offline EnderGT

Jr. Member
**

Posts: 98



« Reply #20 on: 2009-01-30 20: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 Smiley
Offline Abuse

JGO Kernel
*****

Posts: 1866
Medals: 5


falling into the abyss of reality


« Reply #21 on: 2009-01-30 20:53:39 »

I was afraid of that. Oh well, guess I need to find another way to drop 133+ bytes Smiley

Remove whatever feature it is that requires functionality protected by the security model?
Offline EnderGT

Jr. Member
**

Posts: 98



« Reply #22 on: 2009-01-30 23: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 Sad
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.196 seconds with 22 queries.