My game's main feature has a ghost doing all your actions after you die. Basically a replay system. This was very hard to do at first.
At first, I made it record your position with all inputs and time. The ghost would glide to them. This was really hard to make and it was stupid. It didn't feel real.
Then, I made somewhat of a scripting language and made the ghost script as close to the player's as possible, only doing commands the player gave it.
This had an issue, though: Some actions were interpreted differently because of the different interpretations of different things that were really hard to pin down.
On the last day, I scrapped it all and instead did what I should've done: Made the player and ghost inherit from the same class, and just have one's inputs be taken in on keypress for the player, and have the ghost read from an array of those inputs with time. This made everything extremely accurate unless there is a drastic change in framerate.