My game has different, and detailed animations throughout the game. For example, the main character has an idle stance, so its not just painted still, giving him some life. Death animation, hurt animation, etc... even the background scenario has animations(which I don't think I went with the best approach here, but, it's working for now, this will be in another thread if not answered here) Anyways, the thing is, while the main character had these animations only that character was in the game at that time, so everything ran smoothly. After adding another character, the enemy, the burden of animations seems to overcharge the FPS and just slows the game down. The most obvious of this problems was that the spritesheet I was using was 1 per character, I figured how to use spritebatchnode efficiently and now 1 spritebatchnode covers the 2 characters animation set. The FPS tried to get back to normal, but its still laggy at times. This worries me because my game design has more enemies to the game, meaning that it will have this issue in a bigger scale. So I believe that its because of my animation approach, its poor, and inefficient making my game run slow.

I have been trying to find the answer online with no luck, and I don't my approach is the best. I tried working some solutions by my own, but they end up in the same thing. THE ONLY, the only way I find how to reduce this problem is to make my sprites smaller, its not a big deal, but I wouldn't like this solution.

  • \$\begingroup\$ What evidence indicates it is for sure animation? Frame hitches could be a million things. Have you profiled to ensure the hitches don't occur during spikes in physics, garbage collection, or do in? \$\endgroup\$ – Sean Middleditch Aug 3 '13 at 22:39
  • \$\begingroup\$ you just talked to me in a language I don't understand... but to answer your question,it doesnt happen during physics(since its not completely coded yet), what I mean is when I add specific animations with Cocos2d Game engine... I used CCAction: which is an array of frames that show an animation... but I was wondering if this was the best practice. \$\endgroup\$ – user31088 Aug 3 '13 at 22:47

First, are you running on the simulator or a real iOS device? The device runs many times faster than the simulator. The simulator doesn't do hardware vertex processing. So the simulator slows down quite a bit with only a little load. If its slowing down on the simulator, that's not really an indication that it will be slow on an actual device at all.

Due to the way iOS's CADisplayLink works, iOS runs at either 60 fps (maximum) or 30 fps, or 15 fps (or slower). So if your app suddenly takes just over 16.666ms to process a frame, you're into the 30 fps category then.

I don't know Cocos2D, so I cannot tell you how to get back up to 60 fps (try compiling in release mode?)

Anyway, if you've been bumped down to 30 FPS, you might add a lot more stuff before being bumped down to 15 fps.

  • \$\begingroup\$ I am running on the simulator unfortunately. Ahh I get your points thanks alot... I will find the way to put it on my device this week and I will tell you how it went. thanks. \$\endgroup\$ – user31088 Aug 4 '13 at 0:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy