D2 log 021 – Input replay

New debug feature added to the game: recording inputs during gameplay and playing them back later.

This helps me reproduce a given scenario with a single button press. I can also do a Quake-style “timedemo” recording and use it as a performance benchmark.

To make replay work properly, I had to set a constant seed in my random number generator and make sure all entities were using it. The storage format is not optimal. Recording a long session would probably use more disk space than necessary. But we’re still talking a few kilobytes per minute, so it’s fine.