Monkey Fighter Monkey Fighter
Games Help Help Search Search Shop Shop
Asteroids

3D Asteroids

by Robert Walsh


  Tutorial Covers:

  Java Programming Language

  Game Programming

  OpenGL

Download to Play

Java Runtime Edition
gl4Java

Download to Make

Java SDK
JCreator: Java IDE
NetBeans: Java IDE
Asteroids.java
Asteroids.zip

Lessons

1. Models
2. Actors
3. Keyboard
4. Fonts
5. Collisions
6. Timing
7. Particles

Play Now!

3D Asteroids Normal
3D Asteroids Tiny
3D Asteroids 800x600
3D Asteroids 1024x768

Links

- Free HTML and PHP Programming Guides





How play the game

3D Asteroids is a clone of the popular arcade game, Asteroids. It is programmed with the Java Programming Language and uses GL4Java for the OpenGL binding. If you want to play this game, you will need to download and install the Java Runtime Environment (JRE) and GL4Java. Use the links in the right sidebar to download and install each of these products. Once installed, just click the links in the Play Now! section and Asteroids will load automatically.

3D Asteroids require a fair amount of processing power. If you have a 2Ghz Pentium (or comparable) system, try normal. It should run smoothly. If your processor is not up to par, try tiny. I have included an 800x600 and an 1024x768 version for those with power to spare. Enjoy!


How to make this Game

Space Ship

If you are like me, playing the game is only half the fun. So, I have included the source code for this game and tutorials on using my 3D game engine. After reading all the articles and playing around with the asteroids code, you should be able to produce a fairly interesting game, or at the very least, make your own version of my 3D Asteroids.

To compile your own 3D Asteroids program you will need to download and install the Java Runtime Environment (JRE) and GL4Java. Additionally, you will need to download the Java SDK, Asteroids.java and Asteroids.zip. Download JCreator, NetBeans or Eclispe if you want an Java SDK IDE. Don't worry - They are all free. JCreator is covered in this tutorial.


How to compile this Game.

1. Download and install latest Java Runtime Environment (JRE).

2. Download and install GL4Java.

3. Click the 3D Asteroids Normal link in the right sidebar and play some Asteroids. I know this you want to compile your own version of this game but you must find out if you can get the game to run on your system. Besides, the game is fun to play and if you enjoy playing it, you'll probably be more motivated to try writting your own Asteroids.

4. Download and install the Java SDK.

5. Download and install JCreator (or NetBeans, or Eclispe).

6. Download Asteroids.java. This file contains the Java source code for the 3D Asteroids game. It is the only source code that I am releasing to the public and it requires the files that are in the Asteroids.zip archive to run. I you figure out the code in this file you should have no problem adding cool stuff to the game like different enemy types, different bullet types, end of level bosses or perhaps making the rocks break to reveal money!

7. Download Asteroids.zip. This file contains all the files required run this application. In fact, you can put this game on your own web site or just use it for off-line play. It should work perfectly as long as all the files are in the same directory! And please, if you use my software on your web site, please add a link and credits back to my site. Thank you!

8. Create a JCreator workspace and add Asteroids.java to your project. The output path should contain every file from Asteroids.zip. Also, the file GL4Java.jar is a required file for compiling this project. So, locate that file on your computer. Then, tell JCreator that it as a required file by selecting Project|Project Settings...|Required Libraries. Click the new button and then the add button. Select add package and give tell it the location of GL4Java.jar. If you have trouble with this step, there is a JCreator tutorial here: JCreator Tutorial . Of course, you don't really need JCreator to compile this project. You can use any IDE, if you prefer, or you could compile it using the command line - but that would be crazy!

9. Compile and tweak the code at will. Perhaps the best way to learn how to code is to play with working code to see what happens. So, get yourself some hacker snacks and hack my game for the rest of the night!


Where's the 3D game engine code?

Currently, I don't plan to release the code for the 3D game engine.


Copyright © 2005, Robert Walsh, All Rights reserved.