We’ve finished porting our game to MonoGame Windows 8 Store. It’s mostly gone fantastic, but we’ve hit a performance roadblock on certain devices, and are struggling to identify and fix the root cause.
The original desktop XNA 4.0 version of the game ran smoothly at 62.5fps on all our devices. Our MonoGame port runs smoothly at 62.5fps on all our desktop devices including an old Core 2 Duo, however runs at around 30–40fps on Lenovo i5 & i7 Horizons and an i7 Intel Ultrabook. We’ve disabled various aspects of the game to locate what is responsible, but have some surprising findings. To clarify, that’s a Core 2 Duo out-performing 2 different models of i7 on a specifically-CPU basis.
The original XNA version ran at near 100% CPU of a single core (single-threaded). This was to be expected as we have an empty loop to take up the remaining frame time to prevent the game running too fast.
In the MonoGame Windows 8 version we cannot break around ~30% CPU of a single core (again, single-threaded) despite our frame rate being devastated, running at a very shaky 30–40fps, or worse. It seems like our CPU is being artificially limited in Windows 8.
We have experimented to no avail with the following:
• Commenting out MonoGame’s Microsoft.Xna.Game.Tick()'s Task.Delay(SleepTime).Wait();
• VSync on and off
• Removing our arbitrary frame rate limiter
• FixedTimeStep = true & false (this helped a bit)
• Removing all game-specific use of Touch-related code
• Reducing Microsoft.Xna.Framework.Input.Touch.TouchPanelState’s MaxEvents from 100 to 10
To clarify we appear to have two potentially related issues:
• In general the performance is significantly (i.e. not good enough for release) worse than the desktop version running almost the same code.
• The devices which don’t perform well are (co-incidentally?) Touch Screen devices, with batteries but testing was done plugged into mains on High Performance power setting.
Also, we’ve seen this possibly-related issue:
• http://monogame.codeplex.com/discussions/405776
We do indeed have even more performance trouble when holding down a number of fingers on a touch device. Usually this means the framerate will become increasingly erratic, varying around 10fps lower than before. This is even though we’ve disabled any code which listens to touch.
Unfortunately we’re now lost for ideas. The common link appears to be touch, but even if the game makes zero reference to or use of touch the issue is still there. On touch devices our access to the CPU appears arbitrarily limited to ~30% of the available CPU time, even though the game clearly needs more, and is losing FPS as a result.
Does anyone have any suggestions where we can look or what we could try? We have a near-finished MonoGame Windows 8 Store game almost ready to ship but dead in the water due to this.
I have some screenshots of CPU graphs I’ll post if as a new user I’m able…