Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (804)
Games in Android Showcase (237)
games submitted by our members
Games in WIP (867)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  First Game : Planet Ball  (Read 12158 times)
0 Members and 1 Guest are viewing this topic.
Offline DruLeeParsec
« Posted 2012-03-19 16:52:04 »

Hi folks:  I've been lurking here for a while, watching, learning.

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.

Bump the other player and you both lose 2 points.

Capturing your own color asteroid gives you 25 points
Capturing the wrong color loses 15 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.
Offline DruLeeParsec
« Reply #1 - Posted 2012-03-19 20:40:42 »

It looks like I fixed the bug so it's available as a zip file at

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.

I hope you enjoy it.
Offline tberthel
« Reply #2 - Posted 2012-03-19 21:15:57 »

It runs and has nice music.

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

JGO Ninja

Medals: 26
Projects: 3
Exp: 10 years

One for all!

« Reply #3 - Posted 2012-03-20 03:51:13 »

This is one big download! I'll try it if I ever get the whole thing downloaded in one HTTP session.

Offline ra4king

JGO Kernel

Medals: 508
Projects: 3
Exp: 5 years

I'm the King!

« Reply #4 - Posted 2012-03-20 06:02:09 »

124MB, downloading a 500KBps!! Shocked

Give me a sec....

Runs really well and it was quite fun! I got my brother to play and I beat him Grin

Great job Smiley

Offline ReBirth
« Reply #5 - Posted 2012-03-20 13:44:58 »

Oh no, it's too big for me! Shocked

Offline DruLeeParsec
« Reply #6 - Posted 2012-03-20 13:53:28 »

This was very much a learning experience/proof of concept project.

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 files
Reuse 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.
Offline teletubo
Global Moderator

JGO Wizard

Medals: 76
Projects: 4
Exp: 8 years

« Reply #7 - Posted 2012-03-20 14:00:07 »

I reeeaaally think your top priority right now should be using mp3/ogg instead of wave. Downloading more than 100MB for a Indie game, is for me (and a lot of people I guess) a show stopper.

Offline DruLeeParsec
« Reply #8 - Posted 2012-03-20 14:01:41 »

I think you're right.  I just found a tutorial on using Ogg Vorbis with OpenAL in Java.  I think doing that conversion will be this week's project.
Offline DruLeeParsec
« Reply #9 - Posted 2012-03-20 22:33:06 »

Hey Guys, I removed the extra music files and just reused the same music for each scene.  It's down to 23 megs now.

Pages: [1]
  ignore  |  Print  

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!