2.1 KiB
Tinyphysicsengine
Tinyphysicsengine (TPE) is a very simple suckless/KISS physically inaccurate 3D physics engine made according to LRS principles (by drummyfish). Similarly to other LRS libraries such as small3dlib, smallchesslib, raycastlib etc., it is written in pure C with no dependencies (not even standard library) as a single header library, using only fixed point math, made to be efficient and tested on extremely small and weak devices such as Pokitto. It is completely public domain free software (CC0) and is written in fewer than 3500 lines of code. TPE got some attention even on hacker news where people kind of appreciated it and liked it. { Until they found my website lol. Just to clarify I did not post it to HN myself, I was surprised to find an email that someone posted it there and that it went trending :) Thank you to anyone who posted it <3 ~drummyfish } On Codeberg the project got 43 stars before being banned for author's political opinions.
The repository is currently at https://git.coom.tech/drummyfish/tinyphysicsengine.
Let's stress that TPE is NOT physically accurate, its purpose is mainly entertainment, simplicity and experimenting; a typical imagined usecase is in some suckless game that just needs to add some simple "alright looking" physics for effect. { Though I am currently in process of making a full racing game with it. ~drummyfish } It tries to respect physics equations where possible but uses cheap approximations otherwise. For example all shapes are in fact just soft bodies made of spheres connected by stiff wires, i.e. there are no other primitives like cuboids or capsules. Environments are made by defining a custom signed distance field (ish) function -- this allows setting up all kinds of environments (even dynamic ones, precomputation is not required), checking a sphere-SDF collision is very easy.