GAGETimer 1.1 released!

GAGETimer 1.1 has been released! The primary feature added was support for the 1.5 System.nanoTime() call. GAGETimer will check the VM version and use the nanotimer if it’s 1.5 or higher. If that check fails, it will attempt to fall back on the windows DLL, and if that check fails (because the DLL is missing or you’re not using Windows) it will finally fall back on System.currentTimeMillis().

Even more interesting is the addition of a new class called “DurationTimer”. DurationTimer is a precise countdown timer that is useful for time bounded game events. Some interesting uses:

  • Kill the player if they don’t finish a level in time. (ala Mario Bros.)!
  • Temporary power-ups like Quad damage!
  • Fuses for bombs!
  • Construction of units!
  • Just about anything else that needs to happen within a set amount of time.

Methods are included for developing progress bars, showing seconds and percentages, and pausing the timer (important for when the user pauses the game or some event (like lack of money) stops the countdown).

So, what do you think?

URL: http://java.dnsalias.com

Excellent. Sounds like great stuff. I’ll check it out later.

You left out my response which is…

“And why do I use this rather then the nanosecond timer thats now in 1.5?”

I’m really genuinely curious if there is a compelling reason.

It abstracts away the requirement of JDK1.5. You can use the GAGE API on any VM from 1.1 and upwards and it does the best it can.

Cas :slight_smile:

[quote]You left out my response which is…

“And why do I use this rather then the nanosecond timer thats now in 1.5?”

I’m really genuinely curious if there is a compelling reason.
[/quote]
Like Cas said, it’s cross version and it contains support for the nanotimer. It also takes care of a lot of the details for you, such as a highly efficient sleep loop. And the addition of the DurationTimer provides an easy way to handle timed events in game. It even supports the user pausing the game without any special code. (That’s one of those things that often gets forgotten and is very difficult to add later.)

I’m missing the point: “I use system stuff instead of another third-party jar/dll”

The FlyingGuns-utilities define a timing framework as well. Checking e.g. for Java3Ds hires-timer availibility and fallback to currentTimeMillis() is just 2 lines of code or so.
And there’s a command-queue that allows to submit time-related commands. Also very easy things!

And for you need to define these things to fit your special needs anyway, you can easily embedd the neccesary timing features as well w/o having to interface a third-party lib.

So I feel an external timing lib makes sense only if

[]Hires timing is really required
[
]Java3D is not available
[*]1.5 is not available

For all three points still are LIKELY to coincide, it is GOOD to have the external timer available. But it should be as SMALL as possible in interface and jar-size.