NOTCH Physics Engine

Team Name

NOTCH

Timeline

Fall 2022 – Spring 2023

Students

  • KHAC NGUYEN
  • HO ANH TUAN VO
  • STEVEN GUILBERT
  • NELMIN MEHMEDOVIC
  • DELVIN JOSEPH

Abstract

NOTCH is a game physics engine that is designed to tackle the problem that every Rust game developer needs to deal with, writing physics logic from scratch. It helps save Rust developers plenty of time and effort to accomplish their goals. This project will create a robust physics library for both 2D and 3D objects allowing programmers easy access to the physics simulation. It will be usable as a library which allows it to be flexible for different use cases in both game development and scientific simulation.

Background

Physics engines are used in video games and other forms of entertainment such as movies in order to replicate real-world physics phenomena as closely as possible in the digital world. It is extremely time-consuming to account for all the ways an object can move in the game, so a physics engine allows the creator to add realistic interactions between objects without having to worry about each individual detail. The problem with currently available physics engines for games is that they are not that accurate when it comes to the math involved in physics. When an engine runs physics equations, it can only store a limited number of values due to memory constraints, therefore making it less precise. In order to correct this, physics engines overcompensate to make it look more realistic. This will often lead to broken physics in games and makes the product look bad to the user. Physics engines try to stay true to the physics equation as much as possible but because of the errors that happen due to the precision in numbers, the value in-game drifts further away from its true value.

An example of this happening is collision detection. Let’s say many pieces of cardboard are stacked on top of each other, because the math is not precise, one of the cardboard will slightly dip into the ones below at the end of a frame. In order to compensate for this error in the next frame, the physics engine will move the cardboard up which makes the rest of the cardboard move up as well. This will keep repeating again and again which will result in the cardboard jittering in the eyes of the user. Another major problem with the current physics engines available in video games is the performance hit that it applies to the games. Video games need to run at a reasonable tick in order to be enjoyable, and many current physics engines available are extremely taxing which drops the frame rate drastically depending on how many objects are on screen. The engine needs to decide how each object behaves and render it on-screen all in a single frame, so the more objects that need to be moved are on screen, the more the frame rate takes a hit. The way they compensate for this problem is by cheating and only applying physics for certain important objects and also by checking for collisions discreetly which results in inaccuracies.

Because the purpose of a physics engine is to replicate real-world physics as accurately as possible, there is still a need for newer physics engines that can be more accurate to the real world without taking a major hit to the performance of the game. With another innovation in this space, games can look more beautiful and realistic without breaking the immersion of the player that comes from unrealistic physics.

Project Requirements

  • The library is required to have simulation functionalities that are simple to follow for new users and have enough depth for a more technical user to make use of. The customer of this product can vary from video game developers to physicists both professionals and students.
  • The code for the product must be available to the user in an online repository or as a library that can be easily accessible. The end product must also have a user-friendly interface that looks clean and professional.
  • This product is set to be worked on and improved upon even after delivery. In order to provide proper maintenance for the software, our team must be consistent with the manner of how our source code is being kept track of along with all the documentation relating to the product such as this one.

System Overview

NOTCH Physics Library is built on top of four foundational subsystems: Mathematics, Dynamics, Collision Detection, and Bounding Volume. Each layer is to be loosely but closely coupled due to the fact that one module depends heavily on another to work correctly. For instance, the Dynamics subsystem makes heavy use of vectors so that data structures are well-defined, thus essentially requiring the Maths sub-system. Additionally, all subsystems are to follow the naming convention and language-specific features of the official Rust API Guidelines.

As this is a physics engine that functions as a library, there will be a public interface of modules that will be separated into the different key areas of the system. The users of the library will use these interfaces to interact with the overall system. There are a variety of them, each with its own well-defined purpose. These include the bounding volume, rigid body, collision manager, and meshes and geometry. These will be taking in the input from the users of the library to allow them to interact with the engine. They will also allow the users to query the state in order to get output such as collisions.

NOTCH Physics Library Data flow

Results

Double pendulum attached by a mass-spring system
Cloth physics
Full Demo of physics simulation

Future Work

Future work consists of adding more functionalities to the physics library such as Fine-Grained Demolition Physics, Fluid Dynamics, Collision Event Pipeline, as well as many optimizations.​

Project Files

Project Charter (link)

System Requirements Specification (link)

Architectural Design Specification (link)

Detailed Design Specification (link)

Poster (link)

Online Source Code (link)

Documentation – Follow the instructions of the online repository for HTML docs generation

Helpful Reading Materials

The outline of the engine is mostly based on the ‘Physically Based Modeling’ course [1]. Even though the course does not provide implementation details, it provides a decent direction for us to go about programming the engine.

For basic knowledge of dynamics, refer to ‘Introduction to Classical Mechanics’ by Dr. David Morin [2]. The book provides many insights and intuitive proofs.

Since the backbone of the engine harnesses mainly 32-bit floating point arithmetic. The book ‘Accuracy and Stability of Numerical Algorithms’ by Nicholas Higham [3] serves as a superb reference on numerical algorithms. However, the book is essentially a graduate-level material that might require readers to be equipped with prerequisite mathematical knowledge.

Without a doubt, the Rust standard library documentations [4] are absolutely indispensable where any programming issue exists.

References

[1] Witkin, Andrew, and David Baraff. “Physically Based Modeling: Principles and
Practice.” Physically based modeling, 1997.
https://www.cs.cmu.edu/~baraff/sigcourse/index.html.

[2] Morin, David. Introduction to Classical Mechanics: With Problems and Solutions.
Cambridge University Press, 2019.

[3] Higham, Nicholas J. Accuracy and Stability of Numerical Algorithms. SIAM, 2002.

[4] https://doc.rust-lang.org/stable/std

hxv1900