Glint: Dev diary I - Oops, I forgot the epsilon

Story time. I have wanted to write a particular game for over 25 years now. I then had three kids, and as anyone who has kids knows, all personal time shrinks down to almost nothing the first three years. Only around age 5-6 can you start trust them to not off themselves in the most imaginative ways possible. Girls a bit less of a worry than boys.
In this pursuit I tried a couple of different alternatives, starting with Bevy, then Godot, Unity and finally Unreal Engine. That’s when my daughter’s found out what I was doing, and I ended up promising them a game first. I picked Unreal Engine, mostly because it had up to date tutorials and decent step by step video tutorials by enthusiasts on YouTube. I then hit a brick wall of complexity which I couldn’t overcome, and decided that it’s easier to write my own.

Brave New World
The obvious answer to this is to write your own engine. I have gotten a bit on the way, and I try to document it. You can view my efforts here:
Oops, I forgot the epsilon

So I had gotten the physics system up and running, and I was very happy. Just look at that guy, he is super happy that he can fall 50 meters.

I left it running over the night, and came back to a missing robot who had decided it was time to play peekaboo.

A quick inspection in my REPL found that Mr. Robot was located somewhere inside the Earth’s crust, accelerating. Truly a case of where no robot has gone before.
When you work with floats or doubles, you can get imprecision when adding these numbers up. In the physics system, there is a check for colliding entities. With this imprecision, it happens that what should be a true, turns out to be a false, because number A (current position) and number B (velocity) needed to be added together and then checked against number C (derived surface area), which is our boundary for not falling anymore due to gravity.
How do you fix this? Simple, you add a very small number, typically called epsilon, to the boundary check, in order to ensure that the imprecision cannot trigger this kind of bug. Mr. Robot now safely falls 50 meters.
PS
Massive shoutout to Joshua Suskalo, the author of coffi, which makes this possible. He was supernice in answering my questions and getting up to speed with how coffi intergrates with C libraries.