Physics error (halp!)

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Chief
Party member
Posts: 101
Joined: Fri Mar 12, 2010 7:57 am
Location: Norway, 67° north

Physics error (halp!)

Post by Chief »

So i've been working on this game that requires "a lot" of physics bodies (and shapes) and when i hit a particular number (i think 30) i get this popup and love.exe shuts down:

Image

Any ideas on how fix this? (I would like a larger amount of bodies)
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Physics error (halp!)

Post by kikito »

30 objects seems a very feasible number.

Are all your objects created the same way?

Your problem could be not related with the number of objects created, but with how they are created.

I've seen before a forum post in which box2d complained like this; what happened in that case was that the created objects were either impossible or just too small (a circle with radius 0 or a polygon with an area of less than 3 units, if I remember correctly).

If you have several ways of creating objects, try "deactivating" some of them until you detect the one that makes box2d go puff.
When I write def I mean function.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Physics error (halp!)

Post by bartbes »

I think it might be that there are too many collisions.
User avatar
Chief
Party member
Posts: 101
Joined: Fri Mar 12, 2010 7:57 am
Location: Norway, 67° north

Re: Physics error (halp!)

Post by Chief »

bartbes wrote:I think it might be that there are too many collisions.
That might be possible! My bodies are 32x32 blocks stuck together in a grid. That might be the problem, seems I have to make some space between them.
User avatar
Chief
Party member
Posts: 101
Joined: Fri Mar 12, 2010 7:57 am
Location: Norway, 67° north

Re: Physics error (halp!)

Post by Chief »

Update:

Okey, I've done a new test where I have not made collisions between the bodies ( i am monitoring it with the collision callbacks), but the error keeps coming.

Any other suggestions?

Ps. The program keeps running at the same amount of memory (17 000 kb), so nothing is stealing the memory.

EDIT:
I think i fixed, i basically put the bodies which doesn't do much to "sleep".

Stress test: (white lines = bodies)
Image
User avatar
The Burrito
Party member
Posts: 153
Joined: Mon Sep 21, 2009 12:14 am
Contact:

Re: Physics error (halp!)

Post by The Burrito »

Pairs are something like collisions (from what I understand), theres a limit to how many it will create simultaneously, the pop up error is it reaching the limit. Pairs are created any time 2 objects overlap, so I guess your grid of boxes just makes a lot of them (perfect alignment would probably create 8 for each box in the middle of others), I'm not sure how you plan on using this grid of boxes, but theres a lot of tricks that may make it work better.

Theres a limit to the number of shapes you can have at a given time (I think its in the 150-200 range) but there doesn't seam to be a limit on bodies.

Oh yeah, and usually if you click ignore enough times box2d will work through the errors.
User avatar
Chief
Party member
Posts: 101
Joined: Fri Mar 12, 2010 7:57 am
Location: Norway, 67° north

Re: Physics error (halp!)

Post by Chief »

The Burrito wrote: Theres a limit to the number of shapes you can have at a given time
Are you sure about that? In the picture there are 600 shapes and bodies, and didn't even make it laggy
User avatar
The Burrito
Party member
Posts: 153
Joined: Mon Sep 21, 2009 12:14 am
Contact:

Re: Physics error (halp!)

Post by The Burrito »

my mistake, its at around 1200 shapes that I get errors, not 200. (I can math!)
User avatar
Deecodeuh
Citizen
Posts: 70
Joined: Tue Dec 15, 2009 3:18 am
Location: Michigan, USA

Re: Physics error (halp!)

Post by Deecodeuh »

I've had this problem in Lovely Mario Brothers. It's too many objects colliding in one space.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 8 guests