I spent a night porting my 2.02 code to 2.1 - I tore 2.02 up turning all the static bodies into kinematic bodies for my purposes, and I was happy to update to a version that actually supported what I wanted to do. Looking at the code, it seemed a lot cleaner too.
Sadly, I'm still stuck with 2.02 for now. After a night of porting, I finally got the game to compile and noticed severe slow down when I flooded the stage with some 100 to 150 circular dynamic bodies - way slower than 2.02. I thought it might be my contact listeners, but taking them out, the slow down remained.
2.1 is awash with great features, and I'm very happy to see raycast and buoyancy especially. But it seems like the math of 2.1 is less efficient that 2.02 under high stress.
I'm not familiar with Erin's work on the original, or the Alchemy port - is this slowdown specific to Flash, specific to AS3, or just a general 2.1 problem? Has anyone done any benchmarking?
Hmm. This is an alpha, so I am expecting things to be slower. I'd be very interested if you could try the following things for me, and see which ones help, as I don't have time for benchmarking myself:
1) Try using the Flash 9 (Arrays) release. Vectors haven't shown the improvement as I'd have thought, for some reason.
2) Disable continuous physics, if you have it on. These code paths are VERY unoptimized compared with the normal case, at the moment.
3) Use the old broadphase. I.e. call myWorld.SetBroadphase(new b2Broadphase(aabb)).
You can also try the Alchemy port. It is faster.
Boris great work, i already posted on your blog about the TOI issue for the bullet simulation its nice to see that you solved it. I did a couple of tests and works fine now 🙂
About the slowdown comparing to 2.02 that i mentioned its not so apparent when using the Flash9 version so it seems that indeed the vectors are the issue. Spammed 120 balls in my breakout test game where all of them are bullet bodies and no slowdown at all with the F9 version 😀
Hey, thanks for the port. It all looks fantastic! I'm trying to integrate it with a minimalistic game engine already.
Just one quick thought. Are you going to release two versions, one for Flash Player 9, and one for 10? Because in some cases people might want to develop under Flash CS3. I notice that you've used the new Vector class in the 2.1a port, which will be a problem with people sticking to Flash CS3.
Thanks again for all your effort on the port!
I'm having a lot of issues with bullet objects going right through walls. I know this has been mentioned before but I thought it had been corrected. Can anyone else verify that this is still an issue?
Edit: This occurs with both the Flash 9 & 10 versions.
I've been testing the 2.1a release more and my dynamic objects keep moving through static objects. I've attached a screenshot illustrating a dynamic ball set as bullet moving through a static polygon. Usually the ball will be inside the polygon for one frame until the engine corrects for it. Sometimes the ball is able to move completely through the polygon completely within one frame. This appears to be a major bug in this release.
I'm not sure if this is a bug. But the restitution value of a fixture with a circle shape seems to act pretty differently from fixtures with other shapes.
Supposedly, when two fixtures with zero restitution values collide, they do not "bounce off" in the normal direction. However, I found that if one of the fixture has a circle shape, even with zero restitution value, the two fixtures would bounce off against each other.
I have tried many times, and this phenomenon keeps occurring. Simply by swapping the circle shape with any other types of shape immediately eliminates this problem.
Any suggestion or solution?