game.IsFixedTimeStep = true causing game to seize up on earlier Android versions

Hi,

The fun continues! I am using game.IsFixedTimeStep = true to set a fixed frame rate for my game and have so far encountered no issues with this.

Today I tested on the GenyMotion emulator running 2.3.7 with the latest MG develop build and am getting really strange behaviour. Basically it seems if I set the frame rate to 30fps the game just completely locks up, if I set the frame rate to 1000fps or 500fps it runs fine (though unplayably fast obviously).

Android 4.x is not exhibiting this behaviour, the fixed time step operates as expected.

Are there any known issues/workarounds to do with this by any chance?

cheers

There was a bug I introduced into the Windows DX build which I just fixed…

This could for sure cause things to feel like they are locked up.

Hi Tom,

Just tried with the latest - still locking up on Android 2.3.x unfortunately!

cheers

I’ve done some digging and it the problem appears to be that System.Threading.Thread.Sleep(sleepTime) is just going to sleep forever and never waking up. The value supplied as sleepTime is correct.

I’ve no idea what could be causing this but it doesn’t actually seem to be a problem with MonoGame - maybe a Xamarin/MonoDroid thing or a problem with the GenyMotion emulator? I really need to get myself a 2.3.x device for testing. I’m sure I would have run into this problem before so it could well be something that’s surfaced with a recent Xamarin update.

cheers

Here’s a hacky workaround that seems to fix it anyway - in Game.Tick() replace ‘System.Threading.Thread.Sleep(sleepTime);’ with…

#if ANDROID
Java.Lang.Thread.Sleep(sleepTime);
#else
System.Threading.Thread.Sleep(sleepTime);
#endif

Be sure to report that finding to Xamarin. For sure that is not the correct behavior for that function.