Physics Collapse!

For questions about using Classic.

Post » Sat Sep 20, 2008 12:02 pm

I was just messing around after I saw the "liquid" demo... thinking to myself "That is a shite load of code to make something happen... why didn't he just use physics objects?".

So that's what I did.

Works great until you start to "fill" the bucket up (around 2500 objects or so should do it). Try and see what happens.... it collapses in on itself and crashes :/

linky: http://www.fileden.com/files/2007/8/21/ ... llapse.cap

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Sat Sep 20, 2008 12:54 pm

Changing the collison mask from bounding box to ellipse makes it work a lot better... however I am determined to break it again, so I made "right click to drop a heavy object" in the code there, and this large ball with more mass comes crashing through the smaller box objects sending them flying all over the place quite nicely. This is fine until, again, there are lots of ojects and it crashes.

I used the debug window and it gave me this error:

A crash inside a plugin's non-event code has been intercepted! This may be a bug in the plugin or a problem in Construct. The application has exited.
Plugin- Physics.csx
Object Name- movement_3_2
Instance ID- 0 (of 4)

Will see if I can make it work, then make it break again.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Sun Sep 21, 2008 3:00 pm

It definitely shouldn't crash. But the important thing with a Physics engine is due to the limited precision of computers, and shortcuts taken for speed, there are boundaries on reasonable use and stability. If you use the physics engine in a manner which is realistic, it should be stable, but if you try colliding something with the mass of a planet in to something with the mass of a speck of dust, you can't expect a realistic result. Collapsing may be because you've hit some limit of the Box2D engine - it's probably not designed for such complex simulations.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Post » Sun Sep 21, 2008 6:22 pm

i've had the physics crash a few times, too. if you end up with too many particles applying force toward one another, they'll eventually cave in and you get an error.
B
2
S
2
G
4
Posts: 254
Reputation: 1,958

Post » Sun Sep 21, 2008 9:33 pm

this also happens when 2 many objects are intersecting, and the cpu cant perform the resulting calculations, then it just lags out and freezes.

as you said ellipse helps fix this very well, as when you have a lot of objects,boxes tend to create very little spaces, like bricks, vs ellipse that when stacked still have space (like stacked tubes) that something can move into and fill, this is why a stack of tubes can roll off itself easily, but a stack of bircks cant.

imagine this stackability as, the harder it is for a shape to roll off itself, the harder it is on the cpu.
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Sun Sep 21, 2008 11:36 pm

Nice analogy Quazi... makes perfect sense when you think of it like that. I kinda figured the same thing after I discovered it is more stable with spherical collision masks since there is less touching surface area.

The only reason I tried this was to see exactly how far I could push the physics in an applicable situation, since I am wanting to experiment in making a test application similar to "Armadillo Run". I think the amount of objects that can be used is more than satisfactory for such an idea, though it kind of caught be by surprise when it crashed like that. I just expected it to either run really slow, or start missing collisions (IE objects falling through the floor or each other), or both...

If it's fixable in any way then that would be awesome, but if it's not then that's ok as well... I can't really see the need for 3000+ tiny physics objects on the screen at one time! Well, maybe I can, but I could live without it lol.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Mon Sep 22, 2008 10:50 pm

i think there should be a REALLY inacurate mode on colision finding, im not sure if his is possible, but sometimes you just want objects to know their colliding,but not do anything until they can, instead of affect objects alot, so that if the "tubes" intersect, its not at the high priority or even medium for them to move and push everything out of the way to make a space, only things which can easily move will move,but not have to be 2 percise about what theyre hitting or not, i think there should be an option for such a thing, like "dumb collision" finding. it would make fluid simulations (which i reallly need for a project) easier.
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Tue Sep 23, 2008 12:28 am

[quote="QuaziGNRLnose":hhdhqzk8]"dumb collision"[/quote:hhdhqzk8]

Yes, this would be awesome... this kind of collision could even allow physics objects to pass right through one another in order to find a "gap" to fit in to... this WOULD indeed make liquid dynamics using physics objects way easier and convincing to achieve.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Tue Sep 23, 2008 1:45 am

[quote="QuaziGNRLnose":3m1dopeu]dumb collisions... it would make fluid simulations (which i reallly need for a project) easier.[/quote:3m1dopeu]

I don't know how these "dumb collisions" would work, but yeah, fluid simulations seem like a remote possibility with the current physics system.

Click to drop a ball into the bucket... it stalls like crazy and this is only 400 objects.

http://www.fileshack.us/get_file.php?id ... =water.cap

Perhaps setting the water drops to "no collision" with everything but the walls of the bucket and manually coding a loop that simultaneously repels and attracts individual drops to one another would work (something like the gravity simulation going on in Help right now). You might be able to get them to spread out and fill a volume that way. As for making things float/sink and otherwise affect the flow of water you could code that behavior in with overlaps. Worth tinkering with anyway, because as it is now it the physics object is getting overwhelmed trying to calculate all those collisions at once.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Tue Sep 23, 2008 3:06 am

[quote="deadeye":3nu1b1kf]
Click to drop a ball into the bucket... it stalls like crazy and this is only 400 objects.

http://www.fileshack.us/get_file.php?id ... =water.cap[/quote:3nu1b1kf]
runs fine for me :P
B
2
S
2
G
4
Posts: 254
Reputation: 1,958

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests