查看: 1152|回复: 0
打印 上一主题 下一主题

iPhone optimization tips(2)

[复制链接]

5552

主题

2

听众

8万

积分

首席设计师

Rank: 8Rank: 8

纳金币
-1
精华
11

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

跳转到指定楼层
楼主
发表于 2012-6-28 15:31:08 |只看该作者 |倒序浏览
Where possible ditch the OO principle of having behaviour scripts on your game objects. Instead have one central script in which you update your game action. The fewer the update functions the better. OOP is great if you want to share and re-use code - but is slower to write and***n. In my experience. On low end devices procedural programming is often where it's at.


p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 13.0px Helvetica; color: #101010} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 13.0px Helvetica; color: #101010; min-height: 16.0px} p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 12.0px; font: 12.0px Courier; color: #101010; background-color: #f2f6f8} p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 13.0px Helvetica; color: #35393f}


Use mesh/game object combining where possible to save draw calls.

Try to avoid loading/instantiating resources for the first time during gameplay - if possible instantiate them once before the game play starts, destroy them and thereafter they will be quicker to instantiate.

Avoid lighting/lights.

Code:
for (i=0; i<myarray.length; i++) {
}
is slower than:

Code:
arraylen = myarray. length;
for (i=0; i< arraylen; i++) {
}
Stinkbots XCode tweak is awesome:
http://f***m.unity3d.com/viewtopic.php?t=24987

If you're not using the accelerometer at least lower it's frequency of update in XCode.

Instead of checking the count var in GLOB.js use invoked functions e.g. to update an enemy count or NPC status every n seconds.
分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2025-2-8 08:21 , Processed in 0.060572 second(s), 29 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部