I have a fairly straight forward 2D game written in XNA. I'm finding that it arbitrarily drops from 60fps to 40fps.

I've tested this drop extensively and have concluded it's not related to graphics or the hardware being taxed. What's even stranger is that if I put the window in and out of focus a few times the fps jumps back up to 60.

Sometimes the game load sup at 60fps then I put the window out of focus and back in and it drops to 40fps. This happens anytime, including in the main menu where nothing besides two sprites are being drawn, I've even removed rendering of all sprites just to be sure and it STILL happens, so just a black screen with nothing besides a graphics device clearing the screen.

And before anyone asks, yes, I've manually polled my own functions and have found that everything is being updated and drawn very quickly, it just seems that XNA is taking its sweet time to actually call the update/draw functions.

Does this sound familiar to anyone?

  • \$\begingroup\$ Not really an answer, but random FPS drops in XNA has happened to me, and my FPS actually increased when I drew something. \$\endgroup\$
    – DMan
    Commented Sep 17, 2011 at 16:25
  • \$\begingroup\$ It might be the updating. When you focus out and focus back, XNA will see a big update interval. That might result in more calculations and stuff. \$\endgroup\$
    – ashes999
    Commented Sep 17, 2011 at 17:10
  • \$\begingroup\$ My c++/opengl game does this on windows, but runs at a very stable framerate on linux. I speculate that its something else running 'in the background' on windows but I have no data and I've found nobody else with this problem before... \$\endgroup\$
    – Will
    Commented Sep 18, 2011 at 18:00
  • \$\begingroup\$ I found I had some issues with drops in framerate when listening to music (using Winamp). I thought it was random because I wasn't always listening to music. It's possible, as @Will said, that it's something in the background that maybe you take for granted or don't realize is running. \$\endgroup\$ Commented Sep 20, 2011 at 3:20

2 Answers 2


Not sure it's related but I've had a similar problem once, a really weird one where the framerate simply drops and stays low on what seems to be random runs - like every other debug session or after/before switching between fullscreen modes.

It went away when I disabled fixed timestep which didn't feel like a good solution, but it helped and I never really researched why or what the change actually did as that project used the FRB engine.

This article explains it rather well: Understanding GameTime

        IsFixedTimeStep = false;

Tinkering with (changing the default) TargetElapsedTime instead might also help with stuttering and uneven frame rates.

  • \$\begingroup\$ Why are you setting the TargetElapsedTime when you don't have a Fixed Time Step? \$\endgroup\$
    – pek
    Commented Sep 17, 2011 at 23:50
  • \$\begingroup\$ No idea, it was left in there for some reason. As you say, it shouldn't matter when using variable timestep. \$\endgroup\$ Commented Sep 18, 2011 at 7:11

That's the expected behaviour. When you put your window in the background, it automatically gets lower priority, thus having a slower update cycle and lowering the framerate.

  • \$\begingroup\$ Read my question again, it happens even when in focus. \$\endgroup\$
    – meds
    Commented Sep 18, 2011 at 2:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .