Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I created a FpsCounter DrawableGameComponent (linked to code, it's longish). It seems to work great, it displays 60.0 fps normally, and if I artificially slow down the game loop then it drops.

Given that my 'game' at the moment is a single sprite that the user can control with the keyboard, it should be capable of a lot more than 60 frames a second. My Game constructor looks like this:

public Game1()
{
    _graphics = new GraphicsDeviceManager(this)
                    {
                        PreferredBackBufferWidth = WindowWidth,
                        PreferredBackBufferHeight = WindowHeight,
                        SynchronizeWithVerticalRetrace = false,
                    };
    _graphics.ApplyChanges();
    Content.RootDirectory = "Content";
}

However, even though the above code seems like it should turn off vsync, it doesn't seem to be. Is there something wrong with my constructor, or perhaps my FPS calculations? Or is there something else that may be limiting the frame count?

share|improve this question
add comment

2 Answers

up vote 9 down vote accepted

if Game.IsFixedTimeStep is true the update method will be called every 1/60 seconds

http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.game.isfixedtimestep.aspx

"The default value for IsFixedTimeStep is true."

share|improve this answer
    
That's more like it. 7k fps ahoy! –  Matthew Scharley Aug 16 '11 at 12:23
    
@Mathew, Also note that this will call Update() many more times too. From some preliminary tests, I believe the Update() and Draw() functions are called one after the other in a game loop. So expect 7k Update() calls. –  John McDonald Aug 19 '11 at 18:33
add comment

It depends on your video card settings (in Windows). I had the same issue and than I found that my nVidia card has its own vsync settings in control panel where vsync can be set to forced-on mode (application settings will be ignored in this case).

share|improve this answer
    
Possibly an issue, though a quick check of my settings shows vsync set to "Use the 3D application setting". –  Matthew Scharley Aug 16 '11 at 12:05
    
I even tried setting it to "Force off" and still no help. –  Matthew Scharley Aug 16 '11 at 12:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.