Backends

A backend is the actual physics engine used by a solver to step the simulation forward. Different backends might have different platform compatibility, performance, and capabilities. While you can select a different backend for each individual solver in your scene, most of the time you will want all solvers to use the same backend. To select a different backend for a solver, use the "Backend" dropdown in the solver inspector:


Obi ships with two backends to choose from: Burst and Oni.

Burst

Burst is the default backend since Obi 5.6. It is fully written in high-performance C#, making use of Unity's Burst compiler and job system. It supports all platforms that can run jobs and that the Burst compiler can compile for. Like Oni, it is fully CPU-based, and makes heavy use of multithreading and SIMD (thanks to the job system and Burst compiler, respectively). Performance on most platforms -specially mobile devices- is slightly better when using Burst. For this reason, Burst should be preferred over Oni when possible.

The full source code for the Burst backend is included in your Obi installation, it can be found at /Obi/Scripts/Common/Backends/Burst/.

Installation

Using the Burst backend requires having the following Unity packages installed:

  • Burst 1.3.3 or newer
  • Collections 0.8.0-preview 5 or newer
  • Mathematics 1.0.1 or newer
  • Jobs 0.2.9-preview.15 or newer

If you don't have these installed, ObiSolver will show a warning in the inspector and try to fall back to the Oni backend (see below):


Keep in mind that preview packages (Collections and Jobs) will not appear in Unity's Package Manager unless you explicitly enable them (see Unity's manual). In recent Unity versions (2021 and later), you may need to manually locate the packages by URL. This can be done clicking on the plus (+) sign at the corner of the Package Manager, and selecting "Add packages by git URL":


Then you can write the package URL in the pop-up field that appears, for instance: com.unity.collections, or com.unity.jobs

Performance

When profiling a simulation backed by Burst, you can use Unity's built-in profiler. In timeline mode, you will see all worker threads busy during the physics update call:


Oni (deprecated)

Oni is the legacy backend used in Obi 2.x - 4.x. It is a native library written in C++11, that comes precompiled for each platform. For this reason, only a few platforms are supported by it: Windows, Mac (Intel only, no Apple Silicon support), Linux, Android, iOS. It is a fully CPU-based backend, that makes heavy use of multithreading and SIMD intrinsics (single-instruction, multiple-data). It can be used for small to mid scale simulations on a wide range of devices. It is used as a fallback in case the Burst backend dependencies are not installed, see above.

When profiling a simulation backed by Oni, it is useful to add the ObiProfiler component to your solver. This will overlay profiling data over your game view while in play mode.