I’m wondering if for some reason the framerate of monogame varies from pc to pc.
Hey @Jackson_Kidwell, welcome to the community.
It’s not that MonoGame varies from PC to PC, it’s that hardware varies from PC to PC. In a perfect scenario, the code you have written may run at a perfect 60fps on your PC, but what about my PC? What if my processor is older than yours, and I have an older GPU. There’s no guarantee that your game will run 60fps in a perfect scenario on all hardware that users might have.
This isn’t uniquely a MonoGame problem. This issue arises from various factors such as the hardware mentioned previously to also how well your game is optimized. This is why delta time is used in pretty much every game development scenario, from Unity to Unreal, from MonoGame, to Love2D.
Here is another video that discusses context of delta time that may offer some additional insight as to why, yes, you should use it
Great reply and video above.
Just adding: I believe the default frame rate of MonoGame does not vary from platform to platform and is set to 60Hz as a fixed frame rate. Just in case this was still a question by the OP. And MonoGame (and XNA before it) has it’s own way to handle when the game operates slower than a fixed frame rate, which is to skip the .Draw() calls, which is not always the reason for “slow down” and we perform some code to modify this behaviour. Looking forward to the future, though, we love to explore higher frame rates available today – I am a super fan of high refresh rates!
This is a great question.
If you are free running the FPS:
IsFixedTimeStep = false;
_graphics.SynchronizeWithVerticalRetrace = false;
Then the framerate is completely hardware dependent and delta-time must be used.
For the fixed 60 FPS, the hardware demands on an older PC system, circa 2005 running XNA on Windows XP, was capable of running an empty project (and almost anything I threw at it) at full speed.
Computers have gotten faster and software slower see:
The Windows operating systems and antivirus software are traditionally the worst offenders.
Monogame has not followed that trend.
Many programming methodologies stress readability and maintainability over performance. It is important to find a balance.
A well designed small to medium sized PC game should not have any issues running at 60 FPS on most modern PCs.
The main issue is memory. Using more memory than is available will kill the performance due to swapping.
If you are targeting Mobile devices that run the gamut, it would be advisable to use delta time.
The Takaway:
Most of the time if a game is consistently running slowly, it will be unplayable whether delta time is used or not. At 5 FPS the input lag is tremendous and detrimental to reactive gameplay.