Before I start working on my cool game idea I decided to take some often given, but rarely taken advice. I built a simple game to learn a bunch of the basics. I bought "Killer Game Programming in Java" and then read some post here on how to improve the code examples in that book (such as fixing his double buffering code to use BufferStrategy instead of creating a 2nd buffered image for every frame.).

So I built PlanetBall. The inspiration for PlanetBall was "What if you were playing Pong, but instead of the paddle, you were the ball?"

PlanetBall is a 2 player game where both users use the same keyboard to move their planets around in space. One player uses ASDW to move and B to brake. The other player uses the arrow keys and Number Pad 0 to brake.

If you capture a planetoid of your own color you gain 10 points.Capture the wrong color you lose 5 points.

If you get sucked into a black hole the nicest thing which will happen to you is you lose 20 points.

I have 4 levels of increasing difficulty. I was able to use OpenAL to get the sounds working and overall, I think it's a playable game.

Right now I have a bug which happens when you choose to go back to the main menu and then you play levels which have already been played. For some reason a hashmap I created is going to null. Once that's fixed I'll give you a download link if you'd like to try it.

It's a large file of nearly 130 megs. The majority of it is the music wave files. I'll have to look into reducing file sizes for my sound files.Note: I've removed some of the extra music and reused the same music for all the scenes. It's down to 23 megs now.

The vast majority of that file size is the wave files for the music. I'm using OpenAL and at this point I only know how to use their WaveFile class to load sound data. I'm researching if it's possible to switch to mp3 files. Beyond that I could see if I can:

Reduce the sound resolution in Audacity to get smaller filesReuse the sound files and have only 2 music themes instead of 3.Shorten the loop length.

I'd love to get it well under 100 megs.

I have to say, I learned a ton writing this. I had a good time building my own little 2D game engine. Just in this simple project I had to learn:

Game loop timing

Double Buffering

Key Event binding

The update/render/paint loop

Collision detection

Inelastic collision (billiard ball physics)

Gravity simulation

Sound programming

Scene management

Timer events

Basic animation (watch what happens if you touch a black hole)

I've worked on web based software for pretty large companies for the past 20 years and this was a completely different sort of code. For one thing, it was fun to work on. It's nice to have fun writing code again.

BTW, F4 is my debug key. It shows all the collision rectangles as well as the FPS, Max FPS, Game time (to test timer events) and scene name.