How to debug poor game performance

If your games is too slow, it's a good idea to look at these:

  • Do you have a lot of particle emitters? Lots of particles can be costly to render, consider reducing the number a bit.
  • Do you have a lot of logic going on in the events? Launch the profiler and run it on your game. Then, take a look at the results. Is there any group of events that take a lot of time? If yes, consider checking what this or these groups are doing.
    • Chances are that these events being applied on a lot of objects. Consider refining the number of objects by grouping the events as sub events of one event, with a condition that exclude a lot of objects that are far from the player.
  • After running the profiler, check if a lot of time is passed in the Rendering step. If yes, maybe you have to much objects on the screen, or that need complex rendering. Consider reducing the number of objects. If you have a lot of layers with large background, maybe you can reduce overlap. Doing multiple pass of rendering, especially for objects that are hidden behind others, can be costly. Hide or destroy objects that are hidden behind others.
  • Do you have a lot of objects, especially with the physics engine or platform behaviors applied? If yes, consider disabling the behaviors for objects that are not on the screen, or destroying objects that are far from the player.