FPS issue between computers results in slow down of animations and moving

I have been developing my game on two computers. I recently got a new computer and have noticed an issue that seems to be happening in my game.

When computer 1 runs the game at 60 FPS everything seems to run fine, all the timings are correct and everything runs smoothly.

When computer 2 runs the game at 60 FPS everything seems to slow down, everything happens properly (all the timings are correct) but it's as if the update is not being called at 60 FPS. If I "unlock" the frame rate and let it go to >3000 fps then it runs fine, but not when it's at the expected 60 FPS. A frame counter in code seems to tell me the FPS is 59.

I'm not sure if this is relevant but I usually use something like this to perform updates between moving or animations, etc:

 public bool ShouldUpdate(GameTime gameTime)
{
if (this.Disable)
return false;

float dpf = this.DelayPerFrame; // example value: 60f
float tpf = 1.0f / dpf;

this.totalElapsedTime += (float)gameTime.ElapsedGameTime.TotalSeconds;

if (this.totalElapsedTime >= tpf)
{
this.totalElapsedTime = 0f;

return true;
}

return false;
}


What kind of things can be causing this? I'm more than happy to add any additional information.

I guess my question really comes down to, how do I ensure that all updates and timings happen the same across computers?

• It's usually a bad idea to use a timer to synchronize to framerate. Instead, you should use a sync API or event that corresponds exactly to the vertical refresh event. Not sure what that looks like in xna/monogame, but I assume there's some way to do it. – MooseBoys Apr 10 '15 at 20:46

float delta = (float)gameTime.ElapsedGameTime.TotalSeconds;