RocketHaxe 2.0: Tile Physics

Fresh new demo:

What’s new & cool about this one is that the green boxes are actually a tilemap, not objects in the same sense as the red boxes. This demo doesn’t use it, but there is some support for autotiling bitmaps, etc., and there’s a fair bit going on with the tile engine already. Bouncing off the screen edges is also using the same physics as the object collisions, whereas in the earlier demos the bounds just manipulated velocities and didn’t apply friction and position correction. So, the physics engine is now encompassing several different mechanisms for colliding different kinds of things. The internal structure of it has also matured quite a bit, the classes decompose pretty nicely now.

Along the way a few bugs have been found, and some improvements made. The previous demos actually have a bug whereby the collision normal for circles that have completely penetrated inside boxes was not being computed correctly if the boxes weren’t square, causing them to fly off in the wrong direction. Impulses are also now being computed & applied multiple times per update, so collisions travel back up stacks and such. On Linux it’s actually pretty stable, for the most part a stack needs to get fairly large or an object stuck in a tight space (just within the error tolerances) to see a lot of quiver. Flash is a lot more unstable and still has a fair bit of quiver, though it’s generally ok until you have 4+ objects stacked up. I’m not sure yet what the relevant difference is between the two platforms.

So, excitingly, “all” that’s left from here is to clean up the tile engine, port over the sprite animations and sound controls from RocketHaxe 1.0, and it’s all set for some fancy platformer-type games!