Perfomance problem when creating many circles as fixtures

Discuss issues specific to using Box2D on the iPhone
KAMIKAZE
Posts: 17
Joined: Thu Jun 28, 2012 1:57 am

Perfomance problem when creating many circles as fixtures

Postby KAMIKAZE » Wed Nov 13, 2013 9:58 am

In my cocos2d game I need to create such body:

Image

It's consist from circles and sometimes polygons is there.
When this body created and moved on the scene my iPad mini processor loads at 98-99% (especially, when this body rotated in world)

Image

Circles used to create user defined object, he just draw lines and I'm creating circles on the control dots of each line.

So, I want to improve performance as much as it possible...

irresistible force
Posts: 1991
Joined: Tue Jun 24, 2008 8:25 pm
Location: Tokyo
Contact:

Re: Perfomance problem when creating many circles as fixture

Postby irresistible force » Wed Nov 13, 2013 11:08 am

How many bodies do you have there? You may have simply reached the limit of what the CPU can do.

KAMIKAZE
Posts: 17
Joined: Thu Jun 28, 2012 1:57 am

Re: Perfomance problem when creating many circles as fixture

Postby KAMIKAZE » Wed Nov 13, 2013 11:13 am

Above ~1000, but they are small..
Strange, that it's drop performance even on simulator. My pc has core i3 3.5Ghz processor...(hackintosh :))

irresistible force
Posts: 1991
Joined: Tue Jun 24, 2008 8:25 pm
Location: Tokyo
Contact:

Re: Perfomance problem when creating many circles as fixture

Postby irresistible force » Thu Nov 14, 2013 12:48 am

They may be small, but they still have to be calculated for. I think you are just pushing the limits with that hardware.
You may be interested in this article, which talks about some of the challenges of this type of simulation:
http://tuxedolabs.blogspot.jp/2011/11/s ... cenes.html
Even with their improved customized neighbor-finding and a lot of optimization, they still could not manage more than 600 particles.

For the simulator, it's probably slow because the rendering is all done in software. Try turning off the debug draw or whatever rendering you are doing, and check the framerate without it.

KAMIKAZE
Posts: 17
Joined: Thu Jun 28, 2012 1:57 am

Re: Perfomance problem when creating many circles as fixture

Postby KAMIKAZE » Thu Nov 14, 2013 1:28 am

Thanks for the link, very interesting.
Without debug draw same situation. Well, as I understand it's nothing can be done here and I need to try another way to create a body.
I need just create body based on what user draw on the screen, on lines and polygons...

futcoinscut
Posts: 1
Joined: Wed Nov 20, 2013 11:51 pm
Contact:

Re: Perfomance problem when creating many circles as fixture

Postby futcoinscut » Wed Nov 20, 2013 11:56 pm

I like that.


Return to “iPhone”



Who is online

Users browsing this forum: No registered users and 2 guests