Box2D

Last updated

Box2D
Developer(s) Erin Catto
Initial releaseSeptember 11, 2007 (2007-09-11)
Stable release
3.0.0  OOjs UI icon edit-ltr-progressive.svg / August 12, 2024;2 months ago (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.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.

Contents

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

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

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. [18]

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

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

Related Research Articles

<span class="mw-page-title-main">Blitz BASIC</span>

Blitz BASIC is the programming language dialect of the first Blitz compilers, devised by New Zealand–based developer Mark Sibly. Being derived from BASIC, Blitz syntax was designed to be easy to pick up for beginners first learning to program. The languages are game-programming oriented, but are often found general-purpose enough to be used for most types of application. The Blitz language evolved as new products were released, with recent incarnations offering support for more advanced programming techniques such as object-orientation and multithreading. This led to the languages losing their BASIC moniker in later years.

Irrlicht is an open-source game engine written in C++. It is cross-platform, officially running on Windows, macOS, Linux and Windows CE and due to its open nature ports to other systems are available, including FreeBSD, Xbox, PlayStation Portable, Symbian, iPhone, AmigaOS 4, Sailfish OS via a Qt/QML wrapper, and Google Native Client.

<span class="mw-page-title-main">Three Rings Design</span>

Three Rings Design, Inc. was an online game developer that was founded on March 30, 2001, by Daniel James and Michael Bayne. The company was named in honor of the Three Rings of the Elven-kings in Tolkien mythology.

<span class="mw-page-title-main">Bullet (software)</span> Open-source physics engine

Bullet is a physics engine which simulates collision detection as well as soft and rigid body dynamics. It has been used in video games and for visual effects in movies. Erwin Coumans, its main author, won a Scientific and Technical Academy Award for his work on Bullet. He worked for Sony Computer Entertainment US R&D from 2003 until 2010, for AMD until 2014, for Google until 2022 and he now works for Nvidia.

<span class="mw-page-title-main">Adobe AIR</span> Cross-platform runtime system for building rich web applications

Adobe AIR is a cross-platform runtime system currently developed by Harman International, in collaboration with Adobe Inc., for building desktop applications and mobile applications, programmed using Adobe Animate, ActionScript, and optionally Apache Flex. It was originally released in 2008. The runtime supports installable applications on Windows, macOS, and mobile operating systems, including Android, iOS, and BlackBerry Tablet OS.

<i>IncrediBots</i> 2008 video game

IncrediBots is a physics simulation game and series produced by Canadian studio Grubby Games and was later purchased by Big Fish Games. It uses the Box2D physics engine, which allows objects created in a simple click and drag fashion to interact realistically. Users can create basic geometric shapes such as triangles, rectangles, and circles, and then connect them together using different types of joints. The three basic kinds of joints are fixed joints, rotating joints, and sliding joints. Once combined with shapes, these joints form what are known as "'bots", "robots", or "IncrediBots". One other kind of joint, thrusters, are like rocket engines.

Chipmunk2D is a 2-dimensional real-time rigid body physics engine written by Scott Lembcke that is designed to be portable, lightweight, fast, and easy to use. Prior to version 7, two main versions of the library existed. Chipmunk2D Free was written purely in C99, and freely available under the terms of the MIT License. Chipmunk2D Pro was a proprietary upgrade designed for development on mobile devices. It included several high-level subroutines in Objective-C, and floating-point optimizations for the ARM processor. However, after version 7 the project was fully open-sourced.

Cocos2d is an open-source game development framework for creating 2D games and other graphical software for iOS, Android, Windows, macOS, Linux, HarmonyOS, OpenHarmony and web platforms. It is written in C++ and provides bindings for various programming languages, including C++, C#, Lua, and JavaScript. The framework offers a wide range of features, including physics, particle systems, skeletal animations, tile maps, and others.

<span class="mw-page-title-main">Away3D</span>

Away3D is an open-source platform for developing interactive 3D graphics for video games and applications, in Adobe Flash or HTML5. The platform consists of a 3D world editor, a 3D graphics engine, a 3D physics engine and a compressed 3D model file format (AWD).

Modern HTML5 has feature-parity with the now-obsolete Adobe Flash. Both include features for playing audio and video within web pages. Flash was specifically built to integrate vector graphics and light games in a web page, features that HTML5 also supports.

<span class="mw-page-title-main">Stencyl</span> Video game development software

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 called "StencylWorks" while in development and for the initial release but was later shortened to just "Stencyl".

<span class="mw-page-title-main">Chromium Embedded Framework</span> Free and open-source software framework

The Chromium Embedded Framework (CEF) is an open-source software framework for embedding a Chromium web browser within another application. This enables developers to add web browsing functionality to their application, as well as the ability to use HTML, CSS, and JavaScript to create the application's user interface.

libGDX is a free and open-source game-development application framework written in the Java programming language with some C and C++ components for performance dependent code. It allows for the development of desktop and mobile games by using the same code base. It is cross-platform, supporting Windows, Linux, macOS, Android, iOS, BlackBerry and web browsers with WebGL support.

<span class="mw-page-title-main">ORX</span> Game Engine

Orx is an open-source, portable, lightweight, plug-in-based, data-driven and easy to use 2D-oriented game engine written in C.

Stage3D is an Adobe Flash Player API for rendering interactive 3D graphics with GPU-acceleration, within Flash games and applications. Flash Player or AIR applications written in ActionScript 3 may use Stage3D to render 3D graphics, and such applications run natively on Windows, Mac OS X, Linux, Apple iOS and Google Android. Stage3D is similar in purpose and design to WebGL.

Crosswalk Project was an open-source web app runtime built with the latest releases of Chromium and Blink from Google. The project was founded by Intel's Open Source Technology Center in September 2013.

Cannon.js is an open source JavaScript 3D physics engine created by Stefan "schteppe" Hedman. Unlike physics engine libraries ported from C++ to JavaScript, cannon.js is written in JavaScript from the start and can take advantage of its features. In a 2013 comparison with Ammo.js, cannon.js was found to be "more compact, more comprehensible, more powerful with regard to its performance and also easier to understand", but did not have as many features.

FlatBuffers is a free software library implementing a serialization format similar to Protocol Buffers, Thrift, Apache Avro, SBE, and Cap'n Proto, primarily written by Wouter van Oortmerssen and open-sourced by Google. It supports “zero-copy” deserialization, so that accessing the serialized data does not require first copying it into a separate part of memory. This makes accessing data in these formats much faster than data in formats requiring more extensive processing, such as JSON, CSV, and in many cases Protocol Buffers. Compared to other serialization formats however, the handling of FlatBuffers requires usually more code, and some operations are not possible.

<span class="mw-page-title-main">Phaser (game framework)</span> Cross-platform JavaScript video game framework

Phaser is a 2D game framework used for making HTML5 games for desktop and mobile. It is free software developed by Photon Storm.

raylib Game programming library

Raylib is a cross-platform open-source software development library. The library was made to create graphical applications and games.

References

  1. Erin Catto. "Latest Release". GitHub.
  2. "Box2D on GitHub". GitHub . October 15, 2021.
  3. "Play Happy Wheels Online – AndroidFantasy". Archived from the original on September 5, 2015. Retrieved August 14, 2015.
  4. "Box2d Games at Jayisgames". Jayisgames.
  5. "Box2D – Home". Box2D. Archived from the original on October 23, 2007.
  6. "GitHub Hosting | Box2D". box2d.org. Archived from the original on April 6, 2018. Retrieved April 6, 2018.
  7. "Release v2.4.0". github.com. Retrieved August 14, 2020.
  8. "JBox2D: A Java Physics Engine". JBox2D.
  9. "AS3 Flash Physics Engine Box2DFlashAS3 2.0.1". Box2D.
  10. "Google Code Archive – Long-term storage for Google Code Project Hosting".
  11. "Google Code Archive – Long-term storage for Google Code Project Hosting".
  12. "Box2DJS". Box2D.
  13. "GitHub – hecht-software/box2dweb: Automatically exported from code.google.com/p/box2dweb". GitHub. September 16, 2021.
  14. "blaze". Dsource.
  15. "Pybox2d/pybox2d: 2D Game Physics for Python". GitHub . Retrieved February 19, 2016.
  16. Perry, Michael (October 30, 2009). "Torque 2D Development Blog – Box2D Overview". garagegames.com. Retrieved February 26, 2016.
  17. "Love.physics - LOVE".
  18. "Chapter 1 Introduction". Box2D. Archived from the original on March 27, 2009.
  19. "Google Code Archive – Long-term storage for Google Code Project Hosting".
  20. "Index of /phys2d". Coke and Code.
  21. "tm4ko – Ghostbin". Ghostbin. Archived from the original on July 27, 2013.
  22. "LiquidFun". google.github.io. Retrieved March 12, 2017.
  23. "Physics · libgdx/Libgdx Wiki". GitHub .
  24. Steffen Itterheim. (2010). "Learn iPhone and iPad cocos2d Game Development." Apress.
  25. Rod Strougo and Ray Wenderlich. (2011). "Learning Cocos2d: A Hands-On Guide to Building IOS Games with Cocos2d, Box2d, and Chipmunk." Addison-Wesley Professional.
  26. "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.