HOME

TheInfoList



OR:

Box2D is a free
open source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use the source code, design documents, or content of the product. The open-source model is a decentralized sof ...
2-dimensional In mathematics, a plane is a Euclidean (flat), two- dimensional surface that extends indefinitely. A plane is the two-dimensional analogue of a point (zero dimensions), a line (one dimension) and three-dimensional space. Planes can arise as ...
physics simulator
engine An engine or motor is a machine designed to convert one or more forms of energy into mechanical energy. Available energy sources include potential energy (e.g. energy of the Earth's gravitational field as exploited in hydroelectric power ...
written in C++ by Erin Catto and published under the
MIT license The MIT License is a permissive free software license originating at the Massachusetts Institute of Technology (MIT) in the late 1980s. As a permissive license, it puts only very limited restriction on reuse and has, therefore, high license co ...
. It has been used in '' Crayon Physics Deluxe'', ''
Limbo In Catholic theology, Limbo (Latin ''limbus'', edge or boundary, referring to the edge of Hell) is the afterlife condition of those who die in original sin without being assigned to the Hell of the Damned. Medieval theologians of Western Europ ...
'', ''
Rolando Rolando may refer to: Entertainment *'' Rolando'', a 2008 puzzle-adventure video game *'' Rolando 2: Quest for the Golden Orchid'', a 2009 puzzle-adventure video game *"Rolando", a song by Roland Kirk from the album ''Domino'' People *Rolando (gi ...
'', '' Incredibots'', ''
Angry Birds ''Angry Birds'' is a Finnish action-based media franchise created by Rovio Entertainment. The game series focuses on the eponymous flock of angry birds who try to save their eggs from green-colored pigs. Inspired by the game '' Crush the Castl ...
'', '' Tiny Wings'', ''
Shovel Knight ''Shovel Knight'' is a platform video game developed and published by Yacht Club Games. Development was crowdfunded and the game was released for Nintendo 3DS, Wii U, and Windows in June 2014. It was ported to OS X and Linux in September 2014, P ...
'', ''
Transformice ''Transformice'' (sometimes abbreviated to ''TFM'' or ''T4M'') is an online independent multiplayer free-to-play platform video game, created by French game designers, known by their aliases Melibellule and Tigrounette. Melibellule produces ...
'', ''
Happy Wheels ''Happy Wheels'' is a ragdoll physics-based platform browser game developed and published by Fancy Force. Created by video game designer Jim Bonacci in 2010, the game features several player characters, who use different, sometimes atypical, vehi ...
'', and many online Flash games, as well as iPhone, iPad and Android games using the Cocos2d or Moscrif game engine and Corona framework.


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 SourceForge is a web service that offers software consumers a centralized online location to control and manage open-source software projects and research business software. It provides source code repository hosting, bug tracking, mirrori ...
. On January 17, 2010, Box 2D moved the project to
Google Code Google Developers (previously Google Code) , application programming interfaces (APIs), and technical resources. The site contains documentation on using Google developer tools and APIs—including discussion groups and blogs for developers usi ...
for hosting. On July 12, 2015, hosting was moved again, this time to
GitHub GitHub, Inc. () is an Internet hosting service for software development and version control using Git. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, co ...
. On March 6, 2008, version 2.0 was launched, introducing
continuous collision detection Collision detection is the computational problem of detecting the intersection (Euclidean geometry), intersection of two or more objects. Collision detection is a classic issue of computational geometry and has applications in various computing ...
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 The MIT License is a permissive free software license originating at the Massachusetts Institute of Technology (MIT) in the late 1980s. As a permissive license, it puts only very limited restriction on reuse and has, therefore, high license co ...
.


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 In computing, floating-point arithmetic (FP) is arithmetic that represents real numbers approximately, using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. For example, 12.345 can be r ...
modes, and has been used on the Nintendo DS, Wii, and several mobile phones (including Android,
BlackBerry 10 BlackBerry 10 is a discontinued proprietary mobile operating system for the BlackBerry line of smartphones, both developed by BlackBerry Limited (formerly Research In Motion). BlackBerry 10 is based on QNX, a Unix-like operating system that was ...
and
iOS iOS (formerly iPhone OS) is a mobile operating system created and developed by Apple Inc. exclusively for its hardware. It is the operating system that powers many of the company's mobile devices, including the iPhone; the term also include ...
) as well as most major operating systems. The engine has been ported to many other programming languages and environments, including
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's mo ...
,
Adobe Flash Adobe Flash (formerly Macromedia Flash and FutureSplash) is a multimedia software platform used for production of animations, rich web applications, desktop applications, mobile apps, mobile games, and embedded web browser video players. Fla ...
(in
ActionScript ActionScript is an object-oriented programming language originally developed by Macromedia Inc. (later acquired by Adobe). It is influenced by HyperTalk, the scripting language for HyperCard. It is now an implementation of ECMAScript (meani ...
and
Haxe Haxe is an open source high-level cross-platform programming language and compiler that can produce applications and source code, for many different computing platforms from one code-base. It is free and open-source software, released under the ...
languages), C#,
Lua Lua or LUA may refer to: Science and technology * Lua (programming language) * Latvia University of Agriculture * Last universal ancestor, in evolution Ethnicity and language * Lua people, of Laos * Lawa people, of Thailand sometimes referred t ...
,
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
, and D. Bindings exist to use the compiled library from Python,
DarkBASIC The Game Creators Ltd (TGC; formerly Dark Basic Software Limited) is a British software house based in Macclesfield, Cheshire, England, which specialises in software for video game development, originally for the Microsoft Windows platform. ...
and
BBC BASIC BBC BASIC is a version of the BASIC programming language released in 1981 as the native programming language for the BBC Micro home/personal computer, providing a standardized language for a UK computer literacy project of the BBC. It was wr ...
. 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 BBC BASIC is a version of the BASIC programming language released in 1981 as the native programming language for the BBC Micro home/personal computer, providing a standardized language for a UK computer literacy project of the BBC. It was wr ...
* BlitzBasic * GameMaker: Studio, uses the engine for physics simulation. * LibGDX, uses the physics engine for games and lighting. *
Stencyl Stencyl is a video game development tool that allows users to create 2D video games for computers, mobile devices, and the web. The software is available for free, with select publishing options available for purchase. The software was originally ...
, uses the physics engine for games, and allows export to Flash and iOS. *
Unity Unity may refer to: Buildings * Unity Building, Oregon, Illinois, US; a historic building * Unity Building (Chicago), Illinois, US; a skyscraper * Unity Buildings, Liverpool, UK; two buildings in England * Unity Chapel, Wyoming, Wisconsin, US; a ...
* Construct2 * LÖVE, uses the physics engine for games * Solar2D * Clickteam Fusion 2.5
Flame
Flutter Flutter may refer to: Technology * Aeroelastic flutter, a rapid self-feeding motion, potentially destructive, that is excited by aerodynamic forces in aircraft and bridges * Flutter (American company), a gesture recognition technology company acqu ...
game engine


Features

Box2D performs constrained
rigid body In physics, a rigid body (also known as a rigid object) is a solid body in which deformation is zero or so small it can be neglected. The distance between any two given points on a rigid body remains constant in time regardless of external fo ...
simulation. It can simulate bodies composed of
convex polygon In geometry, a convex polygon is a polygon that is the boundary of a convex set. This means that the line segment between two points of the polygon is contained in the union of the interior and the boundary of the polygon. In particular, it is a ...
s,
circle A circle is a shape consisting of all points in a plane that are at a given distance from a given point, the centre. Equivalently, it is the curve traced out by a point that moves in a plane so that its distance from a given point is const ...
s, and edge shapes. Bodies are joined with
joints A joint or articulation (or articular surface) is the connection made between bones, ossicles, or other hard structures in the body which link an animal's skeletal system into a functional whole.Saladin, Ken. Anatomy & Physiology. 7th ed. McGraw- ...
and acted upon by
force In physics, a force is an influence that can change the motion of an object. A force can cause an object with mass to change its velocity (e.g. moving from a state of rest), i.e., to accelerate. Force can also be described intuitively as a ...
s. The engine also applies
gravity In physics, gravity () is a fundamental interaction which causes mutual attraction between all things with mass or energy. Gravity is, by far, the weakest of the four fundamental interactions, approximately 1038 times weaker than the str ...
,
friction Friction is the force resisting the relative motion of solid surfaces, fluid layers, and material elements sliding (motion), sliding against each other. There are several types of friction: *Dry friction is a force that opposes the relative la ...
, and
restitution The law of restitution is the law of gains-based recovery, in which a court orders the defendant to ''give up'' their gains to the claimant. It should be contrasted with the law of compensation, the law of loss-based recovery, in which a court ...
. Box2D's collision detection and resolution system consists of three pieces: an incremental
sweep and prune In physical simulations, sweep and prune is a broad phase algorithm used during collision detection to limit the number of pairs of solids that need to be checked for collision, i.e. intersection. This is achieved by sorting the starts (lower bou ...
broad phase, a
continuous collision detection Collision detection is the computational problem of detecting the intersection (Euclidean geometry), intersection of two or more objects. Collision detection is a classic issue of computational geometry and has applications in various computing ...
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 The Game Developers Conference (GDC) is an annual conference for video game developers. The event includes an expo, networking events, and awards shows like the Game Developers Choice Awards and Independent Games Festival, and a variety of tuto ...
presentations that Erin Catto has given. Box2D Lite uses many of the same algorithms as Box2D, but has a smaller feature set. The
Chipmunk Chipmunks are small, striped rodents of the family Sciuridae. Chipmunks are found in North America, with the exception of the Siberian chipmunk which is found primarily in Asia. Taxonomy and systematics Chipmunks may be classified either as ...
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 Google LLC () is an American Multinational corporation, multinational technology company focusing on Search Engine, search engine technology, online advertising, cloud computing, software, computer software, quantum computing, e-commerce, ar ...
, which adds
fluid simulation Fluid animation refers to computer graphics techniques for generating realistic animations of fluids such as water and smoke. Fluid animations are typically focused on emulating the qualitative visual behavior of a fluid, with less emphasis plac ...
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

* {{Physics engines 2006 software Computer physics engines Software using the zlib license Software using the MIT license