Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (541)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (603)
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  
  jerking  (Read 2211 times)
0 Members and 1 Guest are viewing this topic.
Offline weston

Junior Devvie





« Posted 2005-05-07 09:25:57 »

I have a friend who has been telling me for a while now that all my lwjgl programs jerk badly on his computer even though they have high framerates. I've tested my programs on many computers (worse computers included) and never seen anything similar. Today I was messing around with changing the webstart splash screen for my game so I ran it a few times. One of these times, the program started jerking, tried restarting and got the same thing. Nothing was changed except in the jnlp (changing the name of the splash image). So next I start up my IDE and run the version I'm working on, same thing and the framerate is also halved... went from 400 to 200 but is now jerking horribly. Using -Xprof shows ordinary results, most of the time is spent on 'swap buffers'. I've got no idea whats going on, could I have corrupted my drivers somehow? The only thing I can think of is that I exited my game as soon as it started on of the times, although I don't see how I could permanently screw something up this way... any ideas? + help!!

almost forgot, the same friend tried my webstart version and he got a crash in native code that pointed to this line: IL.ilEnable(IL.IL_ORIGIN_SET); (first DevIL piece of code executed after IL.create()Wink.

the program works fine for him when not webstarted (other than the jerking that is) and the webstart version doesn't crash on my computer and works fine on a couple others I tried...

btw, here is the link if someone wants to check for this on their pc(windows only(may change that tommorow)): http://www.cyntaks.com/projects/oneswitch/webstart/oneswitch.jnlp

for(int i = 1; i > 0; i++)
{
System.out.println(i+" cups of java downed");
}
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #1 - Posted 2005-05-07 09:56:23 »

Sounds like it could be the problem with hyperthreaded CPUs messing up the timers. Have a look around on the forums and you'll see several things about it (not sure of the actual proper solution though).

Try here for a start:
http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=LWJGL;action=display;num=1113611895

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline weston

Junior Devvie





« Reply #2 - Posted 2005-05-07 10:20:24 »

hmm, I thought about that just because I've read that thread, but my friend doesn't have an HT processor and neither do I.

update on my problem: I do remember swapping the files I had uploaded, but the purpose of this swap was just to change the resolution... So the problem begins to look more like I just screwed something up since I tested it on someone elses computer and its jerking there too now. Still confused about how its running at > 200 fps and jerking though Sad

for(int i = 1; i > 0; i++)
{
System.out.println(i+" cups of java downed");
}
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #3 - Posted 2005-05-07 10:21:40 »

Runs fine here. Well, try a reboot... that should help. And uhm... it looks like you don't use frame capping... try it.

Oh and add a time-per-frame graph... this way you can easily see how smoothly it runs.

Here is a pretty rough example:
http://cvs.sourceforge.net/viewcvs.py/fluffware/fluffware_ant/src/org/fluffware/core/TimeGraph.java

(In the tick method you tell it how many msecs it has taken)

edit: It doesn't matter how high the frame rate is... it can still look jerky. What's important is how consistent that frame rate is. 60fps can look smoother than 200fps (eg if it's 60fps@60hz vs 200fps@100hz and a frame time which fluctuates between 3 and 20 msec).

弾幕 ☆ @mahonnaiseblog
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #4 - Posted 2005-05-07 10:32:54 »

Your webstart link complains that sounds.jar isn't signed. Sad

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Offline weston

Junior Devvie





« Reply #5 - Posted 2005-05-07 18:47:01 »

Ok, now I'm even more confused then ever. I went to bad last night (or this morning rather) with the problem unsolved. My computer was frozen this morning and I had to shut it down then restart it before I could get on (I don't normally do this because I don't have a power switch). So after I restart, I tried out the game again and its perfectly smooth just as before... The thing is, I restarted at least twice last night with no effect. Also, I tried the program on a couple other people's computers and I heard the same thing: jerks every second.

My next guess is going to have to be that I'm modifying code while sleepwalking or something... I'll check back with some of the people who said it was jerking before.

Onyx: thats a good idea I was trying to think of a way to measure this but approached it incorrectly (I was trying to think of a way to locate spikes in cpu usage in a certain part of my code), if the problem reappears I'll certainly try this.

Orangy Tang: thats freaking weird. I assume if one of the jars wasn't signed (they all are) that the program wouldn't work on anyone's computer... Its worked fine on several  so I'm really not sure what to think.

edit: forgot to say that, the framerate was uncapped because I wanted to see how it ran on other systems.

for(int i = 1; i > 0; i++)
{
System.out.println(i+" cups of java downed");
}
Offline tom
« Reply #6 - Posted 2005-05-07 20:15:05 »

It's kind of jerky. My money is that it's the timer that is acting up.

What version of lwjgl are you using?
Do you have a Thread.yield() in your main loop?
Do you have a Thread.sleep(1) in your main loop?

Can you please try sun.misc.Perf or nanoTime to rule out the lwjgl timer?

Offline princec

« JGO Spiffy Duke »


Medals: 439
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #7 - Posted 2005-05-07 22:44:15 »

Smooth as a baby's bum, 59fps.
3.2GHz P4M HT
Gf 5200FX
XP Pro


Cas Smiley

Offline weston

Junior Devvie





« Reply #8 - Posted 2005-05-08 00:05:00 »

ok, interesting results when monitoring frame times, they are completely smooth (well, nearly). As for using Thread.sleep/yield, I'm only using Display.sync2(fps+1) to cap my framerate. I tried the game on another computer: 2.6ghz geforce4 512 megs of ram and the jerking was certainly visible so I am concerned. Really confused about why the jerking stopped on my computer after turning off/turning back on (restarting didn't affect it). I have yet to try my frame time monitoring on a computer that jerks, but it would be interesting to see the results. I've uploaded a new version that has the monitoring (shows a graph on the screen, each red line on the side is a single millisecond) and I attempted to set it up for mac/linux dunno if it will work though.

http://www.cyntaks.com/projects/oneswitch/webstart/oneswitch.jnlp

without vsync I get a very steady line with little jumps (about 1-2 millis) every couple hundred frames.

with vsync it is pretty steady between 2 different times, seems to alternate ever 5 frames or less.

I'd appreciate it if someone who experienced jerking could tell me what the graph looks like on their machine.

I will check out the nano timer etc. as well as anything else I can find.

for(int i = 1; i > 0; i++)
{
System.out.println(i+" cups of java downed");
}
Offline tom
« Reply #9 - Posted 2005-05-08 00:22:02 »

without vsync it's mostly a single line. With vsync it fluctuates between two red lines.

Display.sync2 in lwjgl version 0.96 is broken. It yields instead of sleeping. This results in loss of precision, wich explains the jerkyness. Even if it was sleeping it would still be broken since sleep(1) don't always sleep for 1 millisecs, but that's another mather.

Download the source code for lwjgl. Copy the sync2 code from the Display class, and replace the timer with sun.misc.Perf. Google for how to use it.

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

Junior Devvie





« Reply #10 - Posted 2005-05-08 08:38:33 »

Ok I've followed your advice an I'm now using sync2() copied into my code. I've added options for switching between sleep/yield and the perf/lwjgl timers so hopefully something will show up now. The graph does look different with the different combinations, but nothing noticeable in performance on my machine... the results look like this:

non-vysynced:
lwjgl/sleep: steady 2millis flux
lwjgl/yield: flat line
perf/yield: mostly flat, more spikes than others
perf/sleep: random looking 2millis flux

vsynced:
lwjgl/sleep: steady 2millis flux
lwjgl/yield: steady 2millis flux
perf/sleep: flat line
perf/yield: flat line

I certainly don't need a detailed report like this from anyone, but I would really like to know about combinations that stop jerking on computers that have the problem Wink

1 will toggle the pause method (sleep/yield) and 2 will toggle the timer (lwjgl/perf).

Every once in a while the screen went blue while changing between timers... not sure why, but I'm not surprised since I'm changing timer resolutions in the middle of running a time based game... It doesn't freeze the system or anything, you can exit normally.

for(int i = 1; i > 0; i++)
{
System.out.println(i+" cups of java downed");
}
Offline erikd

JGO Ninja


Medals: 16
Projects: 4
Exp: 14 years


Maximumisness


« Reply #11 - Posted 2005-05-08 18:12:36 »

VSync with sleep(1) works best here. I got some small spikes every now and then. With yield() it worked mostly fine, although every now and then (something like once every 10 secs) I got large spikes + jerk.
No vsync looked horrible; it shudders and shakes badly.
Sometimes when I switch using the 1 or 2 key, I got a blue screen and it seemed to freeze (although I could still use ESC to exit).

EDIT: This was all using sun.misc.Perf timer. LWJGL jerked a lot, with or without vsync, yield or sleep. With LWJGL, the jerks were very regular, about twice a second.

Offline weston

Junior Devvie





« Reply #12 - Posted 2005-05-09 00:07:01 »

after much more messing around with it, it appeared to me that it was just being ultra sensitive to any changes in frame time... not sure what I did to make it act this way, but I solved the problem (I think) but just turning it into a tick-based game. I actually kind of cheated to do this, I just use a constant for the amount of time passed during a frame... I assume this will work fine as long as the player's computer can keep up my desired framerate.

for(int i = 1; i > 0; i++)
{
System.out.println(i+" cups of java downed");
}
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.

Mr.CodeIt (10 views)
2014-12-27 04:03:04

TheDudeFromCI (13 views)
2014-12-27 02:14:49

Mr.CodeIt (25 views)
2014-12-23 03:34:11

rwatson462 (56 views)
2014-12-15 09:26:44

Mr.CodeIt (46 views)
2014-12-14 19:50:38

BurntPizza (92 views)
2014-12-09 22:41:13

BurntPizza (113 views)
2014-12-08 04:46:31

JscottyBieshaar (83 views)
2014-12-05 12:39:02

SHC (94 views)
2014-12-03 16:27:13

CopyableCougar4 (102 views)
2014-11-29 21:32:03
Resources for WIP games
by kpars
2014-12-18 10:26:14

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