Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (534)
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  
  Timing  (Read 1745 times)
0 Members and 1 Guest are viewing this topic.
Visa
Guest
« Posted 2003-05-19 10:58:05 »

Hi everybody!

This is my first posting here because I'm a newbie with java.
I've programmed before with C/C++ and used queryPerformanceCounter for timing.
In java I know only System.currentTimeMillis() and I was wondering
if there is any better/faster way than it?
(I haven't found myself)
If java has many ways to do timing, which is the best?
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #1 - Posted 2003-05-19 11:49:01 »

Congratulations, you found one of java's oldest shortcomings.  Smiley
System.currentTimeMillis() is the only way to measure time without any additional packages/libraries.
If you want to use an additional library:
LWJGL, Java3D and GAGE all have a high resolution timer.
Use LWJGL if you are planning to go for max performance 3D graphics and sound using openGL/openAL, use java3D of you want a convenient general purpose 3D scenegraph API or GAGE if you want to create games using the standard java API's.
(The authors will surely correct me if I'm wrong somewhere  Wink)

Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #2 - Posted 2003-05-19 12:01:00 »

There is a hidden hires timer in the 1.4.2beta...

http://www.java-gaming.org/cgi-bin/JGOForums/YaBB.cgi?board=Tuning;action=display;num=1053157119

Well you can't rely on it. It won't stay there for sure but there will be one in the future Smiley

Untill it's official you should do some stuff with the mentioned libs. I like lwjgl most... but it depends on your needs Wink

弾幕 ☆ @mahonnaiseblog
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Visa
Guest
« Reply #3 - Posted 2003-05-19 13:45:03 »

Thanks both of you

I'm not planning to go 3D yet. Cry (just starting 2D with java)
But I think I'll take a look at the packages.
So where can I get LWJGL and GAGE? Huh
And what kind of libraries they are? Huh
Offline oNyx

JGO Coder


Medals: 1


pixels! :x


« Reply #4 - Posted 2003-05-19 14:12:21 »

>So where can I get LWJGL and GAGE? Huh

lwjgl:
http://java-game-lib.sourceforge.net

gage:
http://java.dnsalias.com/

>And what kind of libraries they are? Huh

LWJGL is a openGL wrapper, openal (sound) and input - everything you need to make a fast 2d or 3d game. BTW we have a nice lwjgl forum here Wink

GAGE is a lib for handling 2d stuff and sound. It should be easier to use GAGE for your first 2d game (or your first bunch of games Wink).

Both libs are 100% free to use (even for commercial projects) and are written by talented people of this forum Smiley

弾幕 ☆ @mahonnaiseblog
Offline jbanes

JGO Coder


Projects: 1


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


« Reply #5 - Posted 2003-05-19 14:12:39 »

LWJGL: http://java-game-lib.sourceforge.net
GAGE: http://java.dnsalias.com

Disclaimer: I'm the GAGE author. I think you'll like GAGETimer tho. Smiley

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

Junior Member




All opinions will be lined up and shot!


« Reply #6 - Posted 2003-05-20 00:46:53 »

How do I use the GAGE timer? what is the animation loop? is it the one at the bottom of the page?

Kommi
Offline jbanes

JGO Coder


Projects: 1


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


« Reply #7 - Posted 2003-05-20 03:34:38 »

Quote
How do I use the GAGE timer? what is the animation loop? is it the one at the bottom of the page?


The timer is very simply that, a timer. It will give you the current time if you ask. The GAGETimer also includes a way to limit the framerate, thus the algorithm at the bottom of the page. You only need to limit the rate if you have VSyncing disabled. Look at the JavaDocs for some good info on how to interface with the class.

Edit: Added link to JavaDocs

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

Junior Member




All opinions will be lined up and shot!


« Reply #8 - Posted 2003-05-20 04:44:26 »

Oh I get it. So after importing the API I just instanciate by saying timer = new AvancedTimer() and later can make the timer.sleep(...) calls in my animation loop.
Question, is your timer a native timer?  

Kommi
Offline kevglass

JGO Kernel


Medals: 120
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #9 - Posted 2003-05-20 06:55:29 »

Is the GAGE timer windows only? I only saw a library for windows (.dll) and was just wondering.

Kev

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

JGO Coder


Projects: 1


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


« Reply #10 - Posted 2003-05-20 14:35:07 »

GAGE is fully cross platform. The DLL is specific to Windows to get around Windows' poor timing ability.

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.

pw (35 views)
2014-07-24 01:59:36

Riven (33 views)
2014-07-23 21:16:32

Riven (21 views)
2014-07-23 21:07:15

Riven (24 views)
2014-07-23 20:56:16

ctomni231 (55 views)
2014-07-18 06:55:21

Zero Volt (47 views)
2014-07-17 23:47:54

danieldean (38 views)
2014-07-17 23:41:23

MustardPeter (43 views)
2014-07-16 23:30:00

Cero (59 views)
2014-07-16 00:42:17

Riven (56 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!