Windows Phone 8.1 game with CocosSharp 1.4 or 1.5 is very slow RRS feed

  • Question

  • User16951 posted

    I experience slowness in my game. Also, the same slowness can be seen in CocosSharp sample called Angry Ninjas https://github.com/mono/cocos-sharp-samples/tree/master/AngryNinjas/src Run it on WP8.1 device and see how slow the game is.

    My game runs smoothly on iOS and Android but is very slow on WP8.1

    Please advise.

    Friday, July 10, 2015 2:48 AM

All replies

  • User68494 posted

    Can you try something that is outlined in the following: http://stackoverflow.com/questions/30243067/monogame-running-very-slow-on-windows-phone

    Friday, July 10, 2015 5:40 AM
  • User16951 posted

    @kjpou1 do you mean running game without debugger? I experience slowness in release-built app published to store, so there is no debugger attached. I am not sure what should I try and would be happy to try anything that could help solve the problem.

    Friday, July 10, 2015 11:12 AM
  • User16951 posted

    @kjpou1 after fixing CCStats for WP81 device (http://forums.xamarin.com/discussion/45337/windows-phone-8-1-displaystats-is-not-working) I can see that FPS is very low (11-12). I compared to iOS and see that memory usage, GC count, number of draw calls and time to draw are same. However, time to update is much higher and FPS is much lower on WP81 than on iOS.

    Can you suggest some reasons that might cause such a strange behavior? I experience that slowness on easy scenes and with or without animations, even when scene is idle.

    Friday, July 10, 2015 4:21 PM
  • User68494 posted


    The windows phone performance problems have always been there from what I have seen. Let's see where things can be optimised. We will need to take them one by one though in stead of a general "it is slow".

    Do you have any specific output that could lead us in the right direction besides a general it is slow?

    One thing that comes to mind is the loading of the assets. That seems to be dog slow compared to other platforms. One thing for that from what I have seen is specifying the exact path to the asset instead of letting MonoGame look for it.

    Instead of loading a lot of sprites try packing them into one texture sheet so that the loading into memory goes faster.

    Saturday, July 11, 2015 3:38 AM
  • User16951 posted

    Completely understand your question. I do not have a lot of assets (indeed it's just one). FPS are low even when nothing is done. After I fixed CCStats, I was able to identify the problem. Looks like after certain amount of elements in the game it becomes much slower. For example, I commented one layer, and FPS jumped to 56. When particle effect runs, they drop again to 12-20. I tried to understand which node in this specific layer makes game slow and found out that just uncommenting any node or just at all adding one more node makes fps drop to 20 fps.

    Also, regarding my previous comment, I understood CCStats incorrectly, it's draw cycle slow, not update. I would be more than happy to give you a source of the game under NDA but I think you are very busy even without this task.

    What I also did is I deployed on device CocosSharp WP8 tests and Cocos2d-xna WP8 tests. CocosSharp is slow, Cocos2d-xna is much much smoother and faster.

    Saturday, July 11, 2015 3:48 AM
  • User68494 posted

    Sorry to hear that. We definitely need to look at it. Do you see a difference between 1.4 and 1.5

    Saturday, July 11, 2015 4:04 AM
  • User16951 posted

    Here is screenshot from Cocos2d-xna wp8 test: https://dl.dropboxusercontent.com/u/7022824/wpss201507110002.png Here is of same test from CocosSharp: https://dl.dropboxusercontent.com/u/7022824/wpss201507110005.png

    Saturday, July 11, 2015 4:28 AM
  • User9477 posted

    @AlexS Did you succeeded to deploy Release version of your game? Debug deploy is going good (even with your fix to show CCStats.. thanks)

    But on Release version i get DEP6810 ERROR MdilXapCompile.exe error with resources.dll error. even when i succeded to fix this (via copying resouces dll's to release directory) and deployment is succeeded, my app CRASHED.


    Sunday, July 12, 2015 11:25 AM
  • User16951 posted

    You are welcome! Regarding DEP6810 you should check what's the error. Maybe it is something related to your game PCL, not to CC#. http://stackoverflow.com/questions/26238570/is-it-possible-to-use-a-portable-library-with-localized-resources-in-a-universal

    My app is being deployed in release just fine. Also, make sure you clean and then build project from scratch, some things may be left from previous build

    Tuesday, July 14, 2015 4:34 AM
  • User16951 posted

    @kjpou1 I finally compared performance between 1.4 and 1.5. 1.4 is much faster and gives me 60 fps when scene is idle and around 20-30 when I add many particles (in these moments other platforms are sometime sluggish also). So, that is the performance level I would expect and think about optimizing.

    Now I have a dillemma - apply my fixes to CCStats and Orientation to the new branch created from 1.4 or ask you more and more about fixing that problem (which is still unclear for me) in 1.5.

    Please advise.

    Tuesday, July 14, 2015 4:43 AM
  • User16951 posted

    I was able to profile the game only using VS 2013 (VS 2015 doesn't load method names for some reason) https://www.dropbox.com/s/gngju4jqsqsge3k/shot150714023019.png?dl=0 Not sure if this information is valuable, but looks like VertexBuffer.SetDataInternal occupies a lot of time.

    Tuesday, July 14, 2015 6:31 AM
  • User9477 posted

    Just FYI. I managed to use PCL resources on WinPhone 8.1 WinRT here: https://forums.xamarin.com/discussion/comment/138856/#Comment_138856

    It worked for me. for now at least.....

    Tuesday, July 14, 2015 7:54 AM
  • User16951 posted

    @kjpou1 and @RamiTabbara I know you're busy, guys, but maybe you can give me some ideas where to look at and solve that issue. This is now the only outstanding problem that stops Windows Phone release.

    Wednesday, July 22, 2015 5:18 PM
  • User9477 posted

    @AlexS Try to check performance on WP8.1 Silverlight (and NOT winRT). I succeeded there things i didn't succeed on winrt. so maybe.....

    Wednesday, July 22, 2015 9:09 PM
  • User16951 posted

    @zahikramer, do you have any details how do I do that? I found only template and tutorial for WINRT.

    Wednesday, July 22, 2015 9:13 PM
  • User9477 posted

    Sure @AlexS , you can see this from few locations 1. from the examples go to gonebananas2 and see wp8 project. (all you need to do is change from project settings to wp8.1 - it is silverlight on wp8 so it stays silverlight on wp8.1 2. see the pic from the templates: choose wp8.0 and afterwards change it to 8.1 and it will stay silverlight

    Wednesday, July 22, 2015 9:45 PM
  • User16951 posted

    @zahikramer thank you

    Thursday, July 23, 2015 8:04 PM
  • User9477 posted

    @AlexS It worked?

    Thursday, July 23, 2015 8:06 PM
  • User16951 posted

    Not actually, getting a blank screen. Sometimes I see first screen and this error:

    HRESULT: [0x887A0001], Module: [SharpDX.DXGI], ApiCode: [DXGIERRORINVALID_CALL/InvalidCall], Message: The application made a call that is invalid. Either the parameters of the call or the state of some object was incorrect. Enable the D3D debug layer in order to see details via debug messages.

    Thursday, July 23, 2015 11:44 PM
  • User9477 posted

    @AlexS Try from the bottom up. first compile the vanilla template and see it's working. then (with minimum changes to the pages structure) add the CC files and compile. see how it goes. also as you saw yourself , make clean before rebuild.

    Friday, July 24, 2015 8:58 AM
  • User16951 posted

    @zahikramer I was able to achieve that but only after I built a nuget from current CocosSharp master and used it as source for CocosSharp.PCL.Shared. In that case everything works fine in WP8.1 project, system fonts, stats and even all the logic is in PCL project. However, the game is still very slow. I sent my project to CocosSharp team with hope they will solve the mystery. I am sure that it's just something unoptimized in MonoGame or CocosSharp for WP. iOS and Android versions work very smooth.

    Thursday, July 30, 2015 7:57 AM
  • User9477 posted

    @AlexS Glad to hear that. It's WP8.1 SL yes? You said also SystemFonts? on WP8.1 SL ? on device? (not only emulator?) They updated CC?

    Thursday, July 30, 2015 8:03 AM
  • User16951 posted

    Yes, I tried WP8.0 (Silverlight), WP8.1 (Silverlight) and WP8.1 (wpa/winrt). All of them show same performance and it is very low. 14-20, sometimes 38 fps.

    SystemFonts work on device with WP8.1 if the game is WP8.1 (wpa/winrt). Xamarin didn't update CocosSharp, but I built a nuget package from the latest master and used local nuget storage.

    Thursday, July 30, 2015 5:35 PM
  • User9477 posted

    Good to heat that. I decided to stick with silverlight for now because i saw the best support (if any) is there. glad to know things are moving.... but the performance is still a problem.

    Saturday, August 1, 2015 6:38 PM
  • User16951 posted

    @kjpou1 @RamiTabbara Folks, maybe you have any thoughts what it might be causing this slowness? Any ideas or ways to get more information are much appreciated!

    Tuesday, August 11, 2015 7:00 AM
  • User68494 posted


    No not yet to be honest

    Tuesday, August 11, 2015 7:04 AM
  • User16951 posted

    I see, I'm reading now this thread http://forums.xamarin.com/discussion/46525/how-to-properly-cache-sprites-labels-textures-and-reduce-draw-calls and this one http://forums.xamarin.com/discussion/46525/how-to-properly-cache-sprites-labels-textures-and-reduce-draw-calls with hope this information will give me any clue.

    If I only could pinpoint the source of the problem

    Tuesday, August 11, 2015 7:07 AM
  • User115102 posted

    Any luck @AlexS ?

    Tuesday, August 18, 2015 7:50 AM
  • User16951 posted

    Not yet, unfortunately

    Wednesday, August 19, 2015 4:45 PM
  • User16951 posted

    Update on this topic: with 1.6.2 version application is much much faster. There is only a problem with CCUserDefaults not working correctly on WP8.1, but that is already fixed and (hope) will be merged in and available in the next NuGet release.

    So with 1.6 everything is smooth and cool!

    Monday, October 26, 2015 6:44 AM