Hi guys, am making some speed up in my game, looks like i removed all the GetComponent, and cached all transform/animations out of the Update loop.
Looks like am still lagging abit on the Update Loop.
Is there anything i can do to get some speed up on my game? Here is my iPhone Internal Profiler:
By the way i have 4 - 5 InvokeRepeating() in Start() function( thats get called every 0.5-1.0 seconds) per animated mesh, i have 6 animated mesh on screen.
Tanks for any hint/help.
Yup, i notice am still having lots of native calls inside my Update loop. Il try to ultra-cache everyting up and see what happends, as for the meshes, i have 6 animated meshes on screen each one is 500 polys but the enviroment itself its quite heavy, il try to optimize a bit the level itself.
Tanks for the help.
The two main areas I’d focus on is your poly/vert count, and your draw calls. You really need to try and reduce draw calls. 30 is toying with the line where you’ll start seeing a noticeable drop in framerate from drawcalls alone. To reduce draw calls, make sure as many objects as possible share their material, and then use either my SpriteManager (if they are flat/2D elements), or (in the case of 3D objects) one of the mesh combiner scripts posted in these forums.
Word has it that 1.1, however, will include natively supported mesh consolidation for meshes that share a material. So since 1.1 is so near to release (or so it seems), you may want to pick poly reduction to work on first, and then hopefully by the time you get done with that, 1.1 will be released and you can use this native feature.
Brady, even with all theses un-optimized stuff, am still getting 20-24 fps with 6 animated characer on screen with the game fully running. I have a maximum of 30 drawcalls without the SpriteManager.
I know i can get a bit more of speed in my Updates.
However, my game code start to look very weird, theres lots of pre-allocations, cached and variables, and very spagetti like. I feel like loosing control over my code. Programming into an iPhone is not the same as in standart-modern computers.
That’s pretty good, and the skinning is supposed to be much faster in 1.1 also. But if you’re looking for a further speed boost, I’d look into possibly reducing polys, and definitely reducing draw calls.
In addition to the recommended reduction of the draw calls and polys (which seems to be your biggest issue), you can do some skipping/phasing in your update/fixed update functions. Even just skipping every other frame in your updates may give you a significant FPS boost. Of course this assumes that you can get away with not having every object update itself every frame.
20 - 24FPS on the itouch 2gen means that you must have at least that to play it on more than a diashow.
The itouch first gen and the phones can be happy to reach 15-18 FPS.
You really should get a device of the slowest class you want to target at, not the 2 fastest ones (already the itouch 2nd gen is twice as fast as the itouch first gen for example, the 3GS is out of scale to anything and does not work to measure anything)
His point wasn’t that it was a great phone, it was that it was designed to be a phone, not a computer. And he’s right. You may have bought it for the other things it can do, but that doesn’t mean that’s its primary design function.
Starting with the 3GS, yes it is actually for gaming or at least a far more important aspect than ever before.
Phones don’t need SM2 class graphics hardware, only consoles need that (especially since video decoder chips eat far less performance)
yet it is naturally still worlds away from a pc.
an In-Order CPU never can be considered a pc or even pc replacement as the cpu wastests far too much time especially on something with background threads like the iphone (which is why the phones always lose and will lose to the itouches until the iphone get the next year arm cpus with out of order execution)
Okay, fair enough, but the comment “It’s a phone, not a slow computer” as an entire post in a game development forum…well I don’t see the point. Though I do see the smiley now.
As far as being primarily a phone - this is an iPod Touch with a phone added to it. And I’d say it’s better than a slow computer (well sort of, as in it’s not that slow but not quite a computer), and is a better iPod than it is a phone. Of course AT&T doesn’t help matters in that regard (in the US anyways).
But anyways, I digress. I’m sorry I derailed this thread.
have out of order cpus, which makes then again faster with the background threads especially on the iphone.
have 8 - 24 times as much ram
have even at worst 4 times the graphics ram.
my gpu actually has 42.666667 times the graphics ram of the pre 3GS devices, dedicated naturally and 3 times that if we take the RAM texture memory into it as well.
Just wanted to let you know, game code just gets uglier and uglier the longer you go. Our X360 code looked like crap and the PS3… well that wasn’t code anymore. We took out all the nice things that made the code readable, and just made it faster. We left out virtual functions, exceptions, RTTI and a bunch of other stuff. And you would never, ever want to see a loop with load-hit-store problems.
Don’t do premature optimizations, but don’t leave obvious ones out. Caching, pre-allocating, data locality are all things you should just do right from the beginning. Eventually that extra ugly code might look like a design pattern
The latest Unity for iPhone is doing great with batching. Playing smart with materials can get you running at steady 60fps. Batching and avoiding allocations have been our biggest gains lately.