Where do I begin?

I’ve never coded a 4k java game before ??? I’m about to put on a course of 4 workshops for undergraduate computing students to try to stimulate their programming of java, and want to get them to try to write a 4k game. Can anyone recommend any books or a place to look I can use to create some worksheets to help them (and me) get started? I guess I need some kind of instruction list or description of the process of creating a game and optimising it. Any advice would be very much appreciated!

4K is a horrible way to learn java. About 80% of the task is in compression of the JAR, and has nothing to do with Java.

Further, it encourages anti-patterns. I’d advise you to stimulate their motivation in other ways. Seriously.

As far as I seen no book teaching for java4k. It’ll be great if I’m the one who first do it :slight_smile: You can try make a game for desktop first, out of any compo.

I think Java4k is a great way to learn Java + having fun as it keeps the code very simple,
and you have visual and interative results with low overhead.
(Just keep out the freaky bit optimizations for compressing images etc, this is not stuff for beginners,
and fuzzing with the obfuscator and compressors is also not needed for teaching the concept)

This is more motivating than making a huge class-hierarchy to output a Textline

There are some template 4k codes you can have a look at.

Try to build a simple packman game around it, to teach the code step by step

Here some random ideas IDEA!

Learn to code games in pure Java2D first, don’t worry about size. Once you’ve got a grasp and good understanding of the API only then should you attempt a Java 4k game.

The starting place is creating a small game loop and optimise it as much as possible. There are a number of threads in the java4k contest forum subsections (especially in the earlier years of the 4k contests) that discuss small loops and have various code snippets. Source code for various 4k games are also available that can help but usually very messy and hard to understand. The rest is just manual optimisations and using various tool to get the size down.

Thanks everyone, I’ll see what I can come up with and let you know how the students do! I’m not sure it’s the best way to help them learn (not my idea) but it may motivate them to do some coding in their spare time… Thanks again