woogley
|
 |
«
Posted
2005-12-01 07:26:11 » |
|
got home late from work today, so I'll post a *full* list of rules tomorrow. but I didn't want to dissapoint anybody who was waiting for 12:00 AM of December 1st to arrive, so the submission page is open! http://javaunlimited.net/games/submit.phpscreenshots and custom homepages are a plus (saves me some work  ). currently the FTP Hosting link is unavailable but I will be offering free hosting to whoever needs it this year. be sure to select "Java 4K 2006" as the contest, and also be sure your minimum Java requirement is at 1.4 or earlier. games will enter an approval queue where I will approve the games based on content. game sizes will not be validated until the contest closing, so feel free to post unfinished previews if desired  . Approval queue is checked daily, so expect to see your game in at least 24 hours or less. also, this is the first public run of the submission page. please alert me of any bugs - we can't afford to lose track of any games  finally, judges are needed, so feel free to volunteer if you're not submitting an entry.
|
|
|
|
|
anarchotron
Junior Member  
...precious bodily fluids.
|
 |
«
Reply #1 - Posted
2005-12-01 18:10:10 » |
|
I know this is a n00bish question and there is probably somewhere that I could RTFM, so I humbly and shamefully apologize in advance for asking this question, but.
What external libs, if any are allowed to be used? Is the 4k game required to only use what comes with the JRE SE?
Thanks!
|
|
|
|
|
Morre
|
 |
«
Reply #2 - Posted
2005-12-01 18:16:27 » |
|
I believe all of your questions will be answered this evening and/or night, when woogley gives us the full rules.
|
|
|
|
Games published by our own members! Check 'em out!
|
|
|
|
Morre
|
 |
«
Reply #4 - Posted
2005-12-02 13:40:48 » |
|
I'd like to see the rules as well  Oh, and unlimited still says "Launching dec 1". It's dec 2 now, so... =P
|
|
|
|
woogley
|
 |
«
Reply #5 - Posted
2005-12-02 18:12:54 » |
|
sorry for the wait  anyway I think this covers everything: http://javaunlimited.net/contests/java4k.phpthe only thing I have to setup now is free hosting but nobody has even asked for it yet so ... anarchotron, no external libs  any other specific questions (after reading the rules)... hit me 
|
|
|
|
|
woogley
|
 |
«
Reply #6 - Posted
2005-12-02 18:14:06 » |
|
ooh, kev, good idea (even though it is more than dead over there). cant hurt to inform the rest of the community though
|
|
|
|
|
Morre
|
 |
«
Reply #7 - Posted
2005-12-02 18:16:42 » |
|
woogley, you're confused. I didn't ask about external libs, it was somebody else.  Let me see if I understand the rules: If I use webstart, then the SIGNED jar (if I need a signature) has to be below 4k? Fine, so I'll just submit a normal JAR as the official entry and link to a webstartable version anyway... which brings me to my next question: If I submit both links (JAR and webstart) on the submission site, which version will you use to check size? I hope you'll use the archive, because I really wish to be able to provide webstart on the site as well so that people can try the games, and still have my JAR ar the official, size-checked entry. How are things going with those comments fields for games on the site? Will that be possible soon? 
|
|
|
|
kevglass
|
 |
«
Reply #8 - Posted
2005-12-02 18:17:22 » |
|
So, we're saying you're not allowed:
java -cp myjar.jar Game
this year then? It'd have to have a manifest inside it? But I am allowed to use webstart and the main-class attribute in there?
All fine by me if that is the case, just wanted to be sure.
Kev
|
|
|
|
woogley
|
 |
