Mapping / recording movement through a level


I’m working with limited knowledge of unreal engine but feel what I’m trying to achieve is probably not too complicated in the grand scheme of things.

As you navigate through a level is it possible to record your movements from a first person camera into the form of a single line in plan view?

If that is possible, then can you also record the direction you’ve looked in plan view also?

This is part of a wider research project so if anyone would like to get involved that’d be great.

It can be done, simplest version is quite easy. Make transformation array, and add player pawn transform there each tick.

But i noticed words “wider” and “research”, so probably you do not want that very simple way.
You probably want 2 other things also:

  • precise timing, ie. exactly same intervals between data dump.
  • storing data in text log file.

For precise timing you should use timer (however i am not sure if they as accurate as tick is, or they have independent timing).
From timer event you should call function that stores transformation of pawn. You can use logs here, just print that value, then parse it with external script. But this is messy solution.
Better go watch C++ tutorial and write very simple function that saves data to text file. C++ code is on difficulty scale around “hello world” my first C++ code.

PS. be aware that tick frequency heavily depends on FPS, so test whole thing on slower PC. Also physics depends on FPS, so replaying game with physics may not work well.

When it comes to recording movements, you may want to record inputs, rather than transforms.

This allows you to only contain data on key-presses and releases (if using keyboard and/or mouse) with associated timings.

The data might look something like

(Key) - (Action) - (Timestamp)

  1. X - Press - 13:03:04321
  2. Y - Press - 13:03:05345
  3. X - Release - 13:03:07332
  4. Y - Release - 13:03:08934

Potentially covering 4 seconds worth of movement in only 4 lines of data, compared to maybe 60 (Target FPS) * seconds. The data set can also be considerably less than the data for a transform.

This relies on the game being very deterministic. If there are random positions of obstacles, physics objects, procedural generation etc - you would need to be able to store that data and rebuild the scene exactly.

Performance of the game during input capture and playback is important here too - a slight variation can have a significant effect.

To avoid losing accuracy entirely due to performance- you could pair the input saving method with an occasional update for the player transform, saving perhaps every second, used to move the character to the intended location at the intended time. If the character is at this location already you shouldn’t notice this update, but if the character has gone off track it will teleport to this position and attempt to continue following the input data provided.

Not sure what you mean by

but if you want to display the player’s path in 2d (widget in this case), have a look at my post here. There’s a short anim attached demonstrating the result - so you can decide if that’s what you need. The link to the tutorial that enables it is in the #2 post.

Rather than storing position, consider storing the entire transform instead so you can record rotational data, too. If you need this displayed in 3d instead, recording samples several times / s only might be enough. You should be able to interpolate the rest (if needed at all) via a spline, for example.

When it comes to gathering data, it’s pretty much what Nawrot said. Not sure what prompted him to mention a text file (for which you’d need C++ indeed) but just filling up an array of player’s transforms is pretty trivial in pure BP; either using a Tick or a timer.