Understanding performance on older iOS?

Discussion and feedback on Construct 2

Post » Tue May 24, 2016 10:58 am

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).
B
74
S
52
G
62
Posts: 406
Reputation: 39,080

Post » Tue May 24, 2016 5:49 pm

how did you get events / engine / draw calls values?
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
43
S
14
G
12
Posts: 626
Reputation: 9,455

Post » Wed May 25, 2016 1:17 am

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.
B
74
S
52
G
62
Posts: 406
Reputation: 39,080

Post » Wed May 25, 2016 6:47 am

what is the overall usage of cpu in debugger?

if it goes too high it might be problematic.
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
43
S
14
G
12
Posts: 626
Reputation: 9,455

Post » Wed May 25, 2016 8:43 am

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.
B
74
S
52
G
62
Posts: 406
Reputation: 39,080

Post » Wed May 25, 2016 9:16 am

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.
Image

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.
Image

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).
Image

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.
Image

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...
B
74
S
52
G
62
Posts: 406
Reputation: 39,080

Post » Wed May 25, 2016 11:25 am

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.
Scirra Founder
B
402
S
238
G
89
Posts: 24,613
Reputation: 195,993

Post » Wed May 25, 2016 12:26 pm

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.
Image

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
Last edited by Artpunk on Wed May 25, 2016 12:29 pm, edited 1 time in total.
B
74
S
52
G
62
Posts: 406
Reputation: 39,080

Post » Wed May 25, 2016 12:27 pm

Here is what you need to know to help you
viewtopic.php?f=146&t=174634
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 682
Reputation: 16,635

Post » Thu May 26, 2016 8:34 am

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.

Image

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..
B
74
S
52
G
62
Posts: 406
Reputation: 39,080

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 4 guests