Hubbry Logo
Box2DBox2DMain
Open search
Box2D
Community hub
Box2D
logo
8 pages, 0 posts
0 subscribers
Be the first to start a discussion here.
Be the first to start a discussion here.
Box2D
Box2D
from Wikipedia

Box2D
DeveloperErin Catto
Initial releaseSeptember 11, 2007 (2007-09-11)
Stable release
3.1.1 Edit this on Wikidata / June 4, 2025; 4 months ago (June 4, 2025)[1]
Repository
Written inC
Operating systemOS independent
TypeMiddleware
LicenseMIT (since version 2.4.0)[2]
zlib License
Websitewww.box2d.org

Box2D is a free open source 2-dimensional physics simulator engine written in C by Erin Catto and published under the MIT license. It has been used in Crayon Physics Deluxe, Limbo, Rolando, Incredibots, Angry Birds, Tiny Wings, Shovel Knight, Transformice, Happy Wheels,[3] and many online Flash games,[4] as well as iPhone, iPad and Android games using the Cocos2d or Moscrif game engine and Corona framework. It has also been used in the Unity game engine.

History

[edit]

Box2D was first released as "Box2D Lite", a demonstration engine to accompany a physics presentation given by Erin Catto at GDC 2006. On September 11, 2007, it was released as open source on SourceForge. On January 17, 2010, Box 2D moved the project to Google Code for hosting.[5] On July 12, 2015, hosting was moved again, this time to GitHub.[6]

On March 6, 2008, version 2.0 was launched, introducing continuous collision detection and revamping the API.

On July 27, 2020, version 2.4 was launched, with a variety of changes, most notably the license was changed to the MIT License.[7]

Cross-platform availability

[edit]

Box2D is itself written in platform-independent C (usable on any system with a C compiler available). The engine may be compiled in fixed point and floating point modes, and has been used on the Nintendo DS, Wii, and several mobile phones (including Android, BlackBerry 10 and iOS) as well as most major operating systems.

The engine has been ported to many other programming languages and environments, including Java,[8] Adobe Flash (in ActionScript[9] and Haxe[10] languages), C#,[11] Lua, JavaScript,[12][13] and D.[14] Bindings exist to use the compiled library from Python,[15] DarkBASIC and BBC BASIC.

On October 30, 2009, it was announced that Box2D was being integrated into the (now older) Torque 2D game engine.[16]

Programs that use the engine

[edit]

Features

[edit]

Box2D performs constrained rigid body simulation. It can simulate bodies composed of convex polygons, circles, and edge shapes. Bodies are joined with joints and acted upon by forces. The engine also applies gravity, friction, and restitution.

Box2D's collision detection and resolution system consists of three pieces: an incremental sweep and prune broad phase, a continuous collision detection unit, and a stable linear-time contact solver. These algorithms allow efficient simulations of fast bodies and large stacks without missing collisions or causing instabilities.[18]

[edit]

An earlier version of the Box2D engine, now known as Box2D Lite, was released primarily for educational purposes, based on a series of yearly Game Developers Conference presentations that Erin Catto has given. Box2D Lite uses many of the same algorithms as Box2D, but has a smaller feature set.

The Chipmunk physics engine (written in C)[19] and Phys2D (written in Java)[20] are both partially based on Box2D Lite. The physics engine used in SpriteKit for iOS and OS X uses Box2D internally.[21]

The LiquidFun physics engine is a fork of Box2D by Google,[22] which adds fluid simulation to the engine.

LibGDX uses a Java wrapper around native Box2D code written in C as its physics engine.[23]

Articles

[edit]

Itterheim and Wenderlich describe the usage of Box2D in the Cocos2d iPhone engine.[24][25] An article in the Adobe Edge newsletter discusses the use of Box2D in Flash games.[26]

See also

[edit]

References

[edit]
[edit]
Revisions and contributorsEdit on WikipediaRead on Wikipedia
from Grokipedia
Box2D is a free and open-source 2D designed for video games, enabling realistic simulation of object movements, collisions, and interactions within game worlds. Developed by Erin Catto, a physics programmer who has worked at studios including and , Box2D originated from Catto's presentations at the Game Developers Conference (GDC). It began with the 2005 GDC tutorial on "Iterative Dynamics" and evolved into the first public release, Box2D Lite, accompanying the 2006 GDC session on "Sequential Impulses." The full Box2D library expanded on these foundations, becoming a feature-rich tool for simulation, and is now maintained under the with its hosted on . The engine is implemented in portable C17, supporting platforms such as Windows, , and macOS, and is optimized for real-time performance in games using (meters-kilograms-seconds) for scales typically between 0.1 and 10 meters for dynamic objects. Key features include continuous , a robust solver for constraints and (such as revolute, prismatic, and distance joints), support for multiple shapes per body, , sensors, and the ability to manage independent simulation worlds. It also incorporates advanced techniques like multithreading and SIMD optimizations for efficiency, while providing tools for contact events, joint limits, and motors to facilitate complex procedural animations and physics-based . Box2D has been integrated into numerous game engines and titles, powering physics in acclaimed games such as Crayon Physics Deluxe and serving as the core engine for the series, where it handles projectile trajectories, destruction, and environmental interactions. Its popularity stems from its balance of accuracy, stability, and ease of use, making it a staple for 2D game development across indie and commercial projects, with ongoing updates as of version 3.1.1 (June 2025) to support modern hardware and programming practices.

