The past few days were a nightmare for me. If a problem comes up, I usually fix it ASAP. The issue that I’m having right now, however, is just something else. It appears that either A) I can’t google, or B) I’m first to have it. Without further ado, here’s my problem.
3 days ago in the evening I compiled my project that I’ve been working on and instead of the normal, locked (not VSync, IsFixedTimeStep = true) 6.9ms per frame (measured in the Draw(gameTime) function) I was getting between 6.9 and 20.8 (average 70 FPS). It was randomly skipping up to 2 Draw() calls every Update(). First thought: I destroyed performance. Switched to IsFixedTimeStep = false to confirm my assumption. What do I get? 2000 FPS; dumbstruck. I restart it a couple of times – nothing changes. VSync set to true fixes the problem, but in an action game it’s a terrible idea. I even change the target elapsed time. 60fps and I get 40. 30 worked fine. 100 – 70. 1000? I get 1000. Confusing as ****. Probably something screwed up in the OS or something, good ol’ restart should fix it. And fix that it did. I didn’t pay it much thought after that, until…
Day 2 can be summarized with one word: consternation. The problem’s returned. And no restart can fix it. Tried creating an empty project. Literally nothing there except for a SpriteFont, SpriteBatch and a DrawString() showing FPS. Exactly the same behavior. I tried everything from build type changes to registry edits. Nothing helps.
Day 3 is exactly the same, except for it fixing itself right before I went to sleep. Today started off alright, but it just broke after 5 runs or so. I don’t even know where to begin in my search for the fix.
My partial solution for now is just running it unlocked (FixedTimeStep = false), but I do want a frame limiter in the end (not everyone wants a game to hog up an entire core or two), so sooner or later I’ll have to ask for some help. Of course, it’s not guaranteed to happen on other machines. I just tested it on my crappy laptop and it’s working flawlessly, so I will not worry about it too much. It ain’t that urgent, but it is still an issue I’d like to get fixed, just for the sake of being bug-free.
TL;DR
3 days ago all of my MonoGame apps just broke for some reason. They’re dropping Draw() calls like crazy if the framerate is locked (IsFixedTimeStep = true, VSync = false, TargetElapsedTime = 6.944ms), else they’re running in the thousands of FPS. The problem periodically fixes itself and appears again for literally no reason and nobody has ever had it yet (or they weren’t vocal about it or I can’t Google). Here I am now, asking for help or at least some ideas on where to look.
EDIT: I forgot to add some some info.
MonoGame 3.5, .NET version 4.5 and higher (all tested and broken).
Inside VS environment and outside – both broken.
x86, Any CPU, x64, release, debug – all broken.
Specs:
AMD FX-8350
Radeon HD 7850
16GB DDR3 RAM
Win10 x64
I can add more info if I forgot anything here.