[SOLVED] Frame rate hiccup on Windows

Problems building or running the engine, queries about how to use features etc.
fiction
Kobold
Posts: 35
Joined: Wed Aug 01, 2012 8:21 am

Re: Frame rate hiccup on Windows

Post by fiction »

-I get the leap on OpenGL also
-I am not using Newton or OgreOggSound
-Something interesting to note is that I get the same feeling of the lurch while moving the camera around in the samples in the samplebrowser (I did not build these, I just downloaded them from the Ogre main page). I opened up the shadow demo and flew forward with the camera and still have a very visible frame skip type thing. It also seems upon initial observation that it might be the same issue, as it seems to skip at the same rate/feel of the lurches in my game
Knotanalt
Halfling
Posts: 94
Joined: Sun Jul 01, 2012 2:58 pm
x 2

Re: Frame rate hiccup on Windows

Post by Knotanalt »

You've gone all this way but still not posted your exact hardware and driver versions, which I'm sure is the issue. Also try on opengl see if that happens. If so then I'm guessing it's your hardware. If not I'm guessing it's a driver issue.

And your version of directx and compiler and version, or you are going to be waiting a long time to figure out the issue....
fiction
Kobold
Posts: 35
Joined: Wed Aug 01, 2012 8:21 am

Re: Frame rate hiccup on Windows

Post by fiction »

I am using an MSI AMD Radeon HD 7700 as a video card and an Intel Core i7 960 as a processor if that is what you mean by hardware specifics. The bug occurs on OpenGL also so it seems weird to think it would be a DirectX driver bug..
User avatar
mmixLinus
Silver Sponsor
Silver Sponsor
Posts: 199
Joined: Thu Apr 21, 2011 3:08 pm
Location: Lund, Sweden
x 12
Contact:

Re: Frame rate hiccup on Windows

Post by mmixLinus »

Hehe you lot have come all this way and still think it's about the code or the program :lol:

Geez guys, it's a Windows/PC machine. Once a second is a classic poll time for who knows which interrupt, network card, pci bus etc. Get the SysInternals Suite and see if any processes are locking once a second or if any interrupts are firing. I suppose an interrupt conflict could mean that you won't be able to access your graphics card for 'a while'. Does your graphics card need a driver update? (Your card is fairly new).

Try switching off WiFi, the network/ethernet, any audio card. Even a harddisk with I/O problem will exhibit complete, intermittent lockup of a machine (though maybe not exactly once a second as in your case).