History and Development

Origins and Initial Release

Box2D's development began with Erin Catto's presentation at the 2005 Game Developers Conference (GDC) on "Iterative Dynamics," which introduced foundational concepts for constraint-based physics simulations. Box2D was created by Catto, a software engineer at Crystal Dynamics who specialized in physics simulation for video games, including the engine for Tomb Raider: Legend. In 2006, Catto presented at the Game Developers Conference (GDC) on rigid body dynamics, introducing key concepts in constraint-based physics solvers to help game developers implement efficient simulations. Accompanying this GDC 2006 tutorial, Catto released Box2D Lite, a simplified 2D designed as a demonstration tool to illustrate sequential impulses for handling collisions, , stacking, and joints. The engine emphasized fast and robust physics with minimal code, allowing developers to experiment with realistic object interactions in a 2D environment without the overhead of full . The initial goals of Box2D centered on providing an accessible simulation framework for game developers, prioritizing stability in scenarios like object stacking and constraints over complex numerical methods, to enable realistic 2D physics in resource-constrained game environments. As an educational resource, Box2D Lite quickly saw early adoption in game prototypes, transitioning from a tutorial demo into a more comprehensive library by to support broader development needs. On September 10, 2007, Catto open-sourced the full Box2D project on under the zlib/libpng license, marking its evolution into a freely available tool for the game development community.

Version History and Major Updates

Box2D's version history reflects iterative enhancements in stability, performance, and usability, with major releases building on the foundational v2.0 introduced in as a full engine expansion from the earlier Lite demonstration. Version 2.3, released in November 2013, delivered key stability improvements, including refined and solver robustness to reduce simulation artifacts in complex scenarios. In 2010, v2.1 facilitated the project's migration to Code for improved collaboration and distribution. A significant licensing shift occurred with v2.4.0 in July 2020, transitioning from the to the more permissive , which broadened adoption by simplifying integration into diverse projects. This was followed by v2.4.1 in October 2020, which included bug fixes. The final v2 release, v2.4.2 in August 2024, incorporated minor optimizations while marking the end of the v2 lineage to pave the way for a comprehensive overhaul. The transition to v3.0 in August 2024 represented a complete rewrite, shifting from C++ to C for better portability and maintainability, alongside a simplified API that streamlined body and fixture management. This version improved solver efficiency through algorithmic refinements and overhauled continuous collision detection, replacing legacy methods with a hybrid speculative and time-of-impact approach for more reliable fast-moving object handling. Subsequent updates refined v3, with v3.1 in April 2025 addressing bugs from the initial rewrite, introducing enhanced joint types such as improved and wheel constraints, and adding support for custom SIMD instructions (/) to boost performance on modern hardware. Version 3.1.1, released in June 2025, included further bug fixes and minor adjustments for stability. These v3 updates yielded measurable performance gains, including a 20% in the core GJK collision , contributing to 20-30% faster overall simulations on average hardware in benchmark tests.

Technical Overview

Core Architecture

Box2D's core architecture centers on a rigid body simulation model that treats physical objects as with fixed shapes and constant mass distribution. Each body is defined by its position, linear and , , and , and can be classified as dynamic (affected by forces and collisions), static (immovable), or kinematic (position-controlled). The simulation world serves as the central container, managing a collection of bodies, handling time advancement, and orchestrating broad-phase to identify potential interactions efficiently. The constraint solver forms the heart of Box2D's dynamics, employing the Soft Step solver in version 3, which uses sub-stepping and soft constraints to resolve and position constraints arising from contacts and joints. This approach improves stability for high mass ratios, long chains, and large stacks compared to earlier versions. The solver operates in O(N time where N is the number of constraints, enabling stable simulations of complex interactions. Version 3 also introduces multithreading for broad-phase and contact solving, along with SIMD optimizations ( by default, optional AVX2) for enhanced performance on modern hardware. Time advancement in Box2D follows a discrete time-stepping loop with a fixed time step, commonly set to 1/60 seconds for 60 Hz simulations, to maintain and stability. It employs semi-implicit Euler integration, first updating velocities from accelerations (including and applied forces) and then positions from the new velocities, as expressed by the equations: vn+1=vn+Δtan\vec{v}_{n+1} = \vec{v}_n + \Delta t \cdot \vec{a}_n
Add your contribution
Related Hubs
User Avatar
No comments yet.