In an effort to breath life back into Java4K, I’m testing the waters with a Java4K platform. I’m sharing this WIP early, and plan to have a ton of revisions, based on your feedback, and/or my gut feeling.
My plan for Java4K is to lower the barrier to entry that haunted the last few years of Java4K. The toolchain required to build a tiny *.jar.pack200.gz was daunting, even for experienced members of the community. A newby would find that his bare bones main-loop would consume ~2500/4096 bytes, while those in possession of said toolchains could fit over 30KB of sourcecode in their 4KB binary. Suffice to say that this played at least some role in the Java4K contest participation rate dropping over the years.
To lower the barrier to entry, we have to make some radical changes to how the contest is setup - to the point where ‘Java4K’ may be a bit of a misnomer. Instead of focusing on binary size, we will focus on sourcecode size to which asset-sizes will be added. Entries (source + assets) will be limited to, say, 16K of sourcecode, which previously would have yielded a ~4K compressed binary for somebody with a reasonably advanced toolchain.
The result will be compiled & packed (serverside on JGO) in a JAR of which the final size plays no role. Both newbies and experts will likely find such a limit challenging enough to write a decent game with enough features, while still being restricted enough to ‘get it done’, reducing chances of feature creep.
To lower the barrier to entry even further, I will provide a game-loop, and people simply have to implement render() and/or update(), where a minimalistic valid contest-entry would be like:
[icode]MinimalisticEntry.java[/icode]
-public class MinimalisticEntry extends Java4kRev1 // which extends javax.swing.JPanel
+public class MinimalisticEntry extends Java4kRev2 // which extends java.awt.Canvas
{
int x;
// called 60x per second
public void update() { // move across screen at constant rate, regardless of framerate
if(++x >= w) x = 0; // 'w' & 'h' provided by superclass
}
// called at most 60x per second
public void render(Graphics2D g) {
g.setColor(Color.YELLOW);
g.drawRect(x, mouse.y, 64, 64); // 'mouse' provided by superclass
}
}
[icode]Java4kRev#.java[/icode] (superclass of your entries)
[tr]
[td]Rev 2[/td]
[td]http://pastebin.java-gaming.org/154eb0e2a231e
[/td]
[td]Backend now uses active rendering[/td]
[/tr]
[tr]
[td]Rev 1[/td]
[td]http://pastebin.java-gaming.org/e71548e1b2e1a
[/td]
[td]Initial dump[/td]
[/tr]
TODO:
- Add Keyboard support (alongside current Mouse support)
- Add active-rendering backend, as opposed to current EDT piggyback/hack
- Add support for identifying mouse buttons