Exporting player location and direction constantly

Hi all

I’m working on some research project with blender.
The feature that I want is, when I’m in a FPS game, the system can constantly export the location and direction of the player, and if possible, save this data into a chart like CSV file.

I hope this is clear and wish you can give me some advice

Thank you guys.

Look for save/load.