Extremely low performance vs Windows Phone and Windows 8

Topics: Android
Feb 15 at 10:02 AM
Hi all,

Made a game using MonoGame 3.0 for Windows 8 a few weeks ago, and it runs absolutely fine - no performance drops or anything. Ported that to Windows Phone 7 (XNA 4.0), and again, it runs brilliantly. However, porting this to Android using MG 3.0, it has terrible performance issues. Firstly, it will take about 1 minute in the splash screen, at which point the phone will think the program is not responding and ask to "wait" or "close" - clicking wait actually comes out of the splash screen and into the game, but once in the game, there will be lots of seemingly random lag spikes.

I can only assume the android GC is not as efficient as the Windows 8 GC, and I will need to make optimizations for the lag spikes, however I'm a bit baffled on the load timing.

Another issue I have is that actually retrieving the package and manually installing the .apk causes the app not to work, and when trying to load that way, I get "x has stopped working". Is there something I'm doing wrong with the packaging of this?
Coordinator
Feb 15 at 12:55 PM
Hi Are the games already released and do we know what they are?

Thanks,


Dominique.
Feb 15 at 1:44 PM
Edited Feb 15 at 2:13 PM
We have it released on Windows 8 currently, but not the Windows Phone build yet (few more features need to be changed around a bit)

Link to W8 store: http://apps.microsoft.com/windows/en-gb/app/heart-attack/50cd4e9d-959b-436b-bfe7-cf804a072183

EDIT: After reading up, I have managed to decrease loading times substantially by replacing all the .png files with the .xnb files.
Feb 22 at 4:58 AM
I have released "Air Soccer Fever" on Android (ported from Windows Phone) and will release the iOS and Windows 8 version soon.

Here are my observations around performance on Android.
  1. Yes, it is slightly slower when it comes to loading content
  2. Target Android 2.3 (Gingerbread) and above (reason in no. 3)
  3. Uncheck armeabi checkbox when building your project, only keep x86 and armeabi-v7a
  4. Make sure to add OpenGL ES2.0 as dependency in AppManifest file
armeabi-v7a and Open GL2.0 will work on Android 2.3 and above

If your game heavily relies on a physics engine (my game does) or you have lots and lots of floating point calculations (for physics or AI), it will work horribly on armeabi. Since armeabi either cant use more than one processor core or cant use hardware for floating point arithmetic.

Moreover, I had to tweak stuff to make the game work on Android. It maybe because I don't know how to make it work, nothing to reflect on MonoGame.
  1. When using RenderTarget2D, (for animated screen transitions) I would release the game since it worked perfect on my HTC Thunderbolt Android v2.3 but people would give bad reviews since it would immediately crash on several android devices. Lots of painstaking error reporting and debugging resulted in the decision to remove screen transitions (i.e. use of RenderTarget2D).
  2. When the first game screen would load it would not render menu background texture and some other textures. I am still not sure how I fixed this one, lots of experimentation and long nights. Again please note that everything worked perfect on my HTC Thunderbolt. It surprisingly dint work on new android devices in the field.
  3. One issue that still keeps popping up is that the whole screen goes black as soon as game starts.. the workaround for this was - hit power button to lock screen, then unlock screen and the game renders properly. Again this is not an issue on my Android device.
  4. Could not use XNBs for wav files (no code exceptions, but no audible sound if xnb's were used), had to include wav files directly for sound effects
  5. One API in particular works different in XNA than in MonoGame/MFA. i.e. try to rotate a texture when using both source rectangle and destination rectangle in Spritebatch.Draw... this means that you have a large sprite sheet with all textures and you are taking a sourcebox to render and want to render it on a different size (hence destination rectangle) and rotate it. on XNA, it rotates perfectly, on Android no matter what I did , it wobbled, I could never get the "origin/center" right.
  6. On newer Android devices the layerdepth field in SpriteBatch.Draw did not work as it does in XNA. e.g. In my agne lots of people complained that they could not see the score and time on the gamefield. I literally pulled my hair out on this one.. it worked perfect on windows phone, and my android device but not on Android 4.x devices. I thought it was an issue in loading font texture or memory etc etc.. lots of theories tested.. in the end it turned out layerdepth and SpriteSort issue.
Hope this information helps other people porting to Android.
Mar 27 at 11:55 PM
Hi,
I'm very interested in putting your solution into practice, but the thing is I can not figure out how add OpenGL ES2.0 as dependency in the AppManifest?
Mar 28 at 11:42 PM
Apr 4 at 9:46 PM
And interestingly, if you make OpenGL ES 2.0 a requirement, you're only ruling out 0.3% of devices:

http://developer.android.com/about/dashboards/index.html