Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (497)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  4K Shooter  (Read 7427 times)
0 Members and 1 Guest are viewing this topic.
Offline Abuse

JGO Knight


Medals: 12


falling into the abyss of reality


« Posted 2004-02-22 21:41:12 »

Just a little 4K Shooter I've written for the J4K compo. on forums.sun.com.
Any1 who frequents there will have prolly already seen it, others may not.

There are 2 flavours of it atm,

regular :-

http://www.pkl.net/~rsc/4KShooter/4KShooter.jar

Its hard coded to use 1024x768x16@60, so if your gfxcard doesn't support that res/refresh it will most likely die on startup.
It also takes advantage of the experimental fullalpha(D3D) acceleration available on Windows.
Older graphics cards will not support this feature, and you will end up getting 1fps instead of 60.
But fear not, I have also done a version that doesn't use the Windows experimental stuff....

SE :- (Sh*t Edition)

http://www.pkl.net/~rsc/4KShooter/4KShooterSE.jar

This version still requires fullscreen exclusive (and resolution changing ability), so it prolly wont work on linux or mac.

There is 1 more dependancy,
Sfx use midi voices, so you need a midi soundbank installed to hear anything.
The SDK comes with 1, the JRE does not. (though you may still get sfx if your soundcard has a midi soundbank of its own)

Oh and 1.4.x is required.
(its been tested with 1.5, and there is a bug in the SE version (palletes of the images are corrupt))

btw, did I forget to mention that the entire thing fits in 4Kb Grin

I'd be interested in what scores ppl manage to get,
I think my high atm is 37kills Tongue
Also, any setups that the game won't run on would be useful info too.

Gameplay Rules
----------------
1) Shoot the enemies.
2) Dont get Shot by the enemies.
3) Fly into the debris from dead enemies, to charge your shield.
4) Dont fly into the enemies Tongue


Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #1 - Posted 2004-02-23 01:05:04 »

Impressive!!!!!

even has sound.

i think i would not like to see the source due to the optimizations you must have had implemented
Offline Abuse

JGO Knight


Medals: 12


falling into the abyss of reality


« Reply #2 - Posted 2004-02-23 06:50:38 »

Quote
Impressive!!!!!

even has sound.

i think i would not like to see the source due to the optimizations you must have had implemented


very true Wink

but if u ever feel like torturing yourself :-

Java Source :-
http://www.pkl.net/~rsc/4KShooter/A.java
Hand optimised bytecode (jasmin format) :-
http://www.pkl.net/~rsc/4KShooter/a.j

JAX, JoGa, BCEL and Jasmin were used to compile & optimise it.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline princec

JGO Kernel


Medals: 378
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #3 - Posted 2004-02-23 06:58:07 »

That's really, really impressive for 4K Smiley Great controls too Tongue

Cas Smiley

Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #4 - Posted 2004-02-23 07:10:21 »

Quote
Just a little 4K Shooter I've written for the J4K compo. on forums.sun.com.
Any1 who frequents there will have prolly already seen it, others may not.


Could you do me a screenshot (hint, hint)?

http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=Announcements;action=display;num=1077469870

malloc will be first against the wall when the revolution comes...
Offline Abuse

JGO Knight


Medals: 12


falling into the abyss of reality


« Reply #5 - Posted 2004-02-23 07:22:31 »

Quote


There you go :-
http://www.pkl.net/~rsc/4KShooter/4KShooter.jpg

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #6 - Posted 2004-02-23 11:40:17 »

Quote
This version still requires fullscreen exclusive (and resolution changing ability), so it prolly wont work on linux or mac.


Mac does support fullscreen mode.  (Though it has it's share of bugs at the moment.)

Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #7 - Posted 2004-02-23 11:45:33 »

It runs on the Mac, but it appears to have problems.  The graphics seem to be wrong.  I crashed into a ship and saw a strange black outline in a blue circle around my otherwise unrecognizable 'ship'.

I can barely move around with the cursor keys and was unable to fire or tell what direction I was facing etc.  This was all with the SE version.

Offline Abuse

JGO Knight


Medals: 12


falling into the abyss of reality


« Reply #8 - Posted 2004-02-23 14:04:37 »

Quote
It runs on the Mac, but it appears to have problems.  The graphics seem to be wrong.  I crashed into a ship and saw a strange black outline in a blue circle around my otherwise unrecognizable 'ship'.

I can barely move around with the cursor keys and was unable to fire or tell what direction I was facing etc.  This was all with the SE version.


Very interesting, can you make a screenshot?

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #9 - Posted 2004-02-23 16:05:07 »

Quote


Very interesting, can you make a screenshot?


Sure:


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

JGO Knight


Medals: 12


falling into the abyss of reality


« Reply #10 - Posted 2004-02-23 16:38:22 »

V. interesting Shocked

The lasers arn't corrupt - which indicates the problem lies in the image creation.

Looks like Apples ImageIO gif codec is as buggy as Suns used to be in 1.4.0 Cheesy

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #11 - Posted 2004-02-23 17:51:54 »

I always use PNGs... but I've heard that there have been problems with the PNG ImageIO codec as well.. though "it works for me".

It really is too bad that such basic stuff gets broken.  I mean if they could show that the image file doesn't follow the spec then fine it isn't really their bug.. but there are only so many variations possible with GIF.. you could test all of them easily.

P.S.  How do you work the game?  I can't fire.

Offline Abuse

JGO Knight


Medals: 12


falling into the abyss of reality


« Reply #12 - Posted 2004-02-24 06:03:23 »

Quote
I always use PNGs... but I've heard that there have been problems with the PNG ImageIO codec as well.. though "it works for me".

It really is too bad that such basic stuff gets broken.  I mean if they could show that the image file doesn't follow the spec then fine it isn't really their bug.. but there are only so many variations possible with GIF.. you could test all of them easily.

P.S.  How do you work the game?  I can't fire.


I would use png as well.... but the filesize would be far greater ^_^

As for controls :-

Arrow keys control your thrust direction. (forward,backward, strafe left, strafe right)
Mouse controls your facing (your ship turns to face the mouse cursor)
left mouse button fires
right mouse button boosts.

btw, 1 more question - when in fullscreen exclusive mode on the mac, is the framerate vsync locked?

:edit:

ok, i've made 2 new versions of the game to see if it is a bug in the 16color gif codec.

Uses a 16million color png(with alpha mask) :-
http://www.pkl.net/~rsc/4KShooter/4KShooterSEpng.jar
Uses a 256color gif(with bitmask) :-
http://www.pkl.net/~rsc/4KShooter/4KShooterSE256gif.jar

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline princec

JGO Kernel


Medals: 378
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #13 - Posted 2004-02-24 06:28:55 »

I don't recommend PNGs. Most tools export the alpha channel wrongly and you get a nasty rim round the edges of your sprites (see AF for example). TGA gets it right.

Cas Smiley

Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #14 - Posted 2004-02-24 11:08:17 »

Quote


I would use png as well.... but the filesize would be far greater ^_^

Odd, I find PNGs are usually smaller than GIFs

Quote

left mouse button fires
right mouse button boosts.


Ah ha... due to a particularly brain dead bug in Mac fullscreen mode mouse buttons don't actually do anything while in full screen.  I had forgotten about this - actually I hoped it had been fixed... sigh...

Quote
btw, 1 more question - when in fullscreen exclusive mode on the mac, is the framerate vsync locked?


I'm not sure.

Quote

ok, i've made 2 new versions of the game to see if it is a bug in the 16color gif codec.

Uses a 16million color png(with alpha mask) :-
http://www.pkl.net/~rsc/4KShooter/4KShooterSEpng.jar

this works correctly.
Quote

This works correctly and seems a bit faster than the PNG version.

What is the pixel format of the back-buffer?  Mac is very sensitive to using 'native' pixel formats  (RGBA, RGBA_PRE are best I think - I posted something about this in performance tuning a while ago).

Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #15 - Posted 2004-02-24 11:10:19 »

Quote
I don't recommend PNGs. Most tools export the alpha channel wrongly and you get a nasty rim round the edges of your sprites (see AF for example). TGA gets it right.

Cas Smiley


What tools have you had problems with?
I use GIMP to make my PNGs and they seem to be ok..  Note that Photoshop is complete sh*t when it comes to dealing with an alpha channel - pathetic really.

Offline princec

JGO Kernel


Medals: 378
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #16 - Posted 2004-02-24 11:19:01 »

Ahh... must just be the crap tools then. Both PSP and Photoshop exhibit this behaviour. 3dsmax might too.

Cas Smiley

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #17 - Posted 2004-02-24 11:58:50 »

PSP can just about be persuaded to save a png with alpha channel, but its not intuitive and requires some obscure tinkering. Its a pain to actually edit them as well, so I find it much easier just to keep the alpha as a separate greyscale image and merge them at load time.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline Abuse

JGO Knight


Medals: 12


falling into the abyss of reality


« Reply #18 - Posted 2004-02-24 12:05:05 »

Quote

Odd, I find PNGs are usually smaller than GIFs


for large files, that is true, but for very small files (the image is 21x50 16colors Tongue) gif is better, it has a smaller overhead/gives better compression ratio)

Quote
Ah ha... due to a particularly brain dead bug in Mac fullscreen mode mouse buttons don't actually do anything while in full screen.  I had forgotten about this - actually I hoped it had been fixed... sigh...


ahhhhh, now that kind of a bug, I can't work around Cheesy

Quote

I'm not sure.


it'd be useful to know...

what framerate does this test give? :-

http://www.pkl.net/~rsc/downloads/Test.class


Quote
this works correctly.
This works correctly and seems a bit faster than the PNG version.

What is the pixel format of the back-buffer?  Mac is very sensitive to using 'native' pixel formats  (RGBA, RGBA_PRE are best I think - I posted something about this in performance tuning a while ago).


Its all using BufferStrategy and images returned from createCompatibleImage, so it *should* be using optimal rendering loops.

There should certainly be no speed difference between the 2 source images, as they are copied to an intermediate image, and the original is thrown away.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #19 - Posted 2004-02-24 14:55:25 »

Quote
what framerate does this test give? :-

http://www.pkl.net/~rsc/downloads/Test.class


Low of 19 fps, high of 24 fps... it bounces around within that range.  Pretty lame eh?

Yes, createCompatibleImage should give the correct format.  I could be mistaken about the perceived speed of the previous tests with PNG vs. GIF.

Offline Abuse

JGO Knight


Medals: 12


falling into the abyss of reality


« Reply #20 - Posted 2004-02-24 15:09:34 »

Quote


Low of 19 fps, high of 24 fps... it bounces around within that range.  Pretty lame eh?

Yes, createCompatibleImage should give the correct format.  I could be mistaken about the perceived speed of the previous tests with PNG vs. GIF.


oh.... lol

I wasn't expecting it to be unable to clear the screen 60times/second! (no wonder my ShooterSE runs slowly :/)

ok, try this Test

http://www.pkl.net/~rsc/downloads/Test2.class

It won't render anything to the screen, it'll just output the number of times bufferStrategy.show() returned per second, to the console.

If its vsynced, it should output around 60 (+/- 1)
if it isn't vsynced, it will give a much higher number.

escape to quit.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #21 - Posted 2004-02-24 15:23:38 »

Ok, something is severely wrong....

