I created a mechanism for drawing custom polygon shapes in the level editor. These shapes can be used to draw boundaries. Unfortunately because they’re created as Box2D polygons they must meet these requirements:
1. Must be convex. Concave shapes are not allowed. However concave shapes can be simulated by using multiple polygons.
2. Must be drawn clockwise. I don’t really get why this must be done, but hey, its not my rules.
3. Must not exceed 8 vertices.
I’m looking forward to creating some interesting maps!
-James
Just a small update. I fixed a problem with stacks of boxes becoming unstable when gravity was enabled. The problem was from having sleep disabled for box2d objects. Sleep needs to be enabled to simulate resting contact.
-James
I stayed up late and wrote code. Holding ‘B’ in the level editor draws collision boxes which create static Box2D shapes. These save and then load in-game and prevent Box2D objects from wedging between what would have been joins between touching tiles.
This removed a major glitch from the game (and Box2D engine?) allowing for a smoother game experience. Now I need to work out a few other Box2D related Moldering glitches.
-James
I’ve done a lot of work over the last couple of days rewriting buggy code. I scraped a lot of the in-game physics and brought in an external engine, merging it with the engine we already had. I don’t think the transition could have been any smoother, which is all any programmer could hope for.
The outside code is open source, so we aren’t limited in its uses. I used the Java version of Box2d, “JBox2D” and created a scaled down version of each map which now contains all of the ‘non-player’ physics objects. I also managed seamless interaction between the player and physics objects.
I’ll be posting a video in the next couple of days demonstrating some of the basic capabilities in an interesting sandbox level. So, check back for an update.
-James