Linux and Solaris users who have the latest OpenGL drivers and select graphic cards can get native hardware acceleration from Java2D using the following runtime property:

java -Dsun.java2d.opengl=true -jar Java2D.

Thats interesting. Then again I am having trouble understanding most of the other features Also http://java.sun.com/j2se/1.5.0/docs/guide/2d/new_features.htmlThe 2D features like accelerated translucency (although still has to be enabled with runtime, for now) and the Bufferedimage stuff is coolWhat about the hi res Java Timer? Did they make the Perf thing standard, or added something else? How do I access it?

I was wondering are their any other methods concerning the timer besides getNanoTime()? What if I wish to know the ticks per sec? Is there a way of getting them without having to write a method for it? Also is their any benefit (besides the pure java implementation) of the Java timer over the GAGE timer?

With the getNanoTime() solution you stick to a standard and here you have nona second accuracy so you should have all the precision your game needs.

No, you don't have nano second accuracy. You have whatever accuracy the OS supports translated into nano-seconds. i.e. Under Windows NT, the System.currentTimeMilis() clock updates every 10ms. The nano-clock may work in a similar fashion by only updating ever few hundred nano-seconds.

As to GAGETimer, I plan to update that to use the 1.5 timer as soon as I get a chance. That way, you'll have code that works on 1.4 and 1.5, plus a standard set of methods to make dealing with time and sleeping easier. (Without clock drift!)

Amazingly getNanoTime() isn't actually as useful as the LWJGL hires timer which has been around for, ohh, three years is it? I wish we were consulted a little more sometimes. Still, it gives us something to do working around it

So what would be the proper way of using the nanoTime() method? How would I get the ticks per second? Or the gametick time? or should a different approach be used?

You would use it in the same way as currentTimeMillis(). Hopefully the resolution will be good enough on all systems and that there will be no need to compensate.

You can get the ticks per second in the same way as with currentTimeMillis(). Sit in a loop until the value returned changed. The delta gives you an indication of the resolution of the timer. Although I don't see the need for this information except to check that the resolution is good enough. But then again, I don't use an advanced game loop.

It is the time alloted for one gametick. If I wish to do 30 game updates a second then gametick = ticks_per_sec / 30. I was thinking about his on the train this morning: if it's a nanotimer then wouldn't the resolution be 10^-9 ticks / sec? So then at 30 gameticks per sec one gametick would be = (10^-9 / 30) ?I am thinking I should stick with the GAGE Timer (since I just got my loop to work well with it) and just use the updated 1.5 GAGE when Jbanes writes it.

Right:10^-9 is a nanosecond10^9/30 is one gamtick at 30 gameticks per sec.And I guess its implied that the resolution is at 10^9 ticks per second. I am still not sure, however, if their are any benefits (besides the obvious pure Java one) of using this over the GAGE Timer. Since on my pc the GAGE resolution is 3,500000 ticks per sec which is also pretty good. Although maybe a higher precision will allow me to deal with lag better?

Assumign GAGE is doing its job right then thsi and GAGE should both have the same accuracy-- which is the bext accuracy to be had on the paltform in question.

The main benefit is that, as thsi is aprt of the JDK1.5 defintion, it will appear on a lsystems that implement JDK1.5. A secondary small value is that you don't need to destribute a DLL with your app which may simplify your installatio nand/or make it possible to use thsi in security situations where you cannot sue a DLL. (eg Applets)

That may or may not be important to you depending on how you destribute your code and if GAGE is already everywhere you want to go.

Got a question about Java and game programming? Just new to the Java Game Development Community? Try my FAQ. Its likely you'll learn something!

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org