github.com/mtsamis/box2d-optimized ↗
A very fast and scalable physics engine, based on Box2D.
Open this visualization on its own page →
Contributors
4
Lines of Code
1,285
From
2020-01-16
To
2021-01-01
About mtsamis/box2d-optimized
Box2D-optimized is a performance-focused fork of Box2D, the widely-used open-source 2D physics engine for games. The project maintains API and feature compatibility with the original while implementing various under-the-hood optimizations to achieve significant speedup and improved scalability. The optimizations are detailed in the author's dissertation, and comparative benchmarks are available in a separate repository.
The library includes comprehensive physics capabilities such as continuous collision detection, multiple joint types, stable stacking with a linear-time solver, and contact callbacks. It provides collision features including convex polygon and circle support, dynamic tree broadphase acceleration, and efficient pair management. The system design emphasizes portability with a custom C++ implementation that avoids STL containers, using instead block and stack allocators.
The project is now considered obsolete, as the original Box2D author Erin Catto has released Box2D v3 with its own performance improvements. Box2D-optimized includes a testbed built with OpenGL, GLFW, and imgui for visualization and testing, and can be built using CMake on Windows, macOS, and other platforms. The code is released under the MIT license.