ArticleslgStudy

computer science

Box2D

Box2D is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Box2D rather than just read about it. In short: Box2D is a free and open-source 2D physics simulation game 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, Noita, and many online Flash games, as well as Android and iOS games using the Cocos2d or Moscrif game engine and Solar2D framework.

Box2D — main illustration
Box2D — illustration

Key takeaways

  • Box2D belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Box2D to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Box2D from memory before moving on to harder problems.

Reference excerpt

Box2D is a free and open-source 2D physics simulation game 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, Noita, and many online Flash games, as well as Android and iOS games using the Cocos2d or Moscrif game engine and Solar2D framework. It has also been used in the Unity game engine and is available as an extension for the Scratch-based programming languages TurboWarp (in its Extension Gallery website) and PenguinMod (built-in extension).

History 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. On July 12, 2015, hosting was moved again, this time to GitHub. 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. On Aug 12, 2024, version 3.0 was launched, rewriting the library entirely in C, overhauling the API, increasing single and multi-threaded performance, and changing to a more stable physics solver. On Jun 29, 2026, the new 3D physics engine "Box3D" was announced on the Box2D website.

Cross-platform availability 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, Adobe Flash (in ActionScript and Haxe languages), C#, Lua, JavaScript, and D. Bindings exist to use the compiled library from Python, DarkBASIC and BBC BASIC. On October 30, 2009, it was announced that Box2D was being integrated into the (now older) Torque 2D game engine.

Programs that use the engine BBC Basic for SDL, cross-platform version of BBC Basic BlitzBasic GameMaker: Studio, uses the engine for physics simulation. LibGDX, uses the physics engine for games and lighting. Stencyl, uses the physics engine for games, and allows export to Flash and iOS. Unity Construct2 LÖVE, uses the physics engine for games Solar2D Clickteam Fusion 2.5 Flame, Flutter game engine

Features 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.

Related engines 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) and Phys2D (written in Java) are both partially based on Box2D Lite. The physics engine used in SpriteKit for iOS and OS X uses Box2D internally. The LiquidFun physics engine is a fork of Box2D by Google, which adds fluid simulation to the engine. LibGDX uses a Java wrapper around native Box2D code written in C as its physics engine.

Articles Itterheim and Wenderlich describe the usage of Box2D in the Cocos2d iPhone engine. An article in the Adobe Edge newsletter discusses the use of Box2D in Flash games.

See also

Chipmunk (software)

References

External links Official website

Illustrations

Box2D illustration
Box2D: Box2D screenshot
Box2D screenshot

Worked examples

Example 1 — a first encounter with Box2D

Start with the simplest possible case. Write down what Box2D claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Box2D before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Box2D ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Box2D

In research
Box2D appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Box2D in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Box2D is common in secondary-school and first-year university syllabi. It links to neighbouring topics 2006 software, Computer physics engines, Software using the MIT license, so understanding it makes those chapters shorter.
In everyday life
Look for Box2D outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Box2D” →

How to study Box2D in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Box2D means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Box2D out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Box2D in simple terms?

Box2D is a free and open-source 2D physics simulation game 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, Noita, and many online Flash…

Why does Box2D matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Box2D?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Box2D.

Tags

  • 2006 software
  • Computer physics engines
  • Software using the MIT license
  • Software using the zlib license

Keep exploring