Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (578)
games submitted by our members
Games in WIP (499)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  4k Penguins  (Read 5085 times)
0 Members and 1 Guest are viewing this topic.
Offline hclower

Junior Member


Projects: 2



« Posted 2007-02-26 04:38:09 »



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
Offline luisoft

JGO Coder


Projects: 6


Java games rock!


« Reply #1 - Posted 2007-02-26 20:57:01 »

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...
Offline moogie

JGO Knight


Medals: 11
Projects: 5
Exp: 10 years


Java games rock!


« Reply #2 - Posted 2007-02-26 22:10:25 »

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:

1  
2  
3  
4  
5  
6  
7  
8  
<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.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline hclower

Junior Member


Projects: 2



« Reply #3 - Posted 2007-02-26 23:44:54 »

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. Smiley

- HC
Offline luisoft

JGO Coder


Projects: 6


Java games rock!


« Reply #4 - Posted 2007-02-27 12:12:29 »

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

Junior Member


Projects: 2



« Reply #5 - Posted 2007-02-27 22:32:21 »

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
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #6 - Posted 2007-03-22 16:20:29 »

SuperPackME uses a unique format to store image data... It will produce  a file that you'll need to include in your jar.
Actually, it will produce a file for inlining into the Class file. Look at the Readme.html file. It explains how to use the BinaryToHex and ClassInliner tools to insert the data into your file.

The Decoder.java file contains the necessary code for decoding the inlined data. You can either strip the necessary functions out of that, or rename it and use it as the basis for your code.

Quote
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...
This should have been unnecessary. SuperPackME already has all the tools to do this.

Just something to keep in mind for the next contest. Smiley

Java Game Console Project
Last Journal Entry: 12/17/04
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (28 views)
2014-04-15 18:08:23

BurntPizza (25 views)
2014-04-15 03:46:01

UprightPath (40 views)
2014-04-14 17:39:50

UprightPath (22 views)
2014-04-14 17:35:47

Porlus (38 views)
2014-04-14 15:48:38

tom_mai78101 (62 views)
2014-04-10 04:04:31

BurntPizza (121 views)
2014-04-08 23:06:04

tom_mai78101 (221 views)
2014-04-05 13:34:39

trollwarrior1 (188 views)
2014-04-04 12:06:45

CJLetsGame (195 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!