This is a small code sample of a mechanic to record, replay and alter physics in a game.

It records physics objects in a scene every 60ms and tracks them in a timeline. The player can pause at any time to see a timeline and replay events from different views. At the time of unpausing, the physics state will return to where it was at that point. This allows the player to rewind and change events.

Created in Unreal 5. Source code, architecture diagrams and documentation can be found on my GitHub.

GitHub