2
\$\begingroup\$

Through development I've been running my 2D game (Monogame 3.6) on my windows laptop, which has some crummy integrated graphics card and an i5. Now I try my game on my gaming PC, which has a GTX 970 and also an i5 (a slightly better one), and the game runs slow as hell.

I'm at a complete and total loss here. Here's what I've tried to speed up the game, and it's still hovering around maybe 15 FPS:

  • Reducing the game from 3 or 4 spritebatch blocks to a single one
  • Removing ALL shader uniform changes, so that it only sets up the shader uniforms once and never changes them
  • Commenting out 100% of particle rendering code.
  • Removing my extra render target that I used for post process fx.

After all of this, making it about as simple as a Hello World renderer, and it's still dog slow. I'm dumbfounded. Codetrack profiler says 80% of my cpu time is inside of a function called DoDraw which seems to be XNA framework code. So I'm sure it's not the update logic, or sheer number of things rendering, etc. The time anything is taking pales in comparison to DoDraw. The stack looks like this:

  • Tick
  • DoDraw
  • Present
  • PlatformPresent

But I don't really understand what it's doing and why it's taking so long. Any tips, knowledge of rendering quirks, profiling tips, etc, anything appreciated.

\$\endgroup\$
  • \$\begingroup\$ It sounds like something to do with your computer that might be independent of your game. Try checking task manager while your game runs and seeing what is being throttled (RAM, GPU, or CPU) \$\endgroup\$ – Koala Squad Oct 6 at 0:13
  • \$\begingroup\$ And disable the anti-virus. These things can be annoying. \$\endgroup\$ – Vaillancourt Oct 6 at 0:16
  • \$\begingroup\$ The weird thing is... Neither. CPU and GPU are both operating at 5-10%. Antiviris hasn't caught anything either. I'm going to try reinstalling nvidia drivers and rebooting, but it's certainly concerning. I'm also going to get some other people to try it as data points. Still worried about it even if it is an issue on my PC, I want to be able to direct users to a solution if they hit it as well. \$\endgroup\$ – JoeText Oct 6 at 1:12
  • \$\begingroup\$ If you somehow have an integrated gpu, make sure that windows runs your game in performance mode. You can check that by opening the task manager. When the category "GPU-Module" says GPU 0, then the physical gpu is used. Note: I haven't seen many desktops with onboard GPU, but you never know... \$\endgroup\$ – Chillersanim Oct 6 at 13:21
  • \$\begingroup\$ Thanks for the comments so far guys. I've completely wiped and reinstalled graphics drivers, and I'm still getting this issue only on my game. I did double check if there's an on-board GPU, but as expected there isn't. Any other ideas? (Again, nothing is being throttled in the task manager) \$\endgroup\$ – JoeText Oct 12 at 17:11
1
\$\begingroup\$

I've deduced that this is an issue with the way I'm telling MonoGame to use vsync. turning it off and setting FixedTimetep = false fixes the issue. I am going to get vysnc back on, it's just going to take a bit more tooling.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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