JBox2D Testbed Update + Serialization

So I’ve noticed two major issues people have with jbox2d:

  1. Getting the engine running
  2. Debugging strange behavior

The first issue usually comes from trouble with surrounding application, where graphics isn’t quite right or the engine isn’t getting initialized/updated correctly.  The second issue comes both from with the slightly steep learning curve of the Box2D API, and the finicky nature of physics engines in general.  A good way to solve both of these is a simple platform which provides all of the application and graphics layers so you can test and experiment with just physics code.

The jbox2d testbed is meant to solve this problem, but it hasn’t been too developer-friendly in the past.   So I’ve just given it an upgrade!

The current features now include:

  • controllable run loop
  • easy input support
  • serialization (saving/loading)
  • expandable ui settings
  • simple automatic drawing with j2d
  • all in a multi-platform java swing application

Check out the wiki page for implementation info, and check out the current tests here for example.  Also, keep in mind the testbed is not intended for commercial use, and it might be subject to changes in the future.

Next, you may have notices the “Save” and “Load” buttons in the testbed.  This is because I’ve added world serialization!  Currently the supported format is Protocol Buffers (quick and tiny serialization), and the framework is extendable for more formats.  Hooray!