Good luck!
/mmixLinus;
Powered by Ogre3D:
MMiX.Me 3D - 3D Music Player
Galaxy Navigator 3D - 2 million stars (ESA's Gaia satellite)
YouTube|Facebook
fiction
Kobold
Posts: 35
Joined: Wed Aug 01, 2012 8:21 am

Re: Frame rate hiccup on Windows

Post by fiction »

If the problem was an interrupt conflict, would there be any workaround within the program? I think Crashy may be better suited to doing checks on this than me...I am not very experienced in this kind of thing.
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: Frame rate hiccup on Windows

Post by bstone »

Perhaps only artificially lowering the frame rate.
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Re: Frame rate hiccup on Windows

Post by Crashy »

Hehe you lot have come all this way and still think it's about the code or the program
You're not teaching me anything you know ;)
But there are a lot of thing that can make bugs, and generally a programmer start by checking if everything in his code, or in the code he uses, is ok.
Now I'm quite sure eveything is ok in the code, and my suspicions are directed to the windows program/thread management.

However Arkiruthis raised an interesting point: behaviour may be different wether the program is compiled with mingw or with visual.



@fiction: is your program multithreaded?
Perhaps only artificially lowering the frame rate.
I've tried that before, problem was less visible but still there.
Follow la Moustache on Twitter or on Facebook
Image
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Re: Frame rate hiccup on Windows

Post by syedhs »

I guess the benchmark would be my app vs any 3d games out there. First, is my app noticably stuttering once a second for an example? And if the app seems okay from your eyes, but you can still see the frame hiccups in the log, then probably it is negligible - maybe you are too paranoid :mrgreen: . If your app is noticably (you can just sit back and notice it) to have frame hiccups, then try comparing with other 3d games. Is the games exhibiting the same thing? if not, then there is something about app/Ogre that need to be fixed.

Edit: One time, I moved the application code from frameStarted to frameRenderingQueued, and the app seems smoother. Maybe the OT can just try this.
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: Frame rate hiccup on Windows

Post by bstone »

syedhs wrote:then try comparing with other 3d games. Is the games exhibiting the same thing? if not, then there is something about app/Ogre that need to be fixed.
Great suggestion if that haven't been done already.
syedhs wrote:Edit: One time, I moved the application code from frameStarted to frameRenderingQueued, and the app seems smoother. Maybe the OT can just try this.
Makes perfect sense since you save some CPU time for the next frame by doing part of the work while the GPU is actually rendering whatever have been queued for the current frame. Should increase the FPS slightly and smooth the experience a bit.
fiction
Kobold
Posts: 35
Joined: Wed Aug 01, 2012 8:21 am

Re: Frame rate hiccup on Windows

Post by fiction »

@crashy My program is not multithreaded.

I just tried running Braid for a bit, and there is absolutely no frame skipping. I then ran Starcraft 2 to see if the problem appears on other 3d games, and I did not detect the bug. There is a bit of occasional stuttering that exists an any 3d game, but for the most part it is extremely smooth, and I did not see any kind of frame skipping each second or anything like that.
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Re: Frame rate hiccup on Windows

Post by Crashy »

I've made some tests here and I'm quite sure now it is a problem of update order of objects that is magnified by an erratic framerate.

On my side the errors were centered on the camera only, which I move relatively to the player's node. I've modified all the camera position code that was in world space to local space and attached the camera's node to the player node. Doing that, I have no more stuttering.

This leads me to think that the reference position and orientation I use to compute the camera's position and orientation were not up to date when I use them. By attaching the camera's node to the player's node and doing computation in local space, there is no problem as all the final positions are computed by Ogre at the same time.
The irregular frame rate was just increasing the differences between the reference position I used and the true final position of my object.
Follow la Moustache on Twitter or on Facebook
Image
fiction
Kobold
Posts: 35
Joined: Wed Aug 01, 2012 8:21 am

Re: Frame rate hiccup on Windows

Post by fiction »

I'm not exactly sure what you are saying. How would I fix this in my code if I can't attach the camera node to a player's node to follow? I'm not sure if this will completely fix my issue but I'm willing to give it a shot.
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: Frame rate hiccup on Windows

Post by bstone »

Crashy wrote:I've made some tests here and I'm quite sure now it is a problem of update order of objects that is magnified by an erratic framerate.
Very interesting. Someone should give a green light on the Waruck's modification of cascaded updates. I guess having that would have prevented you from dealing with outdated data in your camera positioning code.
fiction
Kobold
Posts: 35
Joined: Wed Aug 01, 2012 8:21 am

Re: Frame rate hiccup on Windows

Post by fiction »

Now that I think more about it, I do not understand how this is a fix for the problem. Wouldn't a sudden jump in framerate each second/around each second make the game jump regardless of the rendering order? I am using a fixed timestep for my physics/game updates which makes it very ugly to handle the constant framerate jumps. If there is no way to get rid of the jumps, is there way a to make my game deterministic while easily smoothing out the bumps from the skips? I wish I could get rid of the skips though :\
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Re: Frame rate hiccup on Windows

Post by Crashy »

Let me explain this with the case of a chase camera:

If you're object moves at about 2 units/frame with a constant framerate, your camera should move 2 units/frame too.

But, with the non constant framerate, if you take as a reference position for your camera an the previous of the object, your camera moves at 2 units/frame at frame x, and at let's say 4 units/frame at x+1, and 2 units/frame at x+2, while your object has moved at 4 units/frame at x, 2 at x+1 and 2 at x+2.

So at frame x, the camera is too far away from the object, at x+1 it is too close, and at frame x+2 it is correct-> you see a hiccup in the camera movement.

Sure my fix to do all in local space is not a solution to fix de delta time values, neither applicable as a solution for all problems you may encounter :?
Follow la Moustache on Twitter or on Facebook
Image
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: Frame rate hiccup on Windows

Post by bstone »

Aha, so you have a physics based update loop with a fixed timestep. I'm inclined to think now that your problem is in the update loop. What exactly is the value of your fixed timestep and how does your update loop look?
fiction
Kobold
Posts: 35
Joined: Wed Aug 01, 2012 8:21 am

Re: Frame rate hiccup on Windows

Post by fiction »

I am using a 1/60th of a second timestep. My loop is based of off the one detailed here: http://gafferongames.com/game-physics/f ... -timestep/ . The only difference is that I do not have any interpolation code yet. My first thought was that this was the problem, but then I remembered that the interpolation here is in order to show a smooth picture even when the physics and game update times take more time than the timestep. What is happening here is that the renderOneFrame seems to be what is jumping the framerate, so my physics and game logic has no choice but to happen 2 to 3 times before the next render. That is why my tests before making the initial post were to test with Vsync off, where I get around 200 fps. I figured that any jumps that were happening could possibly be a vsync bug. However, even at the much higher framerate, the renderer would still occasionally take 2-3 physics timesteps, which is why I concluded that there was probably some internal issue with Ogre that I didn't know about and that the skipping framerate was my problem, instead of a problem with my loop.

EDIT: Also the same frameskip happens while running the Ogre Demos, which is why it doesn't seem like it would be my code...
EDIT2: for some reason running with vsync off now I get the skip like once every 5 seconds. Such inconsistency between builds T_T

EDIT3: I am so horribly confused. I was going to try to take a video for you guys so I ran the samplebrowser on the BSP sample, and I was getting the skip as always. I turned on Fraps to try to record it, but as soon as I begin recording with Fraps, the skip somehow disappears and the sample is perfectly smooth. I am very, very confused...(this is with VSync on). With it off the samplebrowser runs at multiple hundreds of FPS and does not appear to skip although I'm not sure how it does that...
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Re: Frame rate hiccup on Windows

Post by Crashy »

Fraps is probably taking a lot of cpu time to capture video, so it might change a lot of things in the behaviour of your program;
Follow la Moustache on Twitter or on Facebook
Image
Crashy
Google Summer of Code Student
Google Summer of Code Student
Posts: 1005
Joined: Wed Jan 08, 2003 9:15 pm
Location: Lyon, France
x 49
Contact:

Re: Frame rate hiccup on Windows

Post by Crashy »

Fiction, any new thing on your side that could help us to help you?(what a silly sentence).
Follow la Moustache on Twitter or on Facebook
Image
fiction
Kobold
Posts: 35
Joined: Wed Aug 01, 2012 8:21 am

Re: Frame rate hiccup on Windows

Post by fiction »

Well I'm just not sure where to go with this. If the problem occurs in the Ogre Samples, I don't see how it can be my code. In the samples it seems to only skip when vsync is on, though, and in application it skips whether vsync is off or on. I've just kind of exhausted everything that I can think would be the problem, so I started working on other stuff because honestly I'm not sure what else to test.
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: Frame rate hiccup on Windows

Post by bstone »

Have you seen this: viewtopic.php?f=2&t=71529?
fiction
Kobold
Posts: 35
Joined: Wed Aug 01, 2012 8:21 am

Re: Frame rate hiccup on Windows

Post by fiction »

WOW that was actually it!!!!

This guy was only having the issue in fullscreen mode, which turning off F.lux fixed. I turned it off and now my game runs smooth as silk on both windowed and fullscreen!

It feels so good to get rid of this bug that I've been trying to figure out for over 3 weeks :shock:

Thank you so much for your help everyone! =D
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: [SOLVED] Frame rate hiccup on Windows

Post by bstone »

I wonder what makes you people use software like that. Look - it even has "F" in the name :lol:
fiction
Kobold
Posts: 35
Joined: Wed Aug 01, 2012 8:21 am

Re: [SOLVED] Frame rate hiccup on Windows

Post by fiction »

I personally use it because it really makes my monitors easier on my eyes. I'll probably still use it whenever I'm not testing projects.
User avatar
shadowfeign
Goblin
Posts: 213
Joined: Mon Jan 26, 2009 11:51 pm
x 15

Re: [SOLVED] Frame rate hiccup on Windows

Post by shadowfeign »

fiction wrote:I personally use it because it really makes my monitors easier on my eyes. I'll probably still use it whenever I'm not testing projects.
you should look into getting a pixel qi screen. although they only really do netbook size. but its dual mode lcd, that is sunlight readable and should also help on the eyes. might help if you can transfer some of your workflow to netbook? I dunno.
Post Reply