Recording player movement/actions, then applying to an NPC

Hey guys,

I will be creating various spectator methods for a game and my idea is to:

1: Create the game, have somebody play it.
2: Record all of the players movement data/actions somehow.
3: Apply this data to an NPC so it looks like somebody is playing.
4: Players spectate a level with the NPC using the players actions.

This will then allow make several spectator methods but have an NPC that I can put into the level to simulate a real player.

However, I have not come across anything that would allow me to record somebody’s gameplay and then apply it to an NPC. I was just wondering if anybody had any ideas of how to approach this problem.