Lots of static bodies

Posts that don't fit into other categories.
Posts: 3
Joined: Mon Jan 29, 2018 12:22 am

Lots of static bodies

Postby jeremywsmith » Tue Feb 06, 2018 5:43 pm

In a tile-based game with a world of 200x200 there may be up to 1000+ walls; each consuming a small tile. These wall bodys are just static square bodies; however I have found that the performance drops significantly with worlds with walls.

Are there any optimisation steps I can take here, other than combining adjacent walls into one polygone (which I may end up doing.)?


Posts: 6
Joined: Thu Aug 04, 2016 1:31 pm

Re: Lots of static bodies

Postby TMNCorp » Wed Feb 07, 2018 7:02 am

You have answered your own question already. There are convex shape algorithms online that can help you splitting your tilemap in as few single convex shapes as possible.

Other then that, I noticed that dyn4j is mixing static, kinematic and dynamic objects. So there is certainly an overhead involved with an increasing number of body parts.

Site Admin
Posts: 378
Joined: Sat Feb 06, 2010 10:23 pm

Re: Lots of static bodies

Postby William » Thu Feb 08, 2018 4:17 pm

Correct. You should reduce the number of bodies in the scene as much as possible.

To that end, there are a number of ways to do that, the first by combining adjacent convex shapes into a single convex or body.

The next step would be to ask yourself if you need all the bodies in the world at the same time. For example, an old school platformer game really only needs to simulate the immediate vicinity of the player. Another option might be to split the simulation into separately simulated regions.

Posts: 26
Joined: Mon Apr 17, 2017 10:46 am

Re: Lots of static bodies

Postby assofohdz » Tue May 01, 2018 10:32 am


I have the same requirement - is there any specific keywords I should google? I can't seem to find these algorithms.

Kind regards,

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest