less_retarded_wiki/tinyphysicsengine.md

7 lines
2.1 KiB
Markdown
Raw Permalink Normal View History

2023-11-25 16:00:28 +01:00
# Tinyphysicsengine
2024-10-07 14:24:18 +02:00
Tinyphysicsengine (TPE) is a very simple [suckless](suckless.md)/[KISS](kiss.md) physically inaccurate 3D [physics engine](physics_engine.md) made according to [LRS](lrs.md) principles (by [drummyfish](drummyfish.md)). Similarly to other LRS libraries such as [small3dlib](small3dlib.md), [smallchesslib](smallchesslib.md), [raycastlib](raycastlib.md) etc., it is written in pure [C](c.md) with no dependencies (not even [standard library](stdlib.md)) as a [single header](single_header.md) library, using only [fixed point](fixed_point.md) math, made to be efficient and tested on extremely small and weak devices such as [Pokitto](pokitto.md). It is completely [public domain](public_domain.md) [free software](free_software.md) ([CC0](cc0.md)) and is written in fewer than 3500 [lines of code](loc.md). TPE got some attention even on [hacker news](hacker_news.md) 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.
2023-11-25 16:00:28 +01:00
2024-10-07 14:24:18 +02:00
The repository is currently at https://git.coom.tech/drummyfish/tinyphysicsengine.
2023-11-25 16:00:28 +01:00
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](game.md) 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](approximation.md) 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](sdf.md) (ish) function -- this allows setting up all kinds of environments (even [dynamic](dynamic.md) ones, precomputation is not required), checking a sphere-SDF collision is very easy.