Myths About Floating-Point Numbers (2021)

12 points by riki


riki

I’ve been working on a demo recording feature for my game. The basic premise of a demo file is that you record the initial conditions, and then after that you only record the sequence of player inputs that happened afterwards, yielding a much smaller file size than an equivalent video recording. For demo files to work correctly, your engine has to be fully deterministic.

One thing I was wondering about is: isn’t floating point imprecision / non-determinism gonna beat me here? I mean, Valve does it in the Source Engine somehow, and it’s a common feature in older games such as Quake or Doom, so it can’t be that bad.

And I stumbled upon this article while researching how deterministic floating point numbers can be between different machines. Apparently, they aren’t—not weird considering that every hardware vendor will necesarily have their own FPU designs—but I wonder to what degree this affects my use case.