Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

i developed a game using cocos2D javascript that works fine on web browsers but when i run it on mobile ( iPhone 4s , android nexus) the FPS was dropped to 20 - 22 on iPhone (max) how to optimize it to increase the FPS to 30 on mobile .

share|improve this question
1  
If you post some code that is performing badly, we can try to help you optimize it. As your question stands now, there is not much help we can offer you. –  Nate Jul 30 '12 at 15:10
    
@NateBross when i run the game on a web browser on my PC it gives 60 FPS .. –  Nammari Jul 30 '12 at 16:17
1  
@Nammari Restating information you've already told us is not too helpful. You need to use a profiler to find the parts of your game that are not performing well. Once you know which parts are not working well, and you've tried and were unsuccessful with optimizing them, come back here and show us the code and tell us what you tried already. –  Byte56 Jul 30 '12 at 16:28
    
I don't think we're there yet with browser mobile games being fast enough. –  Joey Green Aug 1 '12 at 0:13

1 Answer 1

Generally slow downs are an inevitable part of using a mobile browser. There just isn't as much grunt on a phone, and mobile browsers are not yet as natively accelerated as their desktop counterparts. This is changing though (iOS 6 for example has made great leaps).

For now though, generally you need to profile and optimize your code. Try to use some isolated testing to understand what's causing the lag. Some general tips:

  1. Drawing is slow. Try to draw less things.
  2. Consider preredering complex graphics.
  3. Don't create objects. I recommend using gamecore.js object pooling.
  4. Test your effects and sprite rendering: generally rotation, alpha and scaling are going to slow you down a lot.
  5. Buffer input events and only handle them once per cycle.
  6. Buffer audio objects.
  7. Slow down your physics cycling (if you're running a simulation)
  8. Consider using a game engine like playcraft.
  9. Look at using appMobi or Ludei for native acceleration wrapping.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.