How to improve speed when many physics objects are on screen?

I’m working on an iPad game which has many physics boxes reacting to gravity and colliding with each other. Using these objects, the game speed (with a 30 FPS setting) gets very slow. Each box is basically an image from a spritesheet using a rectangle shape. What are some of the top tips for increasing the speed when dealing with many physics objects?

Thanks!! [import]uid: 10284 topic_id: 4439 reply_id: 304439[/import]

Are you constantly removing and creating these objects? If so it may be a bug: http://developer.anscamobile.com/forum/2010/11/25/removing-physics-bodies [import]uid: 10903 topic_id: 4439 reply_id: 13876[/import]

Hmm no, they’re mostly always visible (until destroyed, but the speed problems happen right from the start). The problem is I have what might be a ridiculously high number of objects, 468. [import]uid: 10284 topic_id: 4439 reply_id: 13941[/import]

Wow… 468 physical objects! I would guess that’s way outside the limits of decent performance on any mobile device, using virtually any language. It might be possible if you code with native Obj-C and XCode, but even then, remember how little memory and processing power these mobile devices have compared to a desktop/laptop computer.

My suggestion is that you approach a new game idea, or somehow limit the number of physical objects. I don’t know the exact “limit” (50? 100+?) but 468 is ALOT. :slight_smile:

Best of luck!
Brent
[import]uid: 9747 topic_id: 4439 reply_id: 14158[/import]

Thanks, yes, I’m switching projects for now.

It’s worth noting though that even when I switched off the physics on the objects, the game was running faster but still not at 30 FPS… [import]uid: 10284 topic_id: 4439 reply_id: 14202[/import]