Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (536)
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  
  SubPar (shooter in the making)  (Read 2755 times)
0 Members and 1 Guest are viewing this topic.
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Posted 2007-01-26 13:44:54 »

*** UPDATED 08-02-2007 ***
http://www.java-gaming.org/forums/index.php?topic=15776.msg126194#msg126194





I have been experimenting with a new system to stucture images and embedd them directly into a class file by means of a custom 'attribute'.

http://javaunlimited.net/hosted/moogie/test.jnlp
(use keyboard to move around... reloading with start you in another ship)
Please let me know if it
a) does not work for you
b) has bizarre behaviour (i.e. choppy then smooth)

It has been an interesting challenge but i have been successful, there are a couple more ideas for optimisations I want to try however it is at a point where it is giving significant dividends.

The main idea for my image storage is that there are likely to me gradients in an image and so by ordering the colour index of an image so that like colours are 'near' eachother then the indecies of the actual image to be stored will likewise be 'near' to eachother. So instead of recording the actual corresponding index for each pixel of the image, i instead record a delta. This delta will is always positive. Delta's which bring the index over the number of colours will cause the resultant index to be wrapped. This mechanism was chosen over the more intuitive negative and posive deltas as it was found that the implementation code need to read the image back was less expensive  when using the wrapped positive delta mechanism.

This also means that multiple images with different colour counts and indecies will have a similar looking output allowing for better compression using the a deflate compressor.

There are some other tricks used in this test game to get it under the 4k limit ( I do not record the dimensions of the graphics or some other control flags in the image data as the image dimension data is read seperatly and the image is assumed to have a transparent colour. The more general version of the image format contains this information in the header.)

So for this test the following image:


is optimally compressed by pngout to 2580 bytes (plus the extra overhead of creating a "whole" image by flipping and drawing multiple times)

my current scheme brings it down to : 2020 bytes after compression using kzip. (also due to the nature of reading of the format, the whole image can be created in a single pass reducing the expense to recreate the images)


The shooter 'SubPar' will probably either remove sprites or I will need to reduce the colour count in order to fit in some game logic. I have a couple of ideas which may  reduce the number of bytes needed with out loss of quality however I do not think that it will be sufficent. The first is make the image format more readily compressable by placing all the individual image 'headers' at the front to make a super header and thus having all the compressable data in one complete block. (this is do-able due to the fact that I know the sizes of the images before hand. The second idea is to attempt permuations of the ordering of the constant pool and other components of the classfile. This will probably not gain me much but every byte counts Tongue



Offline ChrisM

JGO Coder


Medals: 1
Projects: 1


END OF LINE.


« Reply #1 - Posted 2007-01-26 14:30:57 »

Wow!  Fantastic work!  Really smooth on my rig.

-Chris

Offline appel

JGO Wizard


Medals: 50
Projects: 4


I always win!


« Reply #2 - Posted 2007-01-26 15:51:30 »

Nice ships. I seriously doubt you'll be able to make a workable game with that Smiley

Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #3 - Posted 2007-01-26 22:45:24 »

Thanks Smiley

The ships are from 'free' sprites i have found on the web.

I am hoping that I can get away with 400 bytes of game logic and some how reducing the sprites' byte requriment.

Ideally I would have liked to have it fullscreen as it really adds to the experience but it is probably a luxury that cannot be afforded.
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #4 - Posted 2007-01-30 04:46:57 »

I have saved further bytes by:

- having at most 8 colours per sprite (i previously had 9 colours) this has had very little impact on the quality of the images thankfully.
- reordering the sprite storage order
- making the game now a vertical shooter (not 360 degree)
- multiple miscelaneous optimisations

And so I have saved a further 211 bytes Smiley

the latest: http://javaunlimited.net/hosted/moogie/test1.jnlp

I have a non-executable jar version which is full screen and thanks to the saved bytes likewise fits under the 4K limit... however with signing It is over the 4k limit Sad

fullscreen version: http://javaunlimited.net/hosted/moogie/test_full.jar

next step is to introduce enemy behavior...


Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #5 - Posted 2007-02-01 07:01:37 »

Some progress Smiley

-have added preliminary projectile fire (both the players and the enemy ships)
-added pixel perfect collision for projectiles
-added and removed some graphics

To do:
- add different ship movemnt patterns
- add "levels" (not sure if it will be random or scripted)
- add different projectiles/weapons
- add power ups

latest can be found : http://javaunlimited.net/hosted/moogie/test2.jnlp
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #6 - Posted 2007-02-01 09:48:28 »

hmm... just tested the test2 version... some interesting behaviour with ships dissappearing... i think it is related to array index overruns.
Offline c_lilian

Senior Member


Projects: 1


Java games will probably rock someday...


« Reply #7 - Posted 2007-02-01 10:08:23 »

Hi,

it's not working with java 1.4 on mac OS (uses System.nanoTime() which is available since java 5)

Lilian Smiley

Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #8 - Posted 2007-02-01 10:43:51 »

ah good point.

using nanotimer freed up a couple of bytes... i will put it back to the getcurrentTime method and sacrifice the bytes so that my mac brothers can play Smiley.
Offline c_lilian

Senior Member


Projects: 1


Java games will probably rock someday...


« Reply #9 - Posted 2007-02-01 11:16:47 »

well, don't forget the 4k contest rules specifies java 5, not 1.4...

you could also do like everybody else : put a 1.5+ in your jnlp file (I don't care, I've got another mac with java 5 Grin)

Lilian Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #10 - Posted 2007-02-01 11:34:49 »

well it was only a couple of bytes so unless i desperately need it leaving it using the older methods should be fine. (i currently have a budget of approx 130 bytes spare)
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #11 - Posted 2007-02-08 12:21:27 »

Update Smiley

http://javaunlimited.net/hosted/moogie/test3.jnlp



I have only had a little time to devote to my j4k game but the concept is stable and this latest version is the one which will evolve into the finished game.

In this version:

- there are now 'waves' of enemies which will progressivily get harder. (probably too hard learning curve at the moment)
- (Starts at wave 5 to give medium difficultly start point Tongue )
- 9 sprites each with 5 different colours giving 45 sprites Smiley
- two attack ship moment patterns (spread and single file)
- 15 waves of attack
- enemies initally spawn only at the top of the screen but will spawn progressively around the other sides as the waves continue
- enemies initally fly poorly toward you to begin with but will progressively get better aim at the waves continue
- enemies initally only attack with 1 or two ships in a sortie, but will progressively attack with more per sortie.

Still to do:

- POWER UPS Smiley
- implement enemies health rating (i.e. how many shots to kill an enemy)
- add more movment behaviours (e.g. sine wave, random walk, homing, etc)
- add different enemy fire (e.g. missles)
- change movment behaviours to be based on the type of ship.
- sound?

I have removed some un needed sprites and performed some other optimisations and now I have 416 bytes left to use so i hope to be able to put in most of my to do list.

Can people let me know if this version works with 1.4 and is stable? Can a Mac user and a Linux user let me know whether there is any interesting behaviours?

Cheers

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

Riven (18 views)
2014-07-29 18:09:19

Riven (13 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (31 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (42 views)
2014-07-24 01:59:36

Riven (41 views)
2014-07-23 21:16:32

Riven (28 views)
2014-07-23 21:07:15

Riven (29 views)
2014-07-23 20:56:16

ctomni231 (60 views)
2014-07-18 06:55:21
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!