«
Reply #9 - Posted
2005-12-02 18:22:20 » |
|
Sorry Morre, I'm on flu medicine atm  Kev, yes you can use Webstart's main-class attribute, nothing wrong there. As long as it executes from the link on Java Unlimited with no command line, you're in the clear. This year's contest is shooting for a "plug and play" type of feel. Also don't forget you don't need a manifest in a JAR if there is only one class file in the JAR (or at least that's how it used to be in the 1.2 days). edit: Morre, about your question. You can use a signed JAR that is above 4K for webstart if you also provide the same JAR unsigned that is below 4K as a download as well. If you submit both a webstart and unsigned JAR version, the only size I check is the unsigned JAR.
|
|
|
|
|
Games published by our own members! Check 'em out!
|
|
Morre
|
 |
«
Reply #10 - Posted
2005-12-02 18:28:10 » |
|
Excellent. Thank you for making that clear  EDIT: Sorry to hear you've got the flu :S
|
|
|
|
jbanes
|
 |
«
Reply #11 - Posted
2005-12-02 18:30:39 » |
|
Hi Woogley,
A Question: If a game has both an Archive URL and a Webstart URL, which one is used for official judging? I understand that you can force the Webstart URL to be invalid by making the JAR larger than 4K via a signature, but what if both JARs fit?
For example, someone could create two separate versions of their code, one with full screen support, the other without. That would allow the Webstart version to work without a signature. Yet that developer may not actually want the Webstart version to be the one judged. How would this be resolved?
|
|
|
|
woogley
|
 |
«
Reply #12 - Posted
2005-12-02 18:44:31 » |
|
Morre, thanks  jbanes, interesting. like I said above... when it comes to size, the archive URL is the one validated. As far as which file is judged, the gameplay itself should be the same on both launch options, so does it matter? You might want to put in your submission notes that the archive URL runs fullscreen which could potentially be more fun than a non-fullscreen webstart version. Be careful when you have differences like that though... because the game is disqualified if any part of the gameplay is different between launch types (i.e. extra in-game feature due to extra space on the unsigned jar...). Fullscreen counts as a launch feature so that won't be marked against you. Either way I'll have judges play both webstart and archives so you'll be in the clear. Either way like I said.. best you can do is say in your submission notes if one launch version could be more fun due to fullscreen or whatever.
|
|
|
|
|
Morre
|
 |
«
Reply #13 - Posted
2005-12-02 19:01:19 » |
|
woogley, I suggest you modify the top post with a bold text that says "Rules" or something, so that it's clearly visible. Right now the link's in the middle of the posts, a bit confusing.
|
|
|
|
woogley
|
 |
«
Reply #14 - Posted
2005-12-02 19:05:21 » |
|
hmm I'll just make another topic for it.
|
|
|
|
|
Morre
|
 |
«
Reply #15 - Posted
2005-12-02 19:06:12 » |
|
That works.
|
|
|
|
Rick
Junior Member   Projects: 1
Java games rock!
|
 |
«
Reply #16 - Posted
2005-12-03 18:27:16 » |
|
Woogley, Can I take you up on the hosting offer for the 4k contest. I see that my entry LadyBug is not showing the screen shot as it is bieing hosted on the free site tripod which replaces direct links to images with a plug for their site. What are the FTP details to upload my image to your site.
|
|
|
|
|
f.l.x
|
 |
«
Reply #17 - Posted
2005-12-05 18:05:01 » |
|
Is there any "j4k guide for n00bs" anywere? I have been doing something (just to try) and i have just reached 4061B only with input and rendering implemented and i don't know how sqash my code harder 
|
|
|
|
nonnus29
Senior Member   
Giving Java a second chance after ludumdare fiasco
|
 |
«
Reply #18 - Posted
2005-12-05 18:27:07 » |
|
Check some of the threads from last year, lots of people posted source code to their games (including me). Warning, 4k can be addictive..... 
|
|
|
|
|
Alan_W
|
 |
«
Reply #19 - Posted
2005-12-05 19:16:43 » |
|
Is there any "j4k guide for n00bs" anywere? I have been doing something (just to try) and i have just reached 4061B only with input and rendering implemented and i don't know how sqash my code harder  Some hints: - Use only one class - The class should inherit from JFrame if it is a webstart app. That way the close box automagically works, although you need to call isVisible() from time to time & do a System.exit(0), if the Frame is no longer visible. - Put the entire game in the constructor if possible. Each function added to the class has overhead - Avoid using class variables, unless you absolutely need them (e.g. more than one function accesses them) as these are more expensive in space than local variables in a function. - If you declare any constants as class variables, declare them as private final static. This will get them inlined. - Use the minimum number of class library methods. Everytime you use one of these, the full name (class+method) ends up in the .class file. - Use long variable names as usual, except for the class name, which should be a single letter. Use an obfusticator such as proguard. This will reduce all variables in the .class to single letters, remove unused functions. - Unjar the file proguard produces and then rejar using a standard zip compressor such as 7zip or kzip. Remember to specify the command line switches to get maximum compression. - You don't need a manifest if you use webstart as the only starting method. If you do include a manifest (& it is a nice touch) you only need the version and main-class statements. Good Luck Alan
|
Time flies like a bird. Fruit flies like a banana.
|
|
|
f.l.x
|
 |
«
Reply #20 - Posted
2005-12-05 19:35:11 » |
|
woah, thanks i wasn't following most of these statements
|
|
|
|
CaptainJester
|
 |
«
Reply #21 - Posted
2005-12-06 02:38:39 » |
|
- If you declare any constants as class variables, declare them as private final static. This will get them inlined.
You save even a little more space by manually removing the constants and putting the value in their place. From the start you can program a little more normally, so it is easier to follow your own code. Then remove constants and replace them with their values. Don't use temporary variables for calculations, just put the calculation inline. Don't worry about using single letter variables, because an ofuscator will take care of that for you. It also removes class information for reflection, because you won't need them.
|
|
|
|
jbanes
|
 |
«
Reply #22 - Posted
2005-12-06 02:44:21 » |
|
Don't use temporary variables for calculations, just put the calculation inline. If you do use a variable, however, don't be a scrooge with them. Since local variables are all on the stack, it doesn't matter to the compiled code if you reuse one variable or ten. It generates pretty much the same code. So I guess the other lesson to get out of this is to watch out for false economy. 
|
|
|
|
Morre
|
 |
«
Reply #23 - Posted
2005-12-06 18:40:12 » |
|
Actually, that's a good trick, first obfuscating, and then repacking... saved me 0,1 kb or something, and that's when the jar was only 2,5kb in total 
|
|
|
|
Anon666
Junior Member  
aka Abuse/AbU5e/TehJumpingJawa
|
 |
«
Reply #24 - Posted
2005-12-06 19:30:16 » |
|
Don't use temporary variables for calculations, just put the calculation inline That is certainly a false economy - any halfway decent peep-hole optimiser will automagically inline such assignments. (a value written to, and immediately read back from a local) Keeping the number of entries in the constants pool to less than 256 will give a very real gain. It will avoid use of the larger ldc_w instruction. (and may also help compression, because you will potencially have one less unique symbol to compress) Also, *never* use double or long constants - they use up 2 entries in the constants pool, and are read from the pool using a different instruction. It is best to store them as float/int and let them be cast upto the needed type. A good example of this (as most will be using it  ) is enableEvents(long). If you simply pass in a constant to this method (regardless of whether it is an int or a long), it will be expanded to a long by javac, and stored in the constants pool as such. It is better to store the value in the constants pool as an integer, and then cast it to a long when it is passed into the method. However, i'm unsure if you can perform this optimisation using the Java syntax; or whether the java compiler will always evaluate the constant, and extend it to a long. (it is certainly an optimisation worth automating with BCEL) [crazyness] infact, if you are using a small value (10 or less) for the enableEvents flag (for example 6  ) - the optimal solution turns out to be enableEvents((long)(3+3)) as this completely eliminates the constants pool entry! (there are specific instructions for pushing the integer values -1 through to +5 onto the stack)[/crazyness] The same goes for people using Math.PI; cast it to a float before you use it, to avoid the overhead of a huge 8byte! constants pool entry. Structuring your code so the active scope of a variable is as small as possible will also give you gains. Due to Java's smaller-bytecode instructions for accessing the first 4 local variables (1byte rather than 2), keeping the active set of local variables as small as possible will help your code size.
|
|
|
|
|
Alan_W
|
 |
«
Reply #25 - Posted
2005-12-06 19:42:51 » |
|
@Anon666 Loads of stuff I didn't know there, although I had found that changing the scope of local variables sometimes improved matters & sometimes didn't, for no obvious reason
|
Time flies like a bird. Fruit flies like a banana.
|
|
|
swpalmer
|
 |
«
Reply #26 - Posted
2005-12-06 20:19:05 » |
|
[crazyness] infact, if you are using a small value (10 or less) for the enableEvents flag (for example 6  ) - the optimal solution turns out to be enableEvents((long)(3+3)) as this completely eliminates the constants pool entry! (there are specific instructions for pushing the integer values -1 through to +5 onto the stack)[/crazyness] Are you trying to tell me that javac doesn't evaluate the 3+3 and put a 6 in the bytecode when compiling the source code? I have a hard time believe that, but not enough energy to check  .
|
|
|
|
Anon666
Junior Member  
aka Abuse/AbU5e/TehJumpingJawa
|
 |
«
Reply #27 - Posted
2005-12-06 21:08:08 » |
|
[crazyness] infact, if you are using a small value (10 or less) for the enableEvents flag (for example 6  ) - the optimal solution turns out to be enableEvents((long)(3+3)) as this completely eliminates the constants pool entry! (there are specific instructions for pushing the integer values -1 through to +5 onto the stack)[/crazyness] Are you trying to tell me that javac doesn't evaluate the 3+3 and put a 6 in the bytecode when compiling the source code? I have a hard time believe that, but not enough energy to check  . oh no, you are absolutely right! javac *does* evaluate it (and infact expands it to a long constant 6L ). Thats the problem, and why the optimal solution cannot be achieved by compiling with javac - without later performing such bytecode optimisations with a tool like BCEL.
|
|
|
|
|
Morre
|
 |
«
Reply #28 - Posted
2005-12-06 21:30:46 » |
|
Heh... I had no idea about that. I'm just not that good a programmer >)
|
|
|
|
f.l.x
|
 |
«
Reply #29 - Posted
2005-12-06 23:44:04 » |
|
hmmm i have made some test on that long constants optimizing Mi early state game with this: df = (int)((getWidth() / 2) / Math.tan(Math.PI / 4)); jared 3918b with this df = (int)((getWidth() / 2) / (float)Math.tan(Math.PI / 4)); 3920b but, it's not significative, i have been noticing something very strange: before doing nothing to the code: 3920b after adding a new blank line 3916b  the actual size of the bytecode can be affected simply by recompiling??!!
|
|
|
|
|