0

I am building a new game with andengine and for some reason i keep getting this debug statement in the logcat:

01-31 21:29:50.503: I/Choreographer(697): Skipped 152 frames!  The application may be doing too much work on its main thread.

Im not really sure what is causing this error exactly during my game. I am checking a lot of collisions, but they arent initiated until after the game play scene has started.

I also noticed on my galaxy S3 the game causes my phone to "flicker" when swiping changing home screens and pulling down the task bar at the top.

I think this error has something to do with it, but i am not sure. What do you guys think?

Also each time the user goes to another level i initialized the collision detectors all over again. But i dont unregister or stop the last collisions that were started. I thought they would be automatically cleaned up when the new one is initialized.

What do you guys think?

user1681391
  • 57
  • 2
  • 11
  • Are you sure this message is outputted by AndEngine? AndEngine outout its message by tag "AndEngine" instead of "Choreographer". – 正宗白布鞋 Feb 02 '13 at 08:35

1 Answers1

4

It sounds like you're aware of what the message is telling you, i.e., your frame rate is lagging. Your follow up question, "why?" is going to be impossible to answer without more information. You've provided some possibilities: is it the collision handling? Is it processing of unnecessary collisions? Is it some problem in the scene transitions? The answer is, maybe. Maybe it's any of those things. Maybe it's something else. At the moment all we can do is guess, because we're not looking at the code.

But the good news is, you're not without recourse! What you need to do is test your code and find where the bottlenecks are. A good place to start is to throw in some calls to clock the milliseconds between blocks of your code that you suspect are the problem. You may discover that things you'd assume we're slow are actually happening pretty quickly, and conversely, things you thought were fast are happening slowly. Focus on the latter! Put more calls in there to see where exactly things are taking longer. And look at your code to see why it might be running slowly there. Are a lot of objects being instantiated there? Is it reading from disk? Etc.

When you're ready for them, there are some great third party tools to get deeper into the testing, but it's worth spending some time to clock and review your own code first. You have the advantage as the author of suspecting where the problems may be. Start investigating!

Side note, I'd provide some links to third party tools, but I'm writing this from a jacuzzi. I'll update later.

Cameron Fredman
  • 1,259
  • 11
  • 24