[java] Galaga Clone

Started by
4 comments, last by CaptainJester 19 years, 3 months ago
I am writing a clone of Galaga -- I'm sure there is one out there, but I want to design it on my own, the architecture, everything. I started it last night, and, I've come to point where I need to decide to do transparent images, or 2D objects, as per a Java2D scheme. I've been toying with the AI idea and have been wonderring if its going to kill frame rate if I regenerate each of the aliens geometry every single game loop. But with images I would need to create several images at increments of angles, and then scroll through those. The geometry sounds more flexible, as I could maybe reuse some of the code afterward. Anybody have some suggestions or comments? L-
"Education is when you read the fine print; experience is what you get when you don't." -Pete Seegerwww.lucid-edge.net
Advertisement
Best use a memoryImageSource, where you can actually work pixel based. You could then access the array where your enemy is stored at any angle, and then probably the geometry can be an advantage. If however you go for images, you should know you can draw an image rotated, so there's no need to create your art at incrementing angles. As for performance, I would not worry about it, if you implement it well, there's no issue drawing 50 or so enemies.
Furthermore, great idea, one of the best games around in my opinion!
8! bits.. wow..
I've never done this -- for a game, and I have read all of Java2D, so I have some reference material. I was thinking of trying to access the array of pixels and saving a copy of the pixels underneath the enemies, and then repaint them after the image moves or whatever. This is slightly unneccessary as I started to think about the game, because in Galaga, there is little, to know overlap of graphics. But, I'm curious, is this possible with the memoryImageSource, and the ImageBuffer stuff ?

L-

Thanks for the reply, by the way. I will post a link to the source, with Ant build file, and everything, when it is finally done -- it probably won't be for a while though, because I won't be able to work on it in the next few weeks, and then school starts again, but I figure an hour or three a day, even during school might eventually see it done.
"Education is when you read the fine print; experience is what you get when you don't." -Pete Seegerwww.lucid-edge.net
Why not use JOGL?
010100000110111101110100011011110111101001101110011010010110000101101011Andrewwww.potozniak.org"Changing the world one character at a time."010100000110111101110100011011110111101001101110011010010110000101101011
Quote:Original post by tjoink
Best use a memoryImageSource, where you can actually work pixel based. You could then access the array where your enemy is stored at any angle, and then probably the geometry can be an advantage.


Bad idea - this prevents your graphics card from doing hardware acceleration. OK, it's only Galaga...but why waste all that hardware?

In general, you want to blit images. It's easier, it's MUCH easier to edit the images / get someone to give you free artwork etc, and it's very fast.

FYI you should be able to blit thousands of images PER FRAME without problems. I.e. tens or hundreds of thousnads of images per second...

Although you ought to get v.high performance from drawing using primitives, there are some annoying bugs in Sun's java that you have to workaround. If all you're doign is blitting images, there's so little to go wrong that there aren't any bugs. (OK, there are two bugs when trying to load images from disk, but they have one-line workarounds).

redmilamber
Quote:Original post by Tyraziel
Why not use JOGL?


Or LWJGL?

Either way OpenGL makes it easy to do 2D games, with 3D acceleration.
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][LWJGL Tutorials for NeHe][LWJGL Wiki][jMonkey Engine]

This topic is closed to new replies.

Advertisement