New physics simulation engine Box3D introduced

Erin Catto, the author of the Box2D project, announced the creation of a new physics simulation engine, Box3D, which is a fork of Box2D with an identical architecture, but redesigned and expanded for use in 3D games. The project's code is written in C and distributed under the MIT license. Compilation for Linux, Windows и macOS.

The Box3D engine was created during the development of the new 3D shooter The Legend of California at Kintsugiyama Studios, where Erin is working. The game uses the Unreal Engine, but the developers were dissatisfied with its built-in Chaos physics engine. Issues arose with the lack of gyroscopic torque (thin objects took an unnaturally long time to rotate), continuous collision detection (unrealistic behavior of falling trees), and poor performance when processing hundreds of thousands of objects.

Initially, the problems were planned to be solved by creating a fork of the Jolt physics engine. However, following the advice of the creator of the Rubikon engine used in Half-Life, a simplified version of Rubikon-Lite, developed as a hobby, was used as a basis. It was reworked using code and optimizations from Box2D to combine existing 3D capabilities with the developments of the Box2D engine. As a result, almost all APIs, data structures, and algorithms in Rubikon-Lite were replaced with code from Box2D, and only the algorithms for constructing the convex hull and handling 3D collisions remained from Rubikon-Lite. With the consent of the author of Rubikon-Lite and Kintsugiyama, it was decided to publish the resulting engine as a separate open-source project, Box3D.

The first release of Box3D 0.1 has now been published and is considered alpha-quality. The core functionality has been implemented, but documentation and testing are still required. In addition to The Legend of California, the new engine is already being used in the s&box gaming platform, the open-source Esoterica game engine, and the 1000-player multiplayer space game Space Game.

For 3D games, the new engine adds features such as collision calculations with polygonal meshes and heightmaps used in terrain generation, allowing for realistic tree-fall effects on voxel surfaces in The Legend of California. Support for baked composite collisions, composed of several simple shapes, has been added, significantly reducing resource consumption when simulating collisions between a large number of typical small objects.

Among the features previously available in Box2D that have been transferred to Box3D:

  • Continuous collision detection (processing object motion as a continuous trajectory), collision filtering, and event generation upon object contact. Support for spherical, capsule, and shell shapes for collision detection. A SIMD-optimized object collision handler.
  • Sub-stepping Solver to improve simulation accuracy by dividing simulation steps into several smaller steps.
  • Using graph coloring to handle large groups of related objects.
  • A character controller responsible for handling movement, collisions, and interactions between the character and surrounding objects.
  • Support for ray tracing, shape tracing, and intersection checking when scanning the surrounding space. A sensor system for detecting objects in space.
  • Soft Step Solver for calculating solid state physics with complex interactions.
  • Support for freezing the state of groups of inactive or static objects to save resources.
  • Support for a variety of connections and types of connections between objects, including hinges, springs, motors, welds, and wheels, with the ability to flexibly configure each connection. Calculation of compression and tension forces between objects.
  • Possibility of generating events when an object starts moving, stops, or stabilizes.
  • Hooks for multithreaded processing with an optional internal scheduler.
  • Using double type coordinates allows for the creation of huge worlds.
  • Cross-platform determinism ensures identical results on different hardware platforms.
  • Support for recording and playback of simulation.
  • C API and C code conforming to the C17 standard.

Future plans include expanding character movement capabilities, improving ghost collision prevention mechanisms, implementing optimizations, and improving the joint solver. The repository intends to allow community members to submit pull requests with changes after signing a code ownership agreement (CLA).

Play Video


Source: opennet.ru
Buy reliable hosting for sites with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster