iOS Simulator games run very slow (low fps)
Asked Answered
U

2

30

Diving into sprite kit (xcode 5). There are two example programs I'm working with, 1. the default spaceship example that's included when creating a new project and 2. the Adventure Game, which I downloaded.

Running these examples within the iOS Simulator (doesn't seem to matter which). The frame rate for each is absolutely abysmal. If I add only 30 spinning space ships in the space ship / hello world example, the FR rapidly drops from 60 FPS to (ug) 12 FPS.

The Adventure Game example, again, running in iOS Sim, runs at a screaming 10-20 FPS (depending on how much action is going on).

Is Apple serious with these game examples? Sprite Kit seems to be crap -- I assume the problem is either the way the programmers employed Texture Atlas' or it's the way Sprite Kit (API) is dealing with them.

Someone help me understand this or fix it?

Running xcode 5 under Mavericks, Mac Mini -- I program in Unity3D and have no problems w/ FR there, esp w/ only 30 objects using 2DToolkit.

Undergrowth answered 24/10, 2013 at 4:21 Comment(7)
when you run the demo code on the device, the frame rate is fine. Running 4S and have 40 spinning ships at 60 fps. But on the simulator - the FPS is poor ... a few ships and down to 12 or so..Cantabrigian
well, glad it's not just me. wonder if there's a Build Setting I can change, been playing around and so far, no luck. i gather from what i see, the Sim isn't taking advantage of my system's local GPU, that what it looks like anyway, could be something else.Undergrowth
Looks like this might be related: #1461745Undergrowth
yeah, i only worry about performance when running on device. so far no issues with FPS.Cantabrigian
@Cantabrigian This is a year later but I've just started iOS development. Can you tell me the general performance of spritekit vs opengl? I'm looking to make a bullet hell game with 800+ small sprites and a few large sprites. Can I expect iPhone 5 and newer to run well with spritekit?Spermatocyte
@Spermatocyte I suggest asking a question on stack, if the bullets don't have physics bodies attached I'm thinking it should be ok. But, just have to try and see. OpenGL is something I've never used, give Sprite Kit a go - sounds like a fun game :) Good luckCantabrigian
@Cantabrigian Thanks. I did a little research and Sprite Kit seems low enough level to have good framerates for the games I'm interested in making. Don't want to pay for the dev fee just to take a few benchmarks way before any product is close to finished.Spermatocyte
T
79

The Simulator is not a device. The Simulator uses the Mac's CPU (tons faster) and the Mac's memory (lots more). However the Simulator also emulates OpenGL ES via a software renderer, which is abysmally slow even on the fastest CPU.

Because of this and the fact that no end user will ever run an app on the Simulator, any performance measurements on the Simulator are utterly IRRELEVANT!

Sorry for shouting but I felt this needed to be said with conviction. ;)

Therapeutic answered 24/10, 2013 at 9:35 Comment(10)
This issue is also not specific to SpriteKit. Unity, cocos2D, Sparrow etc all run slower on IOS simulator, even abysmal.Gingham
Yep. For anything you do with OpenGL ES, the iOS Simulator is not an accurate performance measure.Reorientation
For anything, period. ;)Therapeutic
Landed here with the same observations. What's a good workflow for rapid code+testing on real devices? (That doesn't require some third party service.)Elvaelvah
Ditto on this problem. Makes development of a game one step more of a hassle. Hopefully Apple comes up with a solution to this now that they are pushing SpriteKit.Binnie
Thanks for the answer @LearnCocos2D however if I have 2 algorithms (A & B) and if A is faster by 2 times than B on the simulator, will it be faster on a real device too ?Presbyterial
Likely but the CPU architecture is also very different (ARM vs Intel) so there's no guarantee.Therapeutic
On the other hand, testing the SpriteKit app on the slow simulator helps debugging physics on slow devices, e.g. iPad mini 1, or iPad 2.Hendrick
Over 3 years later now and apparently still no improvement. I'm also seeing ridiculously low fps with SpriteKit in the simulator. sighBinnie
IRRELEVANT? Yes off course, we should not consider run time of some code in simulator as time in real device. But we can compare times between simulator and real device to find out that simulator has some serious performance issues. I have demonstrated that Simulator is 200 times slower than real device. Simulator is not usable at all in that demo code. See my answer here https://mcmap.net/q/472242/-simulator-on-xcode-10-became-terribly-slow Btw @JamesPaulMason updating... Over 6 years later now and apparently still no improvement. I think that simulator is slower and slower with each newer Xcode and iOS releases.Gouda
T
3

Even though this post is almost 8 years old I found myself in the same situation when trying to record an App Store preview for my Unity game.

With your simulator open you can change the GPU Selection to improve performance. It was set to Automatic for me and changing it to Prefer Discrete GPU dramatically improved the frame rate.

screenshot

Notes

  • Tested with Xcode 12.5 - not sure when this feature was introduced.
  • I had to restart the simulator for it to take effect.
  • Your Mac will presumably need to have a discrete GPU in the first place (mine is a 15" MacBook Pro).
Trinitytrinket answered 19/5, 2021 at 10:54 Comment(1)
This worked perfectly for me on a 15" 2019 MBP. Prior to enabling this the iOS simulator was running the worst I've ever seen, but changing it to this has made it run smooth as butter. Thanks for posting this!Sudra

© 2022 - 2024 — McMap. All rights reserved.