Corona SDK - Box2D - 2,000 physics bodies + artificial intelligence

[media]https://www.youtube.com/watch?v=Hepicth3KMo[/media]

Link to YouTube video  (does anyone know how to embed a YouTube video in Corona forums?) – fixed 8/6/17! Thanks @roaminggamer

When I first started working with Corona SDK, several experienced developers told me to limit my physics bodies to under 100 (even under 50). Many experiments, tweaks, and collision filters later, I’ve been able to run 2,000+ physics bodies at 25 - 30 FPS (mostly depending how busy the artificial intelligence module is with all those little guys making decisions).

*Note - this video is from an iPad mini. My physics experiments work perfectly on iOS devices, however, I haven’t had luck with Android devices as they still crash after 50-100 physics bodies (even the good quality Samsungs). My Dynamic Shader also experiences a slowdown on Android devices - although not as noticeable as the physics crashes.

I’m looking for solutions for the android problems so please share any hunches you have.  I got the idea somewhere that I might have to use a native Java physics engine but I’m hoping for a less severe diagnosis.

Thanks,

Jonathan

You need to use long links with no special adornments.

Ex: here is your link corrected to show.

Original (a short link; no good) --\> https://youtu.be/Hepicth3KMo Lead to this when expanded --\> https://www.youtube.com/watch?feature=youtu.be&v=Hepicth3KMo ( still no good; get rid of the feature ... etc. Just watch and ID) Corrected --\> https://www.youtube.com/watch?v=Hepicth3KMo

https://www.youtube.com/watch?v=Hepicth3KMo

I got a few insights from Adrian at SphereGameStudios.  I removed ALL my OpenGL effects (it was hard to locate all of them as I have 100 modules in my game) but I was rewarded with a significant boost on Kindle Fire HD and Samsung Galaxy Tab.  I then updated to a new experimental trig module that I’ve been working on which cuts the number of function calls by 90%.  Now my Android devices are running at 50% compared to my iOS devices.  This puts them in the playable range (it was 2% before).  I’ll slowly add the OpenGL effects back in to see which ones are most problematic.  I think if I can keep making my code more efficient - graphics, physics and A.I. - I’ll can get back on the Android train!

You need to use long links with no special adornments.

Ex: here is your link corrected to show.

Original (a short link; no good) --\> https://youtu.be/Hepicth3KMo Lead to this when expanded --\> https://www.youtube.com/watch?feature=youtu.be&v=Hepicth3KMo ( still no good; get rid of the feature ... etc. Just watch and ID) Corrected --\> https://www.youtube.com/watch?v=Hepicth3KMo

https://www.youtube.com/watch?v=Hepicth3KMo

I got a few insights from Adrian at SphereGameStudios.  I removed ALL my OpenGL effects (it was hard to locate all of them as I have 100 modules in my game) but I was rewarded with a significant boost on Kindle Fire HD and Samsung Galaxy Tab.  I then updated to a new experimental trig module that I’ve been working on which cuts the number of function calls by 90%.  Now my Android devices are running at 50% compared to my iOS devices.  This puts them in the playable range (it was 2% before).  I’ll slowly add the OpenGL effects back in to see which ones are most problematic.  I think if I can keep making my code more efficient - graphics, physics and A.I. - I’ll can get back on the Android train!