Verlet Max speed test... and a weird bug?

Community Forums/Showcase/Verlet Max speed test... and a weird bug?

Nate the Great(Posted 2009) [#1]
Hi,

So I recently got down to buisness and finished my fixed grid algorithm for a very decent 250 percent speed up :) Here is a linky to a little demo to check out:

http://naillproductions.synthasite.com/resources/verletcount%20test.zip

Now down to the real reason behind this post:

After running the app for about 5 minutes as the blocks settle, sure there are some jitters but dont you notice there are always way more blocks on the left side than the right side. They continue to slide ever so slowly to the left until the simulation explodes. I use seedrnd(millisecs()) at the beginning of my program so the distribution should be even. Maybe it is due to rounding errors and the order I do my fixed grid collision checks in? Is this 'normal' for physics engines to do under stress tests like this one?


Oddball(Posted 2009) [#2]
Your simulation is gaining energy from somewhere. Without seeing the code I couldn't tell you where, but there are a few likely candidates. Using spring collisions is one possibility. In verlet intergration collision energy is transfered down the constraints. If you also use spring collisions then you add energy to the simulation from nowhere. Get a few bodies rubbing together and they will begin to resonate. Another similar cause could be an incorrect friction resolution. I remember the last code you posted used an incorrect friction formula. If you are still using that method then it could be the issue. Another thing to look out for is if bodies are changing grid cells during the collision relaxation phase. If they move into a cell that has already been flagged as finished then you may be missing collisions and errors could creep in. Hope these give you some insight into your problem.

As for the last question. I'd expect any passive physics simulation to eventually come to rest, no matter how many bodies are involved.


Nate the Great(Posted 2009) [#3]
ok I have a really bad error in the above test. I accidentally check collisions between all of the pointmasses at least 2 times but possibly more :p Im gunna check into that in a second to see if that is the cause of my problem.

Using spring collisions is one possibility


huh? what is a spring collision? I am working on correcting collisions and friction atm. :) which will also eliminate the jitters you see.

Another thing to look out for is if bodies are changing grid cells during the collision relaxation phase


not possible, as I check for collisions, I send all of the forces that push on each verlet to an array to retrieve and add up after all collisions have been checked.

well thanks for the help.


Nate the Great(Posted 2009) [#4]
also I noticed, if you leave the simulation running for 30 minutes, the update time may top 16.666 which will make it slow down to 30 fps :p could this be a memory leak?