Test2 prints: (I've put it all on one line)

12, 26, 22, 25, 26, 22, 26, 26, 21, 26, 26, 22, 26, 26, 22, 26, 19, 16, 16, 19, 15, 25, 25, 21, 26, 25, 21, 26, 23, 21, 26, 26, 20, 26, 25, 21, 24, 25, 22, 24, 21

The screen shows the striped Aqua background.

What resolution is the screen?   I wonder if other resolutions would have different speeds?

Offline jbanes

JGO Coder


Projects: 1


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


« Reply #22 - Posted 2004-02-24 15:27:51 »

I'm quickly coming to the opinion that Apple simply doesn't care about gaming on the Mac. They've gone through three major iterations of the 1.4 JVM (1.4.0, 1.4.1, 1.4.2) and to date have not even added proper support for VolatileImages. It seems like such a simple thing, and just about every Java developer is screaming for it. What's the problem already?

Java Game Console Project
Last Journal Entry: 12/17/04
Offline kevglass

JGO Kernel


Medals: 164
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #23 - Posted 2004-02-24 15:33:20 »

Sorry, tried to get someone to test this on another thread, but this:

http://developer.apple.com/documentation/ReleaseNotes/Java/Java131Update1RN/NewFeatures/index.html

Seems to imply that accelerated mode is turned off by default but can be enabled using system properties and/or key controls.. I realise this is for 1.3.1 but it might still work?

Kev

Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #24 - Posted 2004-02-24 15:48:12 »

Quote
I'm quickly coming to the opinion that Apple simply doesn't care about gaming on the Mac. They've gone through three major iterations of the 1.4 JVM (1.4.0, 1.4.1, 1.4.2) and to date have not even added proper support for VolatileImages. It seems like such a simple thing, and just about every Java developer is screaming for it. What's the problem already?


It seems simple, but isn't.  Apple has done 1.3.1, 1.4.1, and 1.4.2.

1.3.1 used 'Carbon' APIs to implement AWT.  But Carbon is an older API used to transition from OS 9.  What they really like you to use is 'Cocoa' an object oriented (Objective-C) API.  When they went from 1.3.1 to 1.4.1 they ported all of their AWT code to use the Cocoa APIs instead of Carbon.  That was a lot of work.. and they focused on getting done as opposed to making it fast.  Then there is the impending release of 1.5 from Sun.. they needed to remain competitive and so they did 1.4.2 to catch up to Sun and they DID improve performance some with that release.  But yes the priority was not on optimizing for games.. they just needed to get things working well for typical Java apps - which to date doesn't really include action games.

I file bugs with Apple whenever I find things that suck - such as their fullscreen mouse issues and graphics performance.  I know they are aware of it.  At this point though I'm betting they are hoping to use the OpenGL pipeline in 1.5, since their entire windowing system (Quartz Extreme) is based on OpenGL.   I think because they already have OpenGL under the hood that integrating the hardware acceleration might have been a little more challenging to make it play nice with the rest of their system.. along  the same lines as the initial Direct Draw problems that happened with Windows - where translucent windows and cursors would flicker like mad whenever a Java app painted.

I think it is mainly a case of limited resources.  From the little communication I've seen from Apple I'm sure the Java guys there want a top notch implementation.  But I also see that they don't seem to be making progress for gaming in general - their OpenGL implementation is a bit behind the times now - and for my laptop I can't update drivers myself, I must rely on Apple OS patches for that sort of thing.

As far as hardware acceleration being on or off.  If you have 1.4 installed the hardware acceleration of 1.3.1 is disabled by default.  In 1.4 they don't have hardware acceleration at all.  They just haven't got around to doing it with the Cocoa AWT implementation.

Offline kevglass

JGO Kernel


Medals: 164
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #25 - Posted 2004-02-24 15:56:49 »

Quote

As far as hardware acceleration being on or off.  If you have 1.4 installed the hardware acceleration of 1.3.1 is disabled by default.  In 1.4 they don't have hardware acceleration at all.  They just haven't got around to doing it with the Cocoa AWT implementation.


Sorry, guess I'm being dense..  does this mean you can't even turn on the 1.3.1 hardware implementation in 1.4 ?

Kev

Offline Abuse

JGO Knight


Medals: 12


falling into the abyss of reality


« Reply #26 - Posted 2004-02-24 16:18:19 »

Quote
Ok, something is severely wrong....

Test2 prints: (I've put it all on one line)

12, 26, 22, 25, 26, 22, 26, 26, 21, 26, 26, 22, 26, 26, 22, 26, 19, 16, 16, 19, 15, 25, 25, 21, 26, 25, 21, 26, 23, 21, 26, 26, 20, 26, 25, 21, 24, 25, 22, 24, 21

The screen shows the striped Aqua background.

What resolution is the screen?   I wonder if other resolutions would have different speeds?


hmm, from that I can conclude only 1 thing,
I have no idea what is going on Wink

Heres the code

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
public class Test2 extends Frame
{
   volatile boolean running = true;
   public Test2()
   {
      enableEvents(AWTEvent.KEY_EVENT_MASK);
      setUndecorated(true);
      GraphicsDevice gd = getGraphicsConfiguration().getDevice();      
      gd.setFullScreenWindow(this);
      gd.setDisplayMode(new DisplayMode(800,600,16,60));
      createBufferStrategy(2);
      int frameCount =0;
      long lastTime = System.currentTimeMillis();
      String frameRate = "N/A";
      while(running)
      {
         if(System.currentTimeMillis()-lastTime>1000)
         {
            lastTime = System.currentTimeMillis();
            System.out.println(String.valueOf(frameCount));
            frameCount=0;
         }
         BufferStrategy bs = getBufferStrategy();
         frameCount++;
         getBufferStrategy().show();
      }
      dispose();
   }
  
   public void processKeyEvent(KeyEvent ke)
   {
     if(ke.getKeyCode()==KeyEvent.VK_ESCAPE) running = false;
   }

   public static void main(String [] args)
   {
      new Test2();
   }
}


From those results, I would guess that :-

a) it isn't using page flipping in fullscreen.
b) therefor, fullscreen won't be vsynced.
c) it is backbuffering in main memory not vram.
d) it can't even blit a single 800x600 rectangle from main memory to vram at 60fps :-/

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #27 - Posted 2004-02-24 20:29:10 »

