Latest update - growable broadphases

Just a quick note to say the latest patch to the flash version is to provided a growable broadphase. You need never worry about "proxies" and "pairs" again, these used to cause no end of confusion when you suddenly hit the limits.
It ought to provide better performance, too, but I haven't checked. Careful when benchmarking though, as it doesn't create internal objects up front any more, meaning the per CreateShape cost can be higher than it used to be.

This is the first change which changes the flash port away from a strict mirror of the C++. Unless anyone objects, I think the general plan is to slowly introduce such changes to increase performance and make the engine fit closer to what an AS3 coder expects.
no objection from me.

thanks for making those "'proxies' and 'pairs'" simpler, I'm sure it will save me troubles with out me ever realizing it. 😀
Man you 2 are crazy, its like i walked into a room of alien dialects! Broadphases, pairs, proxies??

I have a long way to go.

I think that breaking away from the mirror is a good idea. I am not confident enough to contribute here much but i feel that for me, as a junior developer, only good can come of taking an already excellent library and making it more native to Flash (and me).

What is happening with box2d now in terms of development for C++? Will it remain at 2.0.2 for a while yet? Is there a 3.0.0 planned? etc?

EDIT http://www.box2d.org/wiki/index.php?tit ... rsion_3.2B
I just did a quick diff on my working copy to see what's changed. Maybe I haven't updated in a while but it looks like this is new as well:

1. Edge shapes.
2. Line joints.

Not sure what line joints are but they sound interesting. Anyone care to give an overview?

I was disappointed to see the contact listener functionality hasn't been touched, even though it's been discussed so much. Every time I update I manually make these changes:

1. Contact events also pass as a parameter the b2Contact.
2. b2Contacts are "disable-able" (using the sensor flag).
I appreciate the updates boris, and as others have said I can't see many problems in having slightly different versions for each platform personally.

I would say that I am getting some errors with this update though. When adding / removing bodies the following error is kicked up. Can't figure out why yet and it may be my fault, although I had no problems in the previous version ( 2.0.1)
Code:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
   at Box2D.Collision::b2BroadPhase/Query()[...\Box2D\Collision\b2BroadPhase.as:991]
Good news on the update, not that the AS version of box2D isnt working great already!

Although I did plug the new source into a game i'm creating and it wasn't happy. I spent a few hours trying to tidy up but gave in. I think you guys have been far stricter on what you can get away with this time. (ie having to use getters and setters for variables instead of public access).

I look forward to integrating it into my future projects.

AFG
Yes, we are being stricter, this matches a similar change in Box2D. It's important because it allows changes under the hood without breaking code (after you fix what breaks now :z), which I hope to see more of.

db82: It's likely there are bugs - I've learnt that it's easier to dump buggy code in the repository to force feedback than it is to ask for it. Could you produce a testbed example exhibiting the problem, I'll work from there to isolate where things have gone wrong.
Will do soon as I get time. Hopefully this weekend. Cheers boris
I'm getting this same error. Frustratingly, I can't reproduce it in the TestBed. This is where the error occurs in b2BroadPhase (line 978):

Code:
      // Hard case: lowerIndex(i) < lowerQuery < upperIndex(i)
      // Solution: use the stabbing count to search down the bound array.
      if (lowerQuery > 0)
      {
         var i:int = lowerQuery - 1;
         bound = bounds[i];
         var s:int = bound.stabbingCount;
         
         // Find the s overlaps.
         while (s)
         {
            //b2Settings.b2Assert(i >= 0);
            bound = bounds[i];
            if (bound.IsLower())
            {
               var proxy:b2Proxy = bound.proxy;
               if (lowerQuery <= proxy.upperBounds[axis])
               {
                  IncrementOverlapCount(bound.proxy);
                  --s;
               }
            }
            --i;
         }
      }


It blows up when i == -1 and it tries to access bounds[-1]. Tried just exiting the loop when i == -1 but then it blows up later...
Unfortunately, it's not helpful to know where the error is in this case. The broadphase must have got in an invalid state, and that could have occurred anywhere.

Original thread: https://box2d.org/forum/viewtopic.php?t=2783