GAGE - Genuine Advantage Gaming Engine

APIs

GAGE2D
GAGESound
GAGETimer

Documentation

JavaDocs

Examples

Space Shooter

Contributed Code

SortedSprites.java

Other Engines

Planetation
Golden T


Looking for DataDino?


GAGE is an engine designed to make developing 2D games in Java easy. Through high performace 2D wrappers, low latency sound handling, tight loop control and other built in features, GAGE will set the stage for Java's future in the gaming industry.

Currently, this page is here to provide early access to the GAGE APIs for the purpose of feedback and development. As the APIs reach maturation, a new home will be created for this engine. All questions can either be asked on the JavaGaming.org forums, or by contacting the author at jbanes@gmail.com.



News

2004-07-21

GAGESound has been updated! Here's what's been fixed:
  • Support for Java 5.0 (formerly known as 1.5) has been added
  • Support for 16 bit sound samples has been added
  • Added some code to route around 5.0's handling of buffer underflows
  • Added "isRunning()" method to MusicEngine
Special thanks goes to Anthony S. and Koen Handekyn for taking the time to help out. Without them, I'd still be seriously lagging behind on debugging GAGESound. Next project, if I ever get to it :-(, will be to integrate MOD file support in the MusicEngine.

2004-05-28
Vincent van Beveren has been kind enough to share his SortedSprites class with us. This class will sort and render sprites in the Y dimension (either top to bottom or bottom to top). Check it out and see if you like it! If I get enough time, I may even consider adding it to GAGE2D. If you have something you'd like to share, email it to me and I'll add it to the Contributed Code list!
2004-02-12

GAGETimer has been updated to support the Java 1.5 System.nanoTime() method. The nanotimer is the default timer under 1.5 VMs. Previous Java versions will continue to use System.currentTimeMillis() or the native Windows timer.

Also, a new class called DurationTimer has been added to the GAGETimer package. This timer is useful for things like level timers (e.g. Super Mario Bros.), Power-Up timers (e.g. Quad damage in Quake), bomb fuses (e.g. BomberMan bombs), and pretty much whatever else you can think of. There are even methods available for calculating progress bars, showing the number of seconds elapsed or remaining, and obtaining the time in a percentage of the duration. Cool, huh?

2003-07-03
A new version of GAGE2D has been uploaded. Some of the changes:

  • Bugs that prevented rectangular (vs. square) maps have been fixed.
  • CollisionMap is now part of the distribution.
  • A new type of sprite known as "StatefulSprite" has been added. This sprite binds together various other sprites to allow a game character a full range of actions and movements.
Please be aware that the new APIs have not been tested well. If you encounter any bugs, email me and I'll see about getting them fixed.

2003-04-21
Added a psuedo-FAQ to this page to fend off newbie questions and help direct people to their proper destination.
2003-03-04
Okay, I admit it. I flubbed. Durandel was nice enough to point out that I misspelled "missile" as "missle". Quite consistently too. I've updated the 2D packages as well as the docs. You might want to blow away your old copy of GAGE2D before you install the new one though. I'd hate for someone to miss the 'i' key and have it actually compile.

2003-03-03
Added a side scrolling shooter as an example of all the APIs working together. It's a little messy since I was using it as a test platform for the APIs, but it works. Besides, I added a few comments in to point out the juicy bits. Next game will be clean code, promise. No really, I do. :-)



Where is feature XYZ?

Feature
API
Package
Map Display
GAGE2D
com.dnaslias.java.gage.map
Parallax Scrolling
GAGE2D
com.dnaslias.java.gage.map
Sprite Handling
GAGE2D
com.dnaslias.java.gage.sprite
Collision Detection
GAGE2D
com.dnaslias.java.gage.collision
Garbage Bin
GAGE2D
com.dnaslias.java.gage.util
Hi-Res/Multiplatform Timer
GAGETimer
com.dnaslias.java.gage.timer
Non-blocking sound effects mixer
GAGESound
com.dnaslias.java.gage.sound
Music Player
GAGESound
com.dnaslias.java.gage.music
Missile Handling
GAGE2D com.dnaslias.java.gage.missile


But feature ABC is missing and it's *really* critical to my work! Fix it!

I think you're missing the point of GAGE. GAGE is meant to be a library that helps get a game up and going by providing code for some of the most common needs. Everything else you not only have to write yourself, but the API is *designed* that way. For example, the existing sprite classes are most likely not going to meet the needs of a real game. However, you'll notice that the Sprite class is an interface. This is so that you can plug in new sprites that are specfic to your game. It even means that you could write code to do vector sprites instead of raster sprites and still get the benefits of collsion detection!

I'm a beginner in programming games. I need HHHEEEEEEEELLLLLLLPPPPP!!!! REALLY, REALLY, REALLY BAD!
I'm sorry, but I have limited time. There are tons of tutorials and forums to help you out. Make sure that you are first are aquainted with the JavaDocs and Java Tutorials that Sun has produced. 99% of what you need to know is already there. If you still have questions, go to JavaGaming.org or JDC Gaming Forum and search for the answer to your question.

You should almost never have to ask a question in a forum unless it is a complicated one. Why? Because all your "urgent" questions have already been answered before. Just think, you'll get your answer faster AND you won't have to bother anyone! If you still can't figure it out, post yout question and the fine folks at these forums will try to help you out.
Is GAGE thread safe?
No. For games you shouldn't need to create extra threads. Everything possible should be done inside the main thread. The WaveEngine, for example, pulls the sound rendering into the main thread. Networking can be solved by using NIO channels to read and write from as many network connections and files as necessary. Plain and simple. If you create a thread, you're most likey doing something wrong.
The keyboard is slow, but I'm getting a really good framerate!
If you're running flat out, the input thread isn't getting any time. You should be able to fix this by using the AdvancedTimer sleep methods to lock your framerate at a reasonable level. Usually, it's best to use AdvancedTimer.sleepUntil(...) like this:

AdvancedTimer timer = new AdvancedTimer();
long sleepTime = timer.getTicksPerSecond()/60; //60 fps
long ticks = 0;
 
timer.start();
 
while(true)
{
    //draw stuff
     
    timer.sleepUntil(ticks+sleepTime);
    ticks += sleepTime;
}

 
The beautiful part about this algo is that it automatically catches up if the game falls behind. 
What license is GAGE under
License? We need a license? Huh. Odd thought. Let's just call it public domain. Do whatever the heck you want with it. Go make money off of it, learn from it, whatever. Enjoy yourself! My only request is that if you use GAGE, I'd like you to shoot me an email telling me what you used it for. This isn't required, but I'd be interested in knowing what happens to GAGE and where it gets used.
There's a bug in GAGETimer! It makes my CPU run at 100%!
Amazingly enough, this is not a bug! It's a feature! No. Really. I'm not kidding. Stop laughing!!!

Seriously, GAGETimer makes use of Thread.yield() to perform sleep operations. Its use of Thread.yield() means that any CPU time not allocated to other programs gets allocated to the timer. This allows the timer to be as precise as possible. Thread.sleep() may not return for several milliseconds past the time requested. GAGETimer returns as soon as the clock turns over. This behavior does not have a negative impact on other programs. They will still get any CPU time they request.

The GAGETimer sleep methods are not subject to the system clock drift caused by calls to Thread.sleep() with values lower than 10ms. If you've noticed that the clock on your Windows machine runs faster than all the other clocks in your house, this bug is probably why.

If you are writing a game server, it is important to avoid the GAGETimer sleep() functions. You can still use it for timing, but the sleep methods will degrade the performance of a multithreaded program.

Looking for DataDino?