Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (527)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (593)
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  
  The new LWJGL 0.96 timer on win32  (Read 3838 times)
0 Members and 1 Guest are viewing this topic.
Offline tom
« Posted 2005-04-15 22:38:15 »

I'm having problems with the new hires timer on windows. Try the following webstarable application too see how it runs on your computer:

http://home.halden.net/tombr/timertest/timertest.php

The queryPerformanceCounter has been replaced with timeGetTime. It is suposed to have a 1 ms resolution. But it degrades if you only use Thread.yield in your main loop. The fix is to use Thread.sleep(1) instead. But atleast on my computer, Thread.sleep(1) will sometimes sleep for 14 ms instead. Wrecking havoc on the animation.

Use:
F1 to switch between sun.misc.Perf and the new lwjgl timer.
F2 to switch between Thread.yield() and Thread.sleep(1)
"+", "-" to adjust the amount of triangles that are rendered. I've seen difference in behavior depending on the load.

If Perf/yield runs smooth and LWJGL/sleep(1) is choppy, then it is not working properly. You will se the mesured time the sleep took on the "pauseType" line. If it ever gets over 1 when sleep(1) is enabled, then it is also not working.

Offline Alan_W

JGO Knight


Medals: 8
Projects: 3


Java tames rock!


« Reply #1 - Posted 2005-04-16 03:25:10 »

Only Perf+Yield runs smoothly here on XP
Perf+Sleep is slightly jerky
LWJGL +Yield is medium jerky
LWJGL+Sleep is medium plus jerky.

NB. Time in sleep always >1ms

Perhaps the LWJGL timer is performing some averaging behind the scenes and sleep() is adding a unmeasured random element on top of it.

NB. There was a similar jerky effect on the weapon reload time in my Castle Game demo.  My first attempt calculated elapsed time per frame & on each frame subtracted this from a reload time.  When this was less then zero, a reload occurred and the reload countdown timer reinitialised.  However this "threw away" any time between zero and the final (negative) counter value, resulting in the jerky effect.  I fixed this for the player, but left it for the computer controlled entities. It's almost certainly not the issue here, but worth a mention just in case.

Alan

Spec: Pentium4 2.8GHz, Windows XP, ATI Radeon 9200, JRE 1.4.2 & 1.5

Time flies like a bird. Fruit flies like a banana.
Offline wiesi

Senior Newbie




Java rulez!


« Reply #2 - Posted 2005-04-16 06:40:17 »

Quote
Only Perf+Yield runs smoothly here on XP


I agree.

WiESi
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online princec

« JGO Spiffy Duke »


Medals: 425
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #3 - Posted 2005-04-16 08:18:04 »

XP Pro
3.2GHz HT P4
Inspiron 5150
Nvidia GF FX5200 or something

The only one that works for me is LWJGL timer and sleep(1)... all of the others experience periodic slowdowns and speedups.

Is there a pattern to sleep(1) not working right? Is it DOS as opposed to NT? Linux? MacOS? I was expecting sleep(1) to cause problems on 98/ME but I didn't know how much it would affect everything, not having seen a 98 machine for years...

Cas Smiley

Online princec

« JGO Spiffy Duke »


Medals: 425
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #4 - Posted 2005-04-16 08:18:59 »

LOL! 98 / ME I meant Smiley Hurrah for teh intarweb.

Cas Smiley

Offline Middy

Junior Devvie




Java games rock!


« Reply #5 - Posted 2005-04-16 08:33:03 »

I have experience absolutely no difference between the two at any settings and I added many many spheres 1200+


It just runs smoothly

Windows XP pro SP2
gforce 6800 GT
Radeon 3500+
Nforce 2 chipset
1.3Gb ram

When do I get my makeMyGameAsILike() extension?
Offline tom
« Reply #6 - Posted 2005-04-16 09:54:59 »

Quote
XP Pro
3.2GHz HT P4
Inspiron 5150
Nvidia GF FX5200 or something

The only one that works for me is LWJGL timer and sleep(1)... all of the others experience periodic slowdowns and speedups.

Is there a pattern to sleep(1) not working right? Is it DOS as opposed to NT? Linux? MacOS? I was expecting sleep(1) to cause problems on 98/ME but I didn't know how much it would affect everything, not having seen a 98 machine for years...

Cas Smiley

This test will only work on windows. I've not included the the native libs for linux and Mac.

Could everyone who tried it also post their spec. In particular what os and what cpu/chipset their using.

Mine are:
-XP sp 2
-AMD athlon XP 1800+
-Via kt 400 chipset
-Radeon 9500 pro

Offline CaptainJester

JGO Knight


Medals: 12
Projects: 2
Exp: 14 years


Make it work; make it better.


« Reply #7 - Posted 2005-04-17 11:51:45 »

Very little difference for all 4 options.  yield produces a slightly higher framerate than sleep(as it should).

Win XP Pro
AMD 1.0GHz
ASUS GeForce 4 MX440
ASUS MB with VIA KT400(I think.  It is VIA, not sure of exact chipset)

Offline tom
« Reply #8 - Posted 2005-04-17 22:31:05 »

I'm not getting completely consistant results. Sometimes sleep(1) works, but most times it don't. I'm wondering if there might be other programs running that sabotages the sleep. Most of the times I've got eclipse and Azureus running in the background.

Anyway. I'll be using sun.misc.Perf as my first choise from now on. Maybe I'll try to detect when PerformanceCounter don't work and switch to timeGetTime then.

Offline Alan_W

JGO Knight


Medals: 8
Projects: 3


Java tames rock!


« Reply #9 - Posted 2005-04-18 16:33:27 »

Interesting. I had Netbeans running and that being Java based may have affected scheduling. Maybe.

Time flies like a bird. Fruit flies like a banana.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Mac_Systems

Junior Devvie




I love my Java


« Reply #10 - Posted 2005-04-21 00:11:24 »

For me it runs smooth with both Timers,
i test it on XP sp1.

- jens

The Network is the Music
http://www.mac-systems.de
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #11 - Posted 2005-04-26 15:08:24 »

both work for me.

Win XP sp1, Athlon XP 2100+, VIA chipset, GF4 Ti4200, java 1.5.

Offline EgonOlsen
« Reply #12 - Posted 2005-04-26 16:23:37 »

Perf is definitely more smooth on my machine (P4HT@3.2Ghz) than the new LWJGL timer is. Apart from that, sleep(1) is no option for me, because at least on Windows, it sleeps 15-(time modulo 15) ms (or 10-(time modulo 10) ms on a single CPU/non HT machine) and not just 1ms.

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.

toopeicgaming1999 (73 views)
2014-11-26 15:22:04

toopeicgaming1999 (63 views)
2014-11-26 15:20:36

toopeicgaming1999 (15 views)
2014-11-26 15:20:08

SHC (29 views)
2014-11-25 12:00:59

SHC (27 views)
2014-11-25 11:53:45

Norakomi (32 views)
2014-11-25 11:26:43

Gibbo3771 (27 views)
2014-11-24 19:59:16

trollwarrior1 (40 views)
2014-11-22 12:13:56

xFryIx (78 views)
2014-11-13 12:34:49

digdugdiggy (57 views)
2014-11-12 21:11:50
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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