Applets which actually crash on that have bigger problems, because (in at least some point releases of JRE 6) applets might get null from getGraphics() due to a bug in the standard applet containerâs lifecycle.
Thatâs a years-old problem with the java4k.org site.
Applet launcher can appear on the site when itâs ready. Iâm going to add json services to retrieve game list and such, so it doesnât depend on some html code that could possibly change.
(New rule will be added, no more than 5 games per developer).
Thatâs been my thoughts too. The java way of demo witchery. I once considered to join the 4k contest, but had to realize that it requires very specific skills and methods to produce such compact code which still does something sensible, and I donât have those - and I wasnât willing to sacrifice my coding habits just to squeeze some function into 4k bytecode.
So for me it already was a pretty closed contest for those who are like the old assembly wizards from the demo scene who made other people just âwow - I had no idea that this can even be doneâ.
This is what I thought the past few years and I never joined the competition because of that. But last year I tried, and with the toolset you can use (obfuscator, proguard, shrinker) you donât need to ruin your code to fit everything. My games even had 3 or 4 classes, not just 1 like people normally do.
It is perfectly doable, just give it a try.
I have not participated in this contest and I also feel, itâs not for me.
But I am glad that this thread took a positive direction and I wish You all the best.
The launcher is nice, keep it up.
That issue gets raised a lot, but a while back Groboclown put together a good set of ANT scripts that you can use (quoted post below.) I donât know how much it has changed in the past two years, but when I used it it all I had to do was put in the paths to some tools I downloaded like proguard and kzip, and then I just used Eclipse to run the script. Doesnât get much easier than 1-click compression!
If you look at the source for many of the games on java4k.com, the fully commented well-laid out code is what was fed in to the ANT scripts, and they spit out an obfuscated, maximum compression 4k jar at the other end. My two games had a main game loop, but separate methods for drawing the splash screen, handling menu actions, drawing sprites, and loading and playing music. Thereâs a bit of trade-off between OO design and minimized byte code, for example my use of a method to draw sprites instead of delegating that to a separate Sprite object that decides how to draw itself. Along with that decision, I used 2d int arrays to keep track of my sprites and their attributes, rather than introduce another object definition. But you can do things like define as many constants as you want (to avoid remembering the purpose of a magic number), since proguard will replace them with the values in your code.
Perhaps special recognition award for the best ânew comerâ entry would help include those who are not considering entering being intimidated by the fantastic entries of the old hands?
OK, sorry Iâve been a bit stressy about this launcher business but Iâm pretty much1 won round now.
[quote=âmoogie,post:175,topic:43899â]
Superb2 idea! A âBest Newcomerâ category would be an excellent addition to the contest.
1Nothing to do with one of my games being used for the demo - honest! 2On the J4K website news the word âsuperbâ has been typoed to âsupberbâ - just sayingâŚ