GiraffeTap222
Senior Newbie 
|
 |
«
Posted
2013-01-08 08:56:00 » |
|
For one reason or another my game loop has been acting strange. Its seems like I have started to stutter again... and again, no matter if I used a fixed time step or variable time step! If possible could any one test this code and/or tell me where I went wrong? Its based on a fixed timestep decoupled from FPS. You should just be able to just cut and paste it Thanks! http://pastebin.java-gaming.org/4440b947231{Edit : I always forget this, specs on my dev pc} Dell Studio XPS 1640 Laptop - Windows 7 64 bit 4.0 GB ram DDR2 Core Duo T955 2.66 Ghz ATI Mobility Radeon HD 4670 [Drivers up to date]
|
|
|
|
theagentd
|
 |
«
Reply #1 - Posted
2013-01-09 01:09:13 » |
|
Butter smooth here at 7000 FPS. EDIT: Try changing your initing code to this: 1 2 3
| Display.setDisplayMode(new DisplayMode(800, 600)); Display.create(new PixelFormat(24, 0, 0, 0, 8)); Display.setVSyncEnabled(true); |
|
Myomyomyo.
|
|
|
|
Games published by our own members! Check 'em out!
|
|
GiraffeTap222
Senior Newbie 
|
 |
«
Reply #3 - Posted
2013-01-09 02:13:53 » |
|
Butter smooth here at 7000 FPS. EDIT: Try changing your initing code to this: 1 2 3
| Display.setDisplayMode(new DisplayMode(800, 600)); Display.create(new PixelFormat(24, 0, 0, 0, 8)); Display.setVSyncEnabled(true); |
I tried this and still same results This also happens on the other computer I test on which was built for gaming and much more powerful than the dev computer. It has a fresh install of Windows 7 and updated drivers directly from the nvidia site. Now this may sound crazy but is there some "openGL driver" I have to install? I mean this should have already been with my drivers but at this point I don't know. DirectX games and etc run just fine, but anything dealing with openGL stutters or has some crazy line distortion going down the screen when I go full screen (Same thing happens on the gaming pc).
|
|
|
|
theagentd
|
 |
«
Reply #4 - Posted
2013-01-09 02:38:41 » |
|
Then your computer is the cause of the stuttering. Radeon cards do have a reputation of having small frame time spikes at times. It could also be something with your laptop's monitor. For example, my desktop monitor is pretty cheap and only updates every other line each frame or something like that, so things moving at exactly 1 pixel / screen refresh looks all fuzzy. It might also just be your imagination. We're all differently sensitive to stuttering. I'd say I'm pretty good at seeing it though. Let me just say that you've done pretty much everything you can with code.
|
Myomyomyo.
|
|
|
theagentd
|
 |
«
Reply #5 - Posted
2013-01-09 02:39:58 » |
|
Wait, you're getting stuttering with VSync on? -_-'
|
Myomyomyo.
|
|
|
Best Username Ever
|
 |
«
Reply #6 - Posted
2013-01-09 02:44:53 » |
|
Is it stuttering because you have a low FPS or is it something less consistent?
|
|
|
|
GiraffeTap222
Senior Newbie 
|
 |
«
Reply #7 - Posted
2013-01-09 03:13:03 » |
|
Wait, you're getting stuttering with VSync on? -_-'
Yep  Is it stuttering because you have a low FPS or is it something less consistent?
According to the Direct X Samples from the June 2010 SDK I run in the range of 200 - 700 FPS. Where samples with multiple lighting effects and etc trigger the low end of my FPS range.
|
|
|
|
theagentd
|
 |
«
Reply #8 - Posted
2013-01-09 04:55:24 » |
|
Wait, you're getting stuttering with VSync on? -_-'
Yep  Definitely something wrong with your computer. VSync + 60FPS + good interpolation values = no stuttering. You've done everything right if that's what you're getting.
|
Myomyomyo.
|
|
|
Shiu
|
 |
«
Reply #9 - Posted
2013-01-09 05:11:43 » |
|
Have you checked in the nvidia control panel if you're forcing vsync off ? This can screw with some things, not sure if it applies to your specific problem, but worth checking.
|
|
|
|
Games published by our own members! Check 'em out!
|
|
GiraffeTap222
Senior Newbie 
|
 |
«
Reply #10 - Posted
2013-01-09 05:37:28 » |
|
Have you checked in the nvidia control panel if you're forcing vsync off ? This can screw with some things, not sure if it applies to your specific problem, but worth checking.
Both machines have the setting set to vsync off unless the application says other wise. I tried using force off anyway but I still stutter. Also can someone check out https://sites.google.com/site/starflighttlc/And tell me if they get this really weird horizontal line (its like the refresh line that distorts everything) going down the screen every second or so when it is in full screen mode or a steady ticking (once again every second or so) in windowed mode? Also, if you do get the moving line, what would you call this? I'm not sure how to research it at the moment.
|
|
|
|
cylab
|
 |
«
Reply #11 - Posted
2013-01-09 08:52:39 » |
|
Also, if you do get the moving line, what would you call this? I'm not sure how to research it at the moment.
This is called screen tearing and is caused by updating or switching the frame buffer while it is displayed. This is usually caused by not doing double buffering or when VSYNC is off. Since LWJGL uses double buffering by default, either your VSYNC is off, or there is a bug in your driver or the lwjgl version you are using. Also I am not sure, if using a tight gameloop without any sleep or yield like this may cause hickups with the OS thread/process scheduler, that may force executing of another thread/process at unfavorable times, because it simply does not have a "free" time slot. But thats just a guess, not really backed by knowledge 
|
Mathias - I Know What [you] Did Last Summer!
|
|
|
theagentd
|
 |
«
Reply #12 - Posted
2013-01-09 15:30:16 » |
|
Could it be caused by garbage collection pauses or something? But that would still make a dent in the FPS with Vsync on!
|
Myomyomyo.
|
|
|
Shiu
|
 |
«
Reply #13 - Posted
2013-01-09 17:55:44 » |
|
Both machines have the setting set to vsync off unless the application says other wise. I tried using force off anyway but I still stutter.
If anything you should force it on in this case, not off.
|
|
|
|
Best Username Ever
|
 |
«
Reply #14 - Posted
2013-01-09 22:06:06 » |
|
According to the Direct X Samples from the June 2010 SDK I run in the range of 200 - 700 FPS. Where samples with multiple lighting effects and etc trigger the low end of my FPS range.
That's completely irrelevant. What is your program's average frame rate when it's not stuttering? Could it be caused by garbage collection pauses or something? But that would still make a dent in the FPS with Vsync on!
There is nothing that creates garbage.
|
|
|
|
theagentd
|
 |
«
Reply #15 - Posted
2013-01-10 01:48:08 » |
|
I just ran it and you're syncing to 59 FPS. Sigh. -_-'
|
Myomyomyo.
|
|
|
GiraffeTap222
Senior Newbie 
|
 |
«
Reply #16 - Posted
2013-01-10 04:44:13 » |
|
I just ran it and you're syncing to 59 FPS. Sigh. -_-'
Is that a bad thing, cause I never set any sync options. Other than the Display.setVSyncEnabled(true) up at the top I have added a FPS counter and I get Roughly 2000 FPS without vsync, and then I get 59 - 61? FPS with it on (using the Display.setVSyncEnabled(true) command) Here is the code I am currently using http://pastebin.java-gaming.org/0b421288735
|
|
|
|
theagentd
|
 |
«
Reply #17 - Posted
2013-01-10 15:26:37 » |
|
Oh, sorry, I ran this: That one synched to 59 FPS and didn't use VSync, which gave screen tearing. Concerning your latest paste: First of all, glColor3f(255, 255, 255); |
is wrong. Float values go from 0.0 to 1.0. It's getting clamped to 1.0 right now anyway, so it works by chance. A gray color would be glColor3f(0.5f, 0.5f, 0.5f); |
I changed it to use nanoTime() instead and to use longs instead of doubles for measuring time. See if it's any better. http://www.java-gaming.org/?action=pastebin&id=383Also, setting the update rate to 30 seems to improve things slightly unless I'm imagining things.
|
Myomyomyo.
|
|
|
GiraffeTap222
Senior Newbie 
|
 |
«
Reply #18 - Posted
2013-01-10 23:56:27 » |
|
Oh, sorry, I ran this: That one synched to 59 FPS and didn't use VSync, which gave screen tearing. Concerning your latest paste: First of all, glColor3f(255, 255, 255); |
is wrong. Float values go from 0.0 to 1.0. It's getting clamped to 1.0 right now anyway, so it works by chance. A gray color would be glColor3f(0.5f, 0.5f, 0.5f); |
I changed it to use nanoTime() instead and to use longs instead of doubles for measuring time. See if it's any better. http://www.java-gaming.org/?action=pastebin&id=383Also, setting the update rate to 30 seems to improve things slightly unless I'm imagining things. I tried your code and something strange is happening for sure. If I leave the line setting Vsync on it makes the square hiccup horrible. But if I turn it off it moves smoothly but hiccups every once and a while. Any ideas? I have also tried a complete removal of my graphics drivers by 1. Running the ATI Catalyst uninstaller 2. Using driver sweeper AKA Driver Fusion to pick up any remaining files 3. Reinstalled ATI Drivers and Catalysis Control Center
|
|
|
|
theagentd
|
 |
«
Reply #19 - Posted
2013-01-11 00:32:13 » |
|
You can test how accurate the interpolation calculation is by setting the update rate to 60 updates/sec, enabling V-sync and printing the interpolation value each frame. The value should remain very constant. If it's jumping around a lot, you have a problem. Anyway, I'm almost sure it's a driver problem with the AMD drivers now. Either that or System.nanoTime() isn't accurate enough.
|
Myomyomyo.
|
|
|
|