Space Pirates 3D action/strategy shooter

www.geocities.com/javaisfun/
then click on space pirates

Its a pretty fast, crisp looking, space shooter. The keys mappings are on the webpage.

I’ve been developing this game for about 2 weeks now, its all 3d but not j3d so it runs on just about any old vm not just java2

check it out and it would help a lot if you have any comments. please let me know the speed the game runs at on your machine (F1 shows fps) and your specs.

Enjoy!

Nice game, looking good! How big is your vector graphic rendering layer?

Laptop, 750MHz, 8MB S3 Savage/IX, WinME. 23.9 fps average.

thanks, it runs a little slow though i’ve had difficulties with my laptop as well (24’s not bad just not great)
i may be the video card or what else i’m not sure at the moment

thanks

The keys mappings are on the webpage.

except: R - reset :>

average fps: 28.5 (fps: 25-33)

specs: k7 500, 128mb, gf2mx, win98se, sun jre 1.4.1_01

well i’m usually usin 800x600 and i had to switch to blurry ugly 60hz 1024x768 to see everything of the window (my screen is crap) :]

edit: oh… and tab seems to do nothing ._o

Nice game.
Got 30fps on a 1GHz P3, 192Mb, JRE 1.4.1, Intel 8somethingcrap videocard.

You’re right, to be honest 30fps doesn’t seem particulary fast considering it’s flatshaded with no lighting etc.
But otherwise, quite nice (I like the different camera angles).

tab should morph the ship to a scout ship (use camera 1 to view better) if it doesn’t i don’t know why. the code is very simple and doesn’t do anything out of the ordinary, strange?

hum… dunno…

i had the same probs with the tab key in my programms… well one java programm worked. dunno what was different there :]

i’ll have a closer look (later)

is there any error shown in the console?

On my PC, TAB doesn’t seem to work as well… :-/
Maybe it’s a ‘reserved’ key or something in some VM’s? (maybe related to TAB-ing through user interface components?)

i’d have to look that one up. I’m using ie 5.5 and the msjvm and updated version i think, does the tab still not work in the application version?

nope. it’s like i didnt even touched the tab key…

[several minutes and a lunch later]

ok. now i know what’s needed :slight_smile:

here is a snipped:


[...]
DocComponentListener DCL=new DocComponentListener();
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventPostProcessor(DCL);
kgfx.addKeyListener(DCL); //kgfx is my main component
[...]
class DocComponentListener implements KeyListener, KeyEventPostProcessor
      {
      public boolean postProcessKeyEvent(KeyEvent e)
      {
            System.out.println("<-p"); //this one catches tab
            return true;
      }
      public void keyTyped(KeyEvent event)
      {
            System.out.println("<-t");
      }
      public void keyPressed(KeyEvent event) //punch in
      {
            int x=(int)event.getKeyChar();
            System.out.println("pressed "+event.getKeyCode() +"("+event.getKeyChar()+") | int="+x);

            if(event.getKeyCode()!=0)
            {
                  if(event.getKeyCode()<MAX_KEYCODES)
                  {
                        if(kcm[event.getKeyCode()]!=-1)
                        {
                              keys[kcm[event.getKeyCode()]]=true;

                              if(keys[69]) //both shift
                                    keys[57]=true;

                              if(keys[74]) //both ctrl
                                    keys[70]=true;

                              if(keys[101]) //both return
                                    keys[56]=true;

                              if(keys[70]&&keys[71]) //maybe altgr
                                    keys[73]=true;

                        }
                  }
            }
      }
      public void keyReleased(KeyEvent event) //punch out
      {
            int x=(int)event.getKeyChar();
            System.out.println("released "+event.getKeyCode()+"("+event.getKeyChar()+")");

            if(event.getKeyCode()!=0)
            {
                  if(event.getKeyCode()<768)
                  {
                        if(kcm[event.getKeyCode()]!=-1)
                        {
                              keys[kcm[event.getKeyCode()]]=false;

                              if(!keys[69]) //both shift
                                    keys[57]=false;

                              if(!keys[74]) //both ctrl
                                    keys[70]=false;

                              if(!keys[101]) //both return
                                    keys[56]=false;

                              if(!keys[70]||!keys[71]) //maybe altgr
                                    keys[73]=false;

                        }
                  }
            }
      }
}

