Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (567)
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  
  JDK1.5.0 beta is out  (Read 2392 times)
0 Members and 1 Guest are viewing this topic.
Offline trembovetski

Senior Member




If only I knew what I'm talking about!


« Posted 2004-02-05 21:27:02 »

In case you haven't seen this:
 http://java.sun.com/j2se/1.5.0/

Release notes:
 http://java.sun.com/j2se/1.5.0/relnotes.html

Some info on the new features:
 http://java.sun.com/developer/technicalArticles/releases/j2se15/
Offline Kommi

Junior Member




All opinions will be lined up and shot!


« Reply #1 - Posted 2004-02-06 12:41:26 »

Quote
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  Cry
Also http://java.sun.com/j2se/1.5.0/docs/guide/2d/new_features.html
The 2D features like accelerated translucency (although still has to be enabled with runtime, for now) and the Bufferedimage stuff is cool
What about the hi res Java Timer? Did they make the Perf thing standard, or added something else? How do I access it?

Kommi
Offline tom
« Reply #2 - Posted 2004-02-06 13:03:21 »

Quote
What about the hi res Java Timer?

java.lang.System.nanoTime()

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

Junior Member




All opinions will be lined up and shot!


« Reply #3 - Posted 2004-02-06 15:18:42 »

Quote
The transparency value is TRANSLUCENT and translucency acceleration has been specifically enabled at runtime (sun.java2d.translaccel=true).

How exactly do you enable something at run-time? where does the line of code go?

Kommi
Offline Abuse

JGO Knight


Medals: 12


falling into the abyss of reality


« Reply #4 - Posted 2004-02-06 18:37:45 »

You just have to set a System property,
you can do it either on the cmdline
1  
-Dsun.java2d.translaccel=true

or through code
1  
System.setProperty("sun.java2d.translaccel","true");

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline immudium

Junior Member




Gorram it!


« Reply #5 - Posted 2004-02-06 19:02:46 »

And if you do it through code, make sure it's the very first thing you do, i.e. before displaying anything that might use Java2D.  I tend to forget that little tidbit on a regular basis.
Offline Kommi

Junior Member




All opinions will be lined up and shot!


« Reply #6 - Posted 2004-02-08 23:55:38 »

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?

Kommi
Offline TheAnalogKid

JGO Coder


Projects: 2



« Reply #7 - Posted 2004-02-09 18:54:36 »

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.

Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #8 - Posted 2004-02-09 19:07:36 »

Quote
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!)

Java Game Console Project
Last Journal Entry: 12/17/04
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #9 - Posted 2004-02-09 22:38:33 »

getNanoTime() is guaranteed to be the finest timer you can get on the platform.  So, yes, it will be the best you can do.

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

Junior Member




All opinions will be lined up and shot!


« Reply #10 - Posted 2004-02-10 00:04:45 »

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?

Kommi
Offline princec

JGO Kernel


Medals: 386
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #11 - Posted 2004-02-10 07:01:53 »

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 Smiley

Cas Smiley

Offline tom
« Reply #12 - Posted 2004-02-10 09:43:13 »

Quote
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.

What is the gametick time and what do you use it for?

Offline Kommi

Junior Member




All opinions will be lined up and shot!


« Reply #13 - Posted 2004-02-10 11:06:37 »

Quote

What is the gametick time and what do you use it for?

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.  

Kommi
Offline tom
« Reply #14 - Posted 2004-02-10 11:53:23 »

Quote
So then at 30 gameticks per sec one gametick would be = (10^-9 / 30) ?

Sounds correct. (10^-9/30) nanoseconds is just another way of saying 1/30 seconds.

Offline abies

Senior Member





« Reply #15 - Posted 2004-02-10 13:59:05 »

10^9/30 I think.

Artur Biesiadowski
Offline Kommi

Junior Member




All opinions will be lined up and shot!


« Reply #16 - Posted 2004-02-10 15:30:43 »

Right:
10^-9 is a nanosecond
10^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?  

Kommi
Offline Jeff

JGO Coder




Got any cats?


« Reply #17 - Posted 2004-02-19 03:09:39 »

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!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Bombadil

Senior Member





« Reply #18 - Posted 2004-02-19 06:34:26 »

Quote
A secondary small value is that you don't need to destribute a DLL with your app which may simplify your installation

That's a big value actually (for me).
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #19 - Posted 2004-02-22 20:43:25 »

Quote

That's a big value actually (for me).


If you're using 1.5, GAGE gets the full Nanotimer resolution and does not depend on the DLL. The DLL is only used on 1.4 (in theory, 1.1-1.4) platforms.

Java Game Console Project
Last Journal Entry: 12/17/04
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Pippogeek (38 views)
2014-09-24 16:13:29

Pippogeek (29 views)
2014-09-24 16:12:22

Pippogeek (18 views)
2014-09-24 16:12:06

Grunnt (42 views)
2014-09-23 14:38:19

radar3301 (24 views)
2014-09-21 23:33:17

BurntPizza (61 views)
2014-09-21 02:42:18

BurntPizza (31 views)
2014-09-21 01:30:30

moogie (36 views)
2014-09-21 00:26:15

UprightPath (49 views)
2014-09-20 20:14:06

BurntPizza (53 views)
2014-09-19 03:14:18
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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
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!