4k Penguins


I was hoping to do more this year, but I found myself initially uninspired and later mired in move stuff and work.

This is, in short, a port of a board game I read a 2-sentence description of on Slashdot once. You are the black penguin; your goal is to collect the most fish. Control is entirely mouse-driven; click one of the tiles adjacent to your penguin to move there. As you move, spaces will crumble behind you, rendering them impassible; the game ends when there are no remaining moves for anyone.

This is a bit of a deviation from the sort of thing I’ve done before. Personally, I’m only kind of happy with it- I like the way it looks, and I think that the AI is pretty impressive considering the game fits in 4k. On the other hand, the game is okay but isn’t as viscerally fun as the games I’ve made for the contest before.

The penguins were taken from an old NES game that I found sprites for online. The fish were drawn by hand. I do want to tweak the penguin’s colors a little so they’ll be more neutral- especially that green one. The wave effect needs some work too (that’s what those little white things in the background are supposed to be), but I’m not sure if I’m going to have time to redo that.

I don’t have time to do a lot of tweaking because of the obvious encroaching deadline… I’d appreciate it if people would download it and let me know if there are any major errors, though. I’ve also not tried it on any machine but my Mac, so let me know if the graphics need to be tweaked on other OSes.

  • HC

hey nice one! I’m just curious how can I add images to the a 4k game… without using an image file… not sure if I’m clear enough… hope so. I have asked in another thread but got no response…

To add images with out the cost of seperate image files you have to ‘embed’ the image into the class. one way is to use a string constant representing the indecies of the colour of each pixel by a char and thus to ‘read’ your image you use BufferedImage.setRGB(x,y,colour) where colour is from a pallette array and is referenced by value of the read in char.

another similar way is to use Super Pack Me ( http://jgcwiki.datadino.com/jgcwiki/index.php?title=Image_Compression_Technology ) which does most of this for you.

The way i embed images into my j4k entry is after compliling into bytecode (.class) I parse the .class file and directly inject the image byte data as an ‘attribute’ of the .class file. This saves bytes by being able to embedd bytes directly (the other means you have to store char or strings which are more expensive) and also reduces the size of the constant pool further reducing the expense.

My image format is so:

<sprite data containing the width, height, and other game specific attributes for each sprite> (54 bytes)
for (i=0;i<no_of_sprites)
  <colour index of transparent colour> (1 byte)
  <no of colours n> (1 byte)
  <colour consisting of hue,saturation, brightness> (n*3 bytes)
  <image data consisting of the images' pixels palette indecies > (width * height)

I chose to use hue satuation, brightness instead of RGB as but chaning the hue of the sprite i am able to change the over all colour of each sprite very cheaply.

I used a variant of the SuperPackME format linked above to store my images. Beyond the Penguin and Fish sprites, however, everything was actually procedurally drawn. I actually used all-procedural art in my entries in 2005 and 2006; sprites are new to me. :slight_smile:

  • HC

ok, thanks for the clarification… but what is the image format used? gif, jpg or it is a raw format…? thanks again

SuperPackME uses a unique format to store image data… It will produce a file that you’ll need to include in your jar.

As I said before, I used sort of a customized version where I produced a big array of bytes and included that in my source code itself rather than using an external file. Considering I was only using it for two images, the external file didn’t seem worth it…

  • HC

This should have been unnecessary. SuperPackME already has all the tools to do this.

Just something to keep in mind for the next contest. :slight_smile: