Box2D
{{Short description|Two-dimensional physics simulator engine}}
{{Use mdy dates|date=February 2021}}
{{Primary sources|date=January 2015}}
{{Infobox software
| name = Box2D
| logo = Box2D logo.svg
| logo caption = Current Box2D logo
| screenshot = File:Box2d-screenshot.png
| caption =
| collapsible = yes
| developer = Erin Catto
| released = {{Start date|2007|09|11}}
| latest_release_version = {{wikidata|property|edit|P348}}
| latest_release_date = {{Release date and age|{{wikidata|qualifier|mdy|P348|P577}}}}{{cite web|url=https://github.com/erincatto/box2d/releases/latest |title=Latest Release |author=Erin Catto|work=GitHub}}
| latest_preview_version =
| latest_preview_date =
| programming language = C
| operating_system = OS independent
| genre = Middleware
| license = MIT (since version 2.4.0){{cite web|url=https://github.com/erincatto/Box2D|title=Box2D on GitHub|website=GitHub |date=October 15, 2021}}
| website = {{URL|http://www.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,{{cite web|url=https://www.androidfantasy.com/play-happy-wheels-online/|title=Play Happy Wheels Online – AndroidFantasy|access-date=14 August 2015|archive-url=https://web.archive.org/web/20150905191437/http://www.androidfantasy.com/play-happy-wheels-online/|archive-date=5 September 2015|url-status=dead}} and many online Flash games,{{cite web|url=http://jayisgames.com/tag/box2d|title=Box2d Games at Jayisgames|publisher=Jayisgames}} 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
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.{{cite web|url=http://www.box2d.org/|archive-url=https://web.archive.org/web/20071023024616/http://www.box2d.org/|title=Box2D – Home|archive-date=23 October 2007|publisher=Box2D}} On July 12, 2015, hosting was moved again, this time to GitHub.{{cite web|url=http://box2d.org/2015/07/github-hosting/|title=GitHub Hosting {{!}} Box2D|website=box2d.org|language=en-US|access-date=2018-04-06|archive-date=April 6, 2018|archive-url=https://web.archive.org/web/20180406163934/http://box2d.org/2015/07/github-hosting/|url-status=dead}}
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.{{cite web|url=https://github.com/erincatto/box2d/releases/tag/v2.4.0|title=Release v2.4.0|website=github.com|language=en-US|access-date=2020-08-14}}
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,{{cite web|url=http://www.jbox2d.org/|title=JBox2D: A Java Physics Engine|publisher=JBox2D}} Adobe Flash (in ActionScript{{cite web|url=http://box2dflash.sourceforge.net/|title=AS3 Flash Physics Engine Box2DFlashAS3 2.0.1|publisher=Box2D}} and Haxe{{cite web|url=https://code.google.com/p/physaxe/|title=Google Code Archive – Long-term storage for Google Code Project Hosting.}} languages), C#,{{cite web|url=https://code.google.com/p/box2dx/|title=Google Code Archive – Long-term storage for Google Code Project Hosting.}} Lua, JavaScript,{{cite web|url=http://box2d-js.sourceforge.net/|title=Box2DJS|publisher=Box2D}}{{cite web|url=https://code.google.com/p/box2dweb/|title=GitHub – hecht-software/box2dweb: Automatically exported from code.google.com/p/box2dweb|work=GitHub|date=September 16, 2021}} and D.{{cite web|url=http://www.dsource.org/projects/blaze|title=blaze|publisher=Dsource}} Bindings exist to use the compiled library from Python,{{cite web|url=https://github.com/pybox2d/pybox2d|title=Pybox2d/pybox2d: 2D Game Physics for Python|publisher=GitHub|access-date=February 19, 2016}} DarkBASIC and BBC BASIC.
On October 30, 2009, it was announced that Box2D was being integrated into the (now older) Torque 2D game engine.{{cite web|url=http://www.garagegames.com/community/blogs/view/18641|title=Torque 2D Development Blog – Box2D Overview|last=Perry|first=Michael|date=October 30, 2009|publisher=garagegames.com|access-date=February 26, 2016}}
Programs that use the engine
- [http://bbcbasic.uk/ 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{{Cite web|url=https://love2d.org/wiki/love.physics|title=Love.physics - LOVE}}
- Solar2D
- Clickteam Fusion 2.5
- [https://docs.flame-engine.org/1.0.0/index.html 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.{{cite web|url=http://www.box2d.org/manual.html|title=Chapter 1 Introduction|publisher=Box2D|url-status=dead|archive-url=https://web.archive.org/web/20090327033117/http://www.box2d.org/manual.html|archive-date=2009-03-27}}
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){{cite web|url=https://code.google.com/p/chipmunk-physics/|title=Google Code Archive – Long-term storage for Google Code Project Hosting.}} and Phys2D (written in Java){{cite web|url=http://www.cokeandcode.com/phys2d/|title=Index of /phys2d|publisher=Coke and Code}} are both partially based on Box2D Lite.
The physics engine used in SpriteKit for iOS and OS X uses Box2D internally.{{cite web|url=https://ghostbin.com/paste/tm4ko|archive-url=https://archive.today/20130727105340/https://ghostbin.com/paste/tm4ko|url-status=dead|archive-date=2013-07-27|title=tm4ko – Ghostbin|publisher=Ghostbin}}
The LiquidFun physics engine is a fork of Box2D by Google,{{Cite web|url=https://google.github.io/liquidfun/|title=LiquidFun|website=google.github.io|access-date=2017-03-12}} which adds fluid simulation to the engine.
LibGDX uses a Java wrapper around native Box2D code written in C as its physics engine.{{Cite web|url=https://github.com/libgdx/libgdx/wiki/Physics|title=Physics · libgdx/Libgdx Wiki|website=GitHub }}
Articles
Itterheim and Wenderlich describe the usage of Box2D in the Cocos2d iPhone engine.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. An article in the Adobe Edge newsletter discusses the use of Box2D in Flash games.{{cite web|url=https://www.adobe.com/newsletters/edge/april2010/articles/article7/|title=Adobe Edge: April 2010 – Developing physics-based games with Adobe Flash Professional|publisher=Adobe|access-date=2016-07-19|archive-url=https://web.archive.org/web/20110811061010/http://www.adobe.com/newsletters/edge/april2010/articles/article7/|archive-date=2011-08-11|url-status=dead}}
See also
{{Portal|Free and open-source software}}
References
{{Reflist|30em}}
External links
- {{Official website|http://www.box2d.org/}}
{{Video game engines}}
{{Physics engines}}
Category:Computer physics engines