0 Favourites

Understanding performance on older iOS?

  • Im testing a prototype of my game on both Android and iOS. The devices Im using to test are a Nexus 5X and an iPhone5. I have tested by building in Intel XDK, then installing the apk and ipa files on each phone.

    So the Nexus is more powerful and gives a comfortable 60fps, while the iPhone5 spends most of its time between 40 - 50fps.

    On the iPhone5 game-play is not too bad (certainly still playable), but I notice a real lag when starting a new level, when a new layout is loading up. I would like to improve this if I can. On the Nexus everything is snappy and runs really well, game play is fine and there is no lag between levels.

    I am wondering what this lower performance on the iPhone could be caused by. If its something I can optimize and hopefully improve, or if its simply due to the hardware: an older phone not being able to run the game very well (even though its a pretty simple game).

    When I go back to previewing over local network to use the deubugger, if I look at the 'Profile' tab in the debugger, I can see that the iPhone has a higher value for 'draw calls' than the Nexus. Could this higher reading for 'draw calls' be pointing to a reason why the game is running slower on iPhone?

    The readings for the debugger Profile tab look like this for each device:

    Nexus 5X

    Events: ~25%

    Engine: ~12%

    Draw Calls: ~10%

    iPhone5:

    Events: ~17%

    Engine: ~10%

    Draw Calls: 20%

    Do these readings seem high? For events and draw calls? This is my first game so Im not sure.

    The game is a simple platformer with tilemap backgrounds. I am trying to follow the recommendations in the manual for optimizing for mobile:

    -there are not many objects in the layout (47 total at the point in the game where the above readings are taken).

    -no fancy effects

    -no big images (its all tilemaps and small sprites).

  • how did you get events / engine / draw calls values?

  • I am quoting those values from the Profiler tab in the Debugger.

    So those values are when previewing my game in browser over local network. I just thought the values there might be indicate a reason for reduced performance in the game on iP5 when built in XDK and installed as an app. Hope that makes sense... I'm muddling my way through a bit. This is my first game.

  • what is the overall usage of cpu in debugger?

    if it goes too high it might be problematic.

  • Well. When I preview locally, The CPU usage is the following :

    Nexus 5X: 50 - 52%

    iPhone5: 55 - 58%

    Im not looking at the debugger to get those values though, rather I am running an event that displays FPS and CPU Usage on the screen every tick while the game is running as recommended in the manual: just setting a text object top say (fps & " FPS, " & round(cpuutilisation * 100) & "% CPU (" & renderer & ")"

    I find that if I look at the CPU usage and FPS with the debugger open I get very different values, I think thats due to the debugger itself using system resources right? So I am working on the assumption that when testing locally you get a better measure of FPS and CPU usage by using the event above.

    Also, the same event tells me the FPS and CPU usage for my game when running as an app on my two test devices. And I get different values again in that case. Ill post some screen caps to illustrate.

  • Here are some screen shots I took on my two test devices. This is with the games running as apps built in XDK (not testing locally in a browser).

    Nexus 5X: 60fps, roughly 50% CPU usage (Is that good? I dont know how good that is).

    This is smooth game-play, snappy menus etc. V happy with this performance.

    iPhone5: fluctuates between 40-50fps, CPU usage fluctuates between 80 - 90+% (looks pretty high right?).

    Another problem with the iPhone not reflected by these numbers is that each level in the game takes a long time to load. 4-5 seconds compared to about 0.5 - 1 second on the Nexus. The game-play is 'playable' but not great. But I really want to fix the lag with levels loading. Thats a problem.

    I did an additional test. I had a suspicion that it could be the way I was using tilemaps in my game. Each level has 5 layers dedicated to tilemaps. I built the levels that way because I wanted to layer the background to have a foreground, midground and background. And I have two layers for collision tilemaps, one being solids and one having the jumpThru behaviour.

    So I wondered if all these tilemeaps might be causing slow performance on the iPhone, so I deleted out the layers with artwork in them (highlighted red in the image below) and just left the two collision layers (which are invisible in the screen shot).

    This seemed to have a small effect on FPS (45 - 55fps) and CPU utilization (80 - 88%). But it improved the load times of each level a lot! The levels now load in about 1 second without those additional tilemaps.

    So if I want my game to run nicely on lower end iPhones, Im going to have to improve the way I make my backgrounds and use tilemaps differently. Otherwise it will only be people with decent phones that can run my game

    ... Id like to test on an iPhone6... and Id also like to know how many people use iPhone5 and below globally...

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • You should test on weak mobile devices from the start. Building a game then going backwards to figure out which part is slow is a lot harder than regularly testing throughout, and noticing any significant drops after particular changes.

    Your CPU measurements don't seem to add up - your screenshot shows 95% CPU on an iPhone 5 but 47% in your original post... are those correct? The 95% CPU indicates a CPU-capped game so you probably have too many events, collision checks, or something like that.

  • Hi thanks for the reply. Yes I was stupidly testing mostly on my current phone. I knew the iP5 would be weaker than my Nexus5X but I didnt think it would as weak as that... live and learn.

    Thanks for the tips. I'm pretty certain I can get the number of events in my game down. With collisions, below is a screen shot showing collisions in the debugger. Is 5643 (209 p/tick) high? Could that be causing a problem? This reading was taken at the same point in the game as shown in the previously posted screen shots.

    Ashly, re what you said about the CPU measurements not matching. The screenshot showing 95% CPU usage was taken on the iP5 running the game as an app (built in XDK). I never mentioned CPU usage in my initial post (first post of thread). I only mentioned the FPS for iP5 (40-50fps). When you quoted me as saying 47%, which part of previous post(s) were you referring to. Let me know and Ill try to clarify. Thnx

  • Here is what you need to know to help you

  • Well I took a pretty massive step forward with performance of my game on my old iP5 today. Check this out.

    iPhone5 now getting 55 - 60fps and around ~50% CPU usage.

    Improved from 40 - 50fps and 80 - 90%+ CPU usage.

    This improvement was made by swapping from building in Intel XDK to PhoneGap Build (using WKWebView).

    Boy did that make a difference!!!

    I spent most of yesterday and this morning trying to improve performance on my iPhone doing things like reducing the number of events in my game (mainly culling disabled events that were early attempts that didnt work etc), and trying to improve how I was using tilemaps... and these changes made incremental improvements, but nothing to write home about. But exporting with WKWebView ticked, and building in PhoneGap eclipsed any small optimizations I had made!

    One thing though, it didn't improve the load time for the levels, well perhaps a fractional improvement. But I still get a lag of ~4 seconds when going from a menu screen to a game level. A problem that doesn't happen on my Android test devices.

    Anyway... after getting this performance result I feel confident to continue on with building my game, knowing I should be able to get solid performance even on an older iPhone5..

  • You were basically not getting WKWebview to work with Intel XDK.

    Which is odd since it works well for me.

    Without WKWebView, performance is horrible on iOS.

  • Ok so WKWebView does work with Intel XDK as well? I read in the construct2 release notes for v224 (I think?) that Ashley hoped to get WKWebView working with XDK 'soon' but at that point it only worked with PhoneGap. So I wasn't sure if that had been achieved.

    Hmm I wonder what I'm doing wrong in XDK? Are there any tricks to get WKWebView working in XDK?

  • Yes, WKWebView should work with the latest version of the Intel XDK. It was added after the r224 release notes were written. It's only automatically enabled if you use the new Intel XDK project format though.

  • Ah that's what I'm doing wrong then. I'm not using the new XDK project format. Ok that's the first test tmoro morning.

  • So basically I missed this post.

    I swapped over to using the new XDK proj format and I am now getting 60fps and <50% CPU usage on my iPhone5 with iOS builds from XDK!

    Super happy with this!!! Onward to make 60+ levels for my game!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)