I am writing a iOS game using Cocos2d. There are a lot of balls(about 7000 objects) in a screen.
When touch the screen, the balls should be exploded in the area, and it should be filled with around balls.

I created a box2d object for each of them and added it in the physics world.
Problems are as follows.
- At first, when there is no touch event, screen is filled by 7000 balls, if we start the physics, they are overlapped each other, and there is a gap on top of the screen.

- when touch the screen, the game works very slowly.
How can I make the game smoothly?
Reduce the number of balls. 7000 physics enabled, colliding bodies is pure overkill. Even 700 is a lot.
In any case there's no quick fix for this. You can try to reduce the number of position & velocity iterations in the box2d world's timestep and do not use collision callback methods (don't set a collision delegate) but that's about it.