thanks, I guess the best way to fix this is to just change the key

another example of poor platform-independance i guess

Don’t target the ms vm if you aim for platform independance. Microsoft is not allowed to use the name ‘java’ for a reason, you know.

That said, I must also admit I’m not 100% sure yet this is exactly the reason why it works on the MS VM and not a JVM… :-/

i’ve found the sun jvm runs much slower (about half as fast) as the ms vm. The reason why i don’t know. In some of my programs the ms vm was more stable than the jvm, it didn’t make any sense to me. Microsoft releasing a more stable build? almost enough to make me fall off my chair. It may be the way I code, i’m not sure .All i know is ms vm is faster, so i use it

True, the ms vm is pretty fast and faster than the Sun VM in some things. I haven’t had stability issues with the sun jvm, though…
The IBM JVM is faster than the ms vm in every respect I could find.
The point is that if you code for a JVM (so you test always on a JVM), chances are better that your code will run on the ms vm than the other way around.
Best idea in any case is probably to test on as many jvms as possible, even though it should not matter.

pretty cool. ~55 fps athlon xp 2100+, winxp, java 1.4

found a bug btw. when the ship explodes, it looks like you don’t rotate the bits around it’s center

if you use fullscreen+bufferstrategy+a good timer it’ll be a lot faster than 1.1. lwjgl would also be yummy

i hate 1.1 :slight_smile:

your right, what happens is the models shared points a broken up so each surface has its on seperate points. All the points are then rotated and translated about the center of the object exactly as the model appears when it isn’t exploding. Before i translate them, to make it look a little nicer, i rotate the surfaces kinda randomly, so it looks shimmery. This is where the bug occurs, i do this extra rotation around the center of the model and not the center of each surface. So when the explosion happens the pieces are travelling essentially in a 3d wave motion.

If a piece is on the center it looks right, the father it starts the center the more irregular it looks. I didn’t think it was much of a problem, but now that u point it out i really think i should change it

Thanks!

[quote]your right, what happens is the models shared points a broken up so each surface has its on seperate points. All the points are then rotated and translated about the center of the object exactly as the model appears when it isn’t exploding.

I didn’t think it was much of a problem, but now that u point it out i really think i should change it
[/quote]
Nah, it looks cool as is (and is a unique explosion for a game - makes the game less boringly identical to asteroids).

Anyway, on a 1Ghz P3 /256Mb, it’s smooth but a bit slow (especially turning is too slow to be playable, IMHO). Also, why are the keys set to such painful/hard to use values? (I hereby repeat my request that EVERONE use soft-coded key assignments from day one of their game development - what’s so hard about having a text file and reading them in?) Both F1 and tab do nothing - can I please second the suggestion that you develop with any of the officially recognised VM’s? I suspect F1 is not an entirely legal key either (or else the FPS were showing up somewhere weird?).

Also, why does it popup in it’s own window? If you want a standalone window, you should really do it as a java app (package as a jar file for download so people can just double click on it).

All testing done on the latest Sun VM (1.4.1), using appletviewer under linux…

i changed the explosion simply by averaging the points of a surface to find a quick center and then rotate them around that, the change looks better i think, sometimes its hard to tell whats right until u see it.

the tab isn’t legal on some vm so thats changed i didn’t know about f1 though (fps should appear at top of screen) i guess i’ll change that too

i added some more levels (they were already they’re just not able to change them)

geocities is being a max payne in the ass so i’ll upload it when i can if you wanna check out the new stuff now, just email me at funkmasterjones@hotmail.com and i’ll send to you

thanks derek

oh yeah and about the popup

all my games are frame-based because i run them as both applets and applications theres only one file about 20 lines of actual code that distinguish an applet from application

the key settings will be modifiable when i get to that sometime in the future, whats so hard about them anyways?