9

I'm making a game for the iPhone using Cocos2D. At the beginning of the game, when there are few sprites, the game runs fine, but when there are many sprites on the screen, the game gets choppy.

I've profiled the app, and RunWebThread seems to be taking up 33% of the cpu time. I contact a server at the beginning of the game, but there is no Internet usage after this initial contact.

Does anybody know what this thread is doing?

Jessica
  • 393
  • 3
  • 5
  • 13
  • maybe you could post some code ? My crystal ball is not working today. – Romain Hippeau Jun 19 '10 at 16:30
  • The project is 45,000 lines of code, and I didn't write anything with the name RunWebThread. I would happily post code, but I wouldn't know what to post. RunWebThread is either part of the Cocos2D or Cocoa libraries. Surely someone else has seen this before? – Jessica Jun 19 '10 at 17:14
  • It sounds like you stated the cause of your problem. You have many sprites on screen at once. RunWebThread may be taking up alot of time but how long does it take for a call to RunWebThread to complete? It may not be that long. If you didn't write that function chances are you don't need to worry about it anyway. Sprites are much more likely the cause of your performance issues. How many sprites do you have on screen at once? How big is the texture you are using for them (bit depth, size in pixels)? – Rob Segal Jun 23 '10 at 14:35
  • I start my app in a UITableView that does absolutely nothing (as far as I recall) after setting up some static UI elements, and I am also seeing similar behavior. I'll be interested in an answer to this too. Meanwhile I'll staring paring my app back until the excess CPU (hopefully) goes away and report back. – Marcelo Cantos Jul 04 '10 at 07:31
  • from my experience cocos2d is nice for small games and puzzle games. but it's a major PITA if your game becomes complex. –  Sep 24 '10 at 07:46

1 Answers1

4

Here's your answer: http://developer.apple.com/mac/library/qa/qa2009/qa1619.html

David M.
  • 3,667
  • 25
  • 27