纳金网

标题: iPhone optimization tips(2) [打印本页]

作者: 会飞的鱼    时间: 2012-6-28 15:31
标题: iPhone optimization tips(2)
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.




欢迎光临 纳金网 (http://go.narkii.com/club/) Powered by Discuz! X2.5