Physics simulation with Rapier: 2021 roadmap

πŸŽ‰πŸŽ‰πŸŽ‰ Happy new year everyone! πŸŽ‰πŸŽ‰πŸŽ‰

The year 2020 is over, so it is time to see what we did so far on our Rapier physics engine, and what are our plans for 2021!

Rapier in 2020

rapier logo

Rapier is a free and open-source physics engine for games, animation and robotics, written entirely with the Rust programming language. It focuses on performance, portability, and (optional) cross-platform determinism. We currently provide four Rust crates for Rapier and two NPM packages:

We announced Rapier for the first time at the end of August 2020. Since then, we implemented some essential features like ray-casting, collision filters, access to contact information, rotation locking, and the support of shapes like cylinders and cones. We made sure our cross-platform determinism feature works properly on the new Apple M1 ARM processor. And we set up continuous benchmarking visible on the Rapier website to make sure incremental changes don't destroy performances.

During December 2020 we started working on a large refactoring of the geometry-related code existing partly inside of ncollide and partly inside of Rapier itself. This refactoring is still work-in-progress, as part of the cdl repository (the name isn't definitive, don't hesitate to share your opinion on that issue). This work will be ready for the beginning of February 2021, and will allow us to proceed with our 2021 goals.

Rapier roadmap for 2021

We have very exciting goals for Rapier in 2021! Basically, at the end of 2021 we want Rapier to have all the features one would expect from a physics engine for games. This implies achieving feature-parity with popular C++ physics engines like Box2d, Bullet Physics, and PhysX. There is one exception though: we don't plan to support running physics simulations on the GPU yet. Though this may become a focus at some point in the next years.

Here is a list of some of the most important features we are missing today. This includes when they should become available (ETA):

FeatureDescriptionETA
64-bits floatsA f64 version of Rapier for greater accuracy.February
Sweep testsSimilar to ray-cast, except that we are casting a whole shape instead of just a ray. This is often used to design character controllers.February
Intersection queriesTo retrieve all colliders intersecting a given shape.February
Convex polyhedronTo use an arbitrary convex polyhedron as a collider shape.February
Custom shapesTo allow the user to define their own shape types.February
Contact modificationTo allow the user to modify/delete a contact before it is handed over to the constraints solver.March
DominanceTo make one dynamic rigid-body act like a kinematic body wrt. another dynamic rigid-body.March
CCDTo prevent fast-moving objects from missing collisions.April
Joint limits, motorsTo simulate more realistic vehicles, ragdolls, etc.May
Reduced-coordinates articulationsTo simulate more realistic robots with no joint drift.August

Note that the contact modification feature is what will allow you to simulate one-way platforms, conveyor belts, as well as colliders with non-uniform restitution and friction coefficients.

We also intend to implement some higher-level features like a character controller and a vehicle controller. Both should be available starting October. Most games will need controllers obeying their specific custom rules, so it is impossible to design a universal solution. Our goal is to provide something useful to start with, to serve as a basis to more specific character and vehicle controllers.

Finally, the last months of 2021 should be mostly dedicated to improving documentations and fixing bugs. Our bevy plugins and JS bindings will be updated progressively through the year in order to always use the latest version of Rapier.

What about fluids simulation?

We also develop Salva, a 2D and 3D fluids simulation engine written in Rust. Salva implements two-ways coupling with Rapier. This means that fluids from Salva can be affected by contact forces originating from Rapier, and rigid-bodies from Rapier can be affected by forces originating from fluids. Our three 2021 objectives for Salva are:

  1. Cross-platform determinism: just like Rapier, we want to make Salva optionally cross-platform deterministic (under the same assumption of IEEE 754-2008 compliance).
  2. Performance improvements: we need to apply to Salva what we leaned from Rapier with explicit SIMD optimizations.
  3. Stability improvements: to improve the quality of the fluids simulation itself and of the two-ways coupling with Rapier.

We intend to work on the first two objectives from February to May 2021. The stability improvements will be a progressive work during the rest of the year.

As of today we don't plan to create JavaScript bindings for Salva. However, this can happen if there is enough demand from the community.

Conclusion

The Rust game-development community is growing every days and the ecosystem is maturing steadily with major crates like the Amethyst and Bevy game engine, rust-gpu project, and many other incredible projects. By working on Rapier (and some of its dependencies) full-time we aim to provide a high-quality free, open-source, community-friendly, cross-platform game physics simulation library. The year 2021 will allow us to make Rapier reach a level of feature-completeness comparable to its main C++ alternatives.

If you would like to support us with the development of Rapier, please consider sponsoring us on GitHub sponsor. Thank again to all our existing, past, and future sponsors for making all of this possible.

Have a great year 2021! πŸ₯³