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

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

问题描述

我在iOS9上遇到巨大的性能问题,只是不知道该怎么办.我已经阅读了很多帖子-在这里

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.

我的游戏从旧版iPad 2(iOS 8.4)上的60fps变为<在新的iPad mini(iOS 9)上为15fps.

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

我正试图找出罪魁祸首.我可以确定其中之一是SKCropNodes.我通常在场景中渲染几个SKCropNodes(6-18).在iOS8中这从来不是问题,但在iOS9看来,虽然它的裁剪效果更好,但这样做会降低性能.

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.

如果我将裁剪节点渲染为普通的SKSpriteNodes,则在旧设备上可能会获得5fps的速度,而在较新的iPhone 6上可能会获得30fps的速度.除了使用裁剪节点,我别无选择,但这不能解决整个问题.

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.

我正在使用Texture Packer生成具有针对不同设备的缩放变体的地图集.我注意到XCAssets现在具有添加Sprite Atlas的选项(我似乎找不到有关此文档的任何文档).这不适合我的游戏,因为我使用了100个精灵.我尝试将地图集添加到XCAsets中,但是由于某种原因,它不会使用缩放变量.但是,由于具有低分辨率纹理,它仍会非常糟糕地运行.

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.

我尝试设置

skView.ignoresSiblingOrder = YES;

并给我所有节点zPosition值,但仍然没有效果.我还为每个图像名称添加了.png扩展名(最初是一个问题,即它们无法渲染.)

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

我的场景中有一些SKEffectNodes,但是删除和添加这些似乎没有效果.

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

我不明白相同的硬件和相同的代码如何产生如此截然不同的结果.显然,苹果公司已经改变了与渲染有关的东西,这已经产生了不利影响.他们似乎也无意解决这些问题.我知道这个问题已经存在了几个月,距离发布iOS9还早.

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.

我从事这款游戏已有2年了,只是在iOS9之前才发布.它现在正遭受可怕的性能和定期崩溃的困扰.

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.

更新

下面是同一场景的一些图形,其中一次将生成游戏的绝对最大节点数.

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个节点,约100个绘图,58.7-60 fps

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

iOS 9,iPhone6,约280个节点,约216个绘图,约20帧/秒

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

我认为节点数的差异是由于屏幕大小不同所致.如果我将iPhone 6上的场景更改为达到等效值,则FPS仍为24.

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.

更新2

使用Xcode的模板Sprite Kit项目,并将宇宙飞船更改为包含该宇宙飞船的SKCropNode,在iOS 8上,我可以添加100艘没有帧频问题的飞船.在iOS 9上,同一项目,我可以在帧速率降至<之前添加25. 30.

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.

iPad2上的iOS 8:

iOS 8 on iPad2:

iOS 9 iPhone 5:

iOS 9 iPhone 5:

就纹理地图集的使用而言,正如我的评论一样,我不能保证任何东西都可以从相同的地图集中提取.我的游戏包含自定义角色,并具有一系列地图集的资源(每个地图集包含约100个纹理).一次最多可以在屏幕上显示9个字符.我知道这并不是平局最有效的方法,但是直到iOS9才出现问题...

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

更新3

我已经向Apple提交了一个错误,包括示例程序.我还用完了我的一项技术支持请求.到目前为止,苹果公司什么都没有.

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.

推荐答案

似乎大多数iOS9问题已在最新的iOS9.2 beta& Xcode 7.2 Beta.

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

感谢苹果公司最终解决了该问题.太糟糕了,我花了2个月的时间来解决问题.

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

我一直在Apple的论坛上发帖,提交错误并与支持技术人员进行交流.可惜的是,Apple从来没有对他们知道的问题以及Sprite Kit团队正在解决的问题提供任何清晰的信息.

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.

仍然,至少大多数Sprite Kit问题现在已经解决,并且不再需要职业变更:]

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天全站免登陆