Quote


Sorry, guess I'm being dense..  does this mean you can't even turn on the 1.3.1 hardware implementation in 1.4 ?

Kev


This means to get hardware acceleration you have to run under 1.3.1 AND force it on by setting a property.

Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #28 - Posted 2004-02-24 21:13:47 »

FYI.. on Mac OS X 10.3.2  JRE 1.4.2_03

I got the BufferCapabilities adding a few lines to the above test...
isFullScreenRequired()=false
isMultiBufferAvailable()=false
isPageFlipping()=false

No page flipping is lame.  But even so a blit even if it is just a software copy loop shouldn't be so slow.
Still investigating...

Offline javatypo

Junior Member





« Reply #29 - Posted 2004-03-02 20:22:47 »

thats a sweet game  Cheesy. it has some cool ways of doing things, like the event handling code i like it.. im finally into physics in science (lol in grade 10, so science is a mix of bio, chem and physics) so i will be able to understand more of your physics code.

Addition >

I can only run the SE version... i take it i cant run the non SE version because of my graphics card? i think you told me why already, but i forget if it was my card or drivers..? (dont laugh Tongue) NVidia TNT 2 is that the problem?
Pages: [1] 2
  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.

BurntPizza (8 views)
2014-09-21 02:42:18

BurntPizza (9 views)
2014-09-21 01:30:30

BurntPizza (12 views)
2014-09-21 00:34:41

moogie (12 views)
2014-09-21 00:26:15

UprightPath (23 views)
2014-09-20 20:14:06

BurntPizza (27 views)
2014-09-19 03:14:18

Dwinin (40 views)
2014-09-12 09:08:26

Norakomi (70 views)
2014-09-10 13:57:51

TehJavaDev (96 views)
2014-09-10 06:39:09

Tekkerue (49 views)
2014-09-09 02:24:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!