Sprite Kit 的主要 iOS9 性能问题 [英] Major iOS9 performance issues with Sprite Kit

查看:34
本文介绍了Sprite Kit 的主要 iOS9 性能问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 iOS9 时遇到了巨大的性能问题,我不知道该怎么办.我读过很多帖子 -

iOS 9 iPhone 5:

就纹理图集的使​​用而言,正如我的评论中所说,我不能保证任何东西都来自同一个图集.我的游戏包含自定义角色,以及来自一系列图集的资产(每个图集包含约 100 个纹理).屏幕上一次最多可以有 9 个字符.我知道这在平局方面不是最有效的,但直到 iOS9 之前我从来没有遇到过问题......

更新 3

我已向 Apple 提交了一个错误,包括我的示例程序.我还用完了我的一项技术支持请求.到目前为止,苹果没有任何消息.

解决方案

iOS9 的大部分问题似乎在最新的 iOS9.2 beta &Xcode 7.2 测试版.

感谢 Apple终于解决了这个问题.太糟糕了,我花了 2 个月的时间来解决问题.

我一直在 Apple 的论坛上发帖,提交错误并与支持技术人员交流.遗憾的是,Apple 从来没有明确说明他们知道哪些问题,以及 Sprite Kit 团队正在解决什么问题.

不过,至少 Sprite Kit 的大部分问题现在似乎都已解决,不再需要转行:]

I am experiencing HUGE performance issues with iOS9 and I just can't figure out what to do. I've read many posts - here, and here for example, but their suggested solutions don't help or make little difference.

My game has gone from 60fps on an old iPad 2 (iOS 8.4) to < 15fps on a new iPad mini (iOS 9).

I'm trying to work out the main culprit. I'm pretty certain one of them is SKCropNodes. I usually render several SKCropNodes in my scene (6 - 18). This was never an issue in iOS8, but it appears iOS9, while it does a better job of cropping, also eats up performance doing so.

If I render the crop nodes as normal SKSpriteNodes, I gain maybe 5fps on old devices, and up to 30 on a newer iPhone 6. I have no alternative to using crop nodes, but it can't be the whole problem.

I thought perhaps the wrong texture atlas was being used - i.e. one of a much larger resolution. However forcing my device to use a very small atlas made no difference.

I'm using Texture Packer to generate my atlases with scaling variants for the different devices. I've noticed XCAssets now features an option to add a Sprite Atlas (I can't seem to find any documentation about this). This isn't suitable to my game, since I use 100s of sprites. I've tried adding my atlases to XCAssets, but then for some reason it won't use the scaling variants. Nevertheless, with low res textures, it still runs terribly.

I have tried setting

skView.ignoresSiblingOrder = YES;

and given all my nodes zPosition values, but still no effect. I have also added the .png extension to every image name (originally a problem that meant they wouldn't render.)

I have some SKEffectNodes in my scenes, but removing and adding these doesn't seem to have an effect.

I don't understand how the same hardware and the same code can produce such drastically different results. Obviously Apple has changed something to do with rendering that has had an adverse effect. They also seem to have no intention of fixing these issues. I am aware of bugs on the issue that have been there for months - long before iOS9 was released.

I've been working on this game for 2 years now, and only just released it before iOS9. It's now suffering from terrible performance, and regular crashes.

Has anyone figured out what exactly Apple did to kill performance? If I knew that, I could at least try to work around it... Thanks.

UPDATE

Below are some figures for the same scene, with the absolute maximum number of nodes the game would generate at one time.

iOS 8, iPad 2, ~200 nodes, ~100 draws, 58.7 - 60 fps

iOS 9, iPhone6, ~280 nodes, ~216 draws, around 20 fps

I assume the difference in number of nodes is due to the different screen sizes. If I change the scene on iPhone 6 to achieve equivalent values, the FPS is still around 24.

UPDATE 2

Using Xcode's template Sprite Kit project, and changing the spaceship to an SKCropNode containing the spaceship, on iOS 8 I am able to add 100s of ships with no frame rate issue. On iOS 9, same project, I can add about 25 before the frame rate drops to < 30.

iOS 8 on iPad2:

iOS 9 iPhone 5:

In terms of texture atlas use, as in my comment, I can't guarantee that anything will be drawn from the same atlas. My game contains customised characters, with assets from a range of atlases (each of which contains ~100 textures). There can be up to 9 characters on screen at a time. I understand this isn't the most efficient in terms of draws, but I've never had a problem until iOS9...

Update 3

I've submitted a bug to Apple, including my sample program. I also used up one of my tech support requests. So far, nothing from Apple.

解决方案

It seems the majority of iOS9 issues are addressed in the latest iOS9.2 beta & Xcode 7.2 beta.

Thank you Apple for finally addressing the problem. Too bad I spent 2 months working on work-arounds.

I've been posting on Apple's forums, submitting bugs and communicating with a support technician. It's a shame that at no point did Apple offer any clarity over what issues they were aware of, and what the Sprite Kit team were addressing.

Still, at least it seems the majority of Sprite Kit issues are now resolved, and a career change is no longer necessary :]

这篇关于Sprite Kit 的主要 iOS9 性能问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