使用 cocos2d 应用程序降低功耗的可能性
我制作了一个棋盘游戏,其中仅包含一些小动画。我将 fps 从 60 降低到 30 以减少处理器负载。但设备仍然变得很热。 另一个不用 cocos2d 制作的应用程序并没有那么热。 有什么方法可以让iPhone安静下来吗? 设备状态如下:
- Wifi 始终启用
- 该应用程序使用游戏中心
- GPS 处于非活动状态
- fps 始终为 30
- 我使用 cocos2d-iphone 作为引擎
I made a board game with includes just some little animations. I reduced the fps from 60 to 30 to reduce the processor load. But the device still gets very warm.
Another application made without cocos2d is not heating it so much.
Are there any methods to calm the iPhone down?
The device state is as follows:
- Wifi is always enabled
- The app uses gamecenter
- GPS is inactive
- fps is always on 30
- I use cocos2d-iphone as engine
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
可能值得尝试不同的控制器类型,例如 kCCDirectorTypeNSTimer,并看看是否有帮助。这些将对游戏的主循环产生最大的影响。
您还应该花一些时间使用 Instruments(如果您还没有这样做的话),因为这会向您显示 CPU 在哪里花费了时间,并为您提供一些关于可以在哪里简化操作的提示。
It might be worth experimenting with different director types, e.g.
kCCDirectorTypeNSTimer
, and seeing if that helps at all. Those will have the biggest effect on the main loop of the game.You should also spend some time with Instruments if you've not already, as that will show you where the CPU is spending its time and give you some hints on where you could ease things up.
我注意到 cocos2d 中的一系列小时间动画需要大量处理器时间。我尝试过将尖端制作成会脉动的尺寸。 0.1 秒脉冲上升,0.15 秒下降,0.2 秒停留。我把这一切都放在一个永远重复的序列中。一切都慢得可怕。然后我刚刚手动制作了动画,设备平静下来,fps 增加回 60
I've noticed that a sequence of small time animations in cocos2d takes a lot of processor time. I've tried making tips at the level which will pulse in size. 0.1 second pulse up, 0.15 down and 0.2 stay. And i've put it all in a repeat forever sequence. Everything was terribly slow. Then i've just made the animation manually and the device calmed down and fps increased back to 60
当显示不需要动画的菜单或对话框时,您实际上可以进一步降低帧速率。
When showing menus or dialogs that do not require animation, you can actually lower your framerate even further.