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).
Screenshot | |
Developer(s) | Erin Catto |
---|---|
Initial release | September 11, 2007 |
Stable release | 3.0.0
/ August 12, 2024[1] |
Repository | |
Written in | C |
Operating system | OS independent |
Type | Middleware |
License | MIT (since version 2.4.0)[2]
zlib License |
Website | www |
History
editBox2D 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
editBox2D 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- 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[17]
- Solar2D
- Clickteam Fusion 2.5
- Flame, Flutter game engine
Features
editBox2D 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]
Related engines
editAn 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
editItterheim 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
editReferences
edit- ^ Erin Catto. "Latest Release". GitHub.
- ^ "Box2D on GitHub". GitHub. October 15, 2021.
- ^ "Play Happy Wheels Online – AndroidFantasy". Archived from the original on September 5, 2015. Retrieved August 14, 2015.
- ^ "Box2d Games at Jayisgames". Jayisgames.
- ^ "Box2D – Home". Box2D. Archived from the original on October 23, 2007.
- ^ "GitHub Hosting | Box2D". box2d.org. Archived from the original on April 6, 2018. Retrieved April 6, 2018.
- ^ "Release v2.4.0". github.com. Retrieved August 14, 2020.
- ^ "JBox2D: A Java Physics Engine". JBox2D.
- ^ "AS3 Flash Physics Engine Box2DFlashAS3 2.0.1". Box2D.
- ^ "Google Code Archive – Long-term storage for Google Code Project Hosting".
- ^ "Google Code Archive – Long-term storage for Google Code Project Hosting".
- ^ "Box2DJS". Box2D.
- ^ "GitHub – hecht-software/box2dweb: Automatically exported from code.google.com/p/box2dweb". GitHub. September 16, 2021.
- ^ "blaze". Dsource.
- ^ "Pybox2d/pybox2d: 2D Game Physics for Python". GitHub. Retrieved February 19, 2016.
- ^ Perry, Michael (October 30, 2009). "Torque 2D Development Blog – Box2D Overview". garagegames.com. Retrieved February 26, 2016.
- ^ "Love.physics - LOVE".
- ^ "Chapter 1 Introduction". Box2D. Archived from the original on March 27, 2009.
- ^ "Google Code Archive – Long-term storage for Google Code Project Hosting".
- ^ "Index of /phys2d". Coke and Code.
- ^ "tm4ko – Ghostbin". Ghostbin. Archived from the original on July 27, 2013.
- ^ "LiquidFun". google.github.io. Retrieved March 12, 2017.
- ^ "Physics · libgdx/Libgdx Wiki". GitHub.
- ^ Steffen Itterheim. (2010). "Learn iPhone and iPad cocos2d Game Development." Apress.
- ^ Rod Strougo and Ray Wenderlich. (2011). "Learning Cocos2d: A Hands-On Guide to Building IOS Games with Cocos2d, Box2d, and Chipmunk." Addison-Wesley Professional.
- ^ "Adobe Edge: April 2010 – Developing physics-based games with Adobe Flash Professional". Adobe. Archived from the original on August 11, 2011. Retrieved July 19, 2016.