simple shooter game

http://www.wayrad.com/paulb/minigame1/

has spaceships and explosions. whee! it currently only works in the MS jvm though… I’ll fix that sometime.

ok i recompiled it for the sun jvm. should work fine with any browser/jvm. I did notice pretty bad garbage collection induced framerate hitches in the sun jvm. maybe i’ll fix that one day also…

[quote]http://www.wayrad.com/paulb/minigame1/

has spaceships and explosions. whee! it currently only works in the MS jvm though… I’ll fix that sometime.
[/quote]
Well, hard to get excited about it until it runs in a regular VM so don’t expect a lot of feedback until you “fix” the reliance on MS.

Bill

Nice game. I especially like the firing and explosion effects. :smiley:

Yeah - It’s rather cute! :wink: But, what’s a streak? I got 48 thinking it wasn’t bad, but your hi-score table has streaks running into 100s!!! Did they cheat? :slight_smile:

A stupid question: the transparent balls you use for the bullets et al, how did you load them up? Are they .png files or something?

no, the high scores are real. (i know since i got most of them myself). my best is a streak of about 1200. (Streaks are the number of enemies you kill in a row without letting them get past you).

the actual point value for any ship is a function of the game time and your current streak, so it grows pretty exponentially.

the transparent balls are actually done in code. the only images loaded are the two spaceship images.

It looks and plays really nice! 8)

I was getting between anything between 50 and 70 FPS on a P4 1.8Ghz, 256 RAM, GeForce 4 32 MEG

Nice particles…

Cool little game :slight_smile:

I tried it on the sun jvm (1.4.1) and it works great. I didn’t notice the gc hiccups you mentioned…

Awesome… Could you please post your particle code… they look great. 8)

Ok, I’ll swallow a little pride. I fired up IE and tried it out. It’s very good, and as people have said those particle effects are very well done.

Keep up the good work,

Bill

Nice game. You said the only images are loaded are the ships; did you do ship rotation in software? Did you do blending of the particles in software? Or is it Graphics2D?

I tried the game in Mozilla with jre 1.4.1 on winxp - didn’t work; Mozilla hung and although I could close it the mozilla.exe process would not quit - you might have a stray thread somewhere. Ran fine in IE though (with jre 1.4.1)

I am a bit miffed though because I spent a week recently coding a 1. star field 2. burst and 3. fountain particle effects, (although with out blending,) with an eye for doing a shooter. Ah well, good job nonetheless.

The ships are pre-rotated in code. The particles are all additive blended. It actually doesnt use any of java’s graphics code except to draw the image to the applet every frame. I set it up with a MemoryImageSource object. It can take an int array for the pixels. I do all of the rendering myself into that array and then call memSource.newPixels(). then I get the Graphics object from the applet and call drawImage(). The stars are all just particles with varying speeds.

wow very nice…I see wizards throwing fireballs with those effects.

Well, if the paricles are done in real time, then why are they bound to a rectangle, rather than expanding to a circle-like shape. After watching the particle effects, it looks more like a rendered image / sprite with transparency.

Also, if the star field are all particles, why do they travel in “layers”. Why not have them all travel at different speeds? Seems like you did a lot of particle work, for an effect that isn’t that different than using sprites.

Excuse me for sounding unimpressed, but can you show us something else? Like a spark, fire, water fountain-like effect, or something similar that uses totally random-flying and fading particles using your code?

Even a pure tech demo showing off the programibility of your pariticle system would be really cool.

I might have explained this a bit poorly. the particles are sprites that are generated in code when the app starts, not everytime they are rendered. They are additively blended when rendered, but they could just as easily be loaded from a file. as far as the stars are concerned, it would have been easier codewise to have a few “sheets” that moved by at different speeds. the problem is fillrate. Its far faster to just blank the background (fill with black) and draw some particles than to blend multiple layers with transparency. Thats also the reason that the game is running at 300x300 instead of 640x480 or higher… I have to (get to) draw each pixel every frame. Since this is just a pet project of mine that has no timeframe/schedule/goal, I get to do it how I want. I prefer working with 300x300 pixels that i can actually control than working with a system where the lowest primitive is a sprite object that can’t even do additive or multiplicitive (sp?) or whatever blending. one cool thing that I can do with this game is instead of clearing the buffer with black between frames, i can fill with black at 50% alpha. this gives it a neat motion blur effect that would otherwise be impossible with the higher level java 2d apis.

Sorry to jump in, but it wouldn’t be impossible in Java2D accelerated mode, especially at 300x300. You could quite happily fill the screen with 50% alpha. I’m not sure, but was one of the aims to stay withing java 1.6 or what ever is native to MS VM ? In that case normal Java2D wouldn’t work.

Also, if you used Jogl or LWJGL you could also do this very easily. Although, using either of these is probably defeating your aims.

function begin()
{
document.game.begin(400, 350);
}

Erm… seriously… why do you use JavaScript to start that game? A gray rectangle is much fun for all of us who have JS disabled :stuck_out_tongue:

I wasnt aware of a way to start an applet without using javascript.

Just to inform you, your little pupy runs nice on Linux too. Blackdown 1.4.1 isnide Konquereor. Messages are flashing like hell, but everything else works nice and smooth (50 FPS). Hickups almost untoticeable. Oh, yes, and it tends to freeze when I post name for a hiscore table. Reload, and killing continues :).