Tracking and recording player route?

How could I develop something that’s able to track and record the route the player takes around a map.

First bit is pretty straightforward (logging players location coordinates), but is there a way to get the engine to draw the players path on an image that goes to the logfile etc?

Image that goes to a log file? Can you explain what you mean? How are you building a logfile out of images?

You can draw on render targets:

The end result can be seen in the last minute of the video.

Hi Everynone,

What I mean is can ue4 output something that looks like a minimap of a room with the players route drawn on it?

I’m not building a logfile out of images as I don’t know how, but I’m asking is this possible? Can we extract the x,y coordinates from the game and plot a drawn path from them?

MASSIVE THANKS for all your help and input

You can make a classic minimap, there are many tutorials on YT. In your case in addition to drawing the player’s icon at the current location, you’d also loop through the array of the logged locations you mentioned and draw them as well.

UMG user widget can override *onPaint *which gives you context to *DrawBox *which, in turn, uses a Brush. You can set it up with an image in the Content Browser; it’s pretty efficient as far as I know. OnPaint can also draw lines but no splines, which saddens me greatly taking into account that blueprints use splines for wires…

edit: never done anything like that, if someone else claims there’s a better way, they’re probably right. That’s just what I’d try. I just tested drawing 10000 brushes and it works, it’s kind of heavy on the frame rate, though. Depending on how complex this system is going to be, you’ll most likely not need more than a 1000.

A bit curious about how much faster the HUD class is at this, it’s supposed to be faster.

I still think that my original suggestions of drawing to material is better here. I’d look into that first.

Cheers for that, although I don’t need a live minimap, just something at the end of gameplay that says this is the route you took as a kind of record

Even easier then.

Go with a render target. After scrubbing through the tutorial I linked, it seems to cover it all (and more). Instead of drawing on a 3d object, like the author does, assign the Render Target to a widget instead - use a border for simplicity sake. You will, obviously, not use a line trace for drawing but use your accumulated positional data to draw the whole thing once you’re ready.

You’ll need:

  • render target
  • a material for it
  • another material to draw with (draw dots, the more samples in your data, the better)
  • the data for the drawing
  • a widget to display the result on

Instead of keeping it in an actor, keep it all in the widget, loop through the positions you get from the character and Draw dots. Materials need 0-1 coords, you’ve got world coords - you can translate them with MapRange node, for example. [HR][/HR]Vid below, that’s what you’re after, right? You may need to flip some XYs to make things work right :slight_smile:

Doing it in Tick here to visualise it better.

That’s exactly what I’m after but I want it to show up after the players finished the game.

Whats the best way of storing the accumulated positional data (x,y coords)?

Many thanks for that I’ll try going through that tutorial and hopefully won’t make too much of a mess of it.

I kept filling in a vector array with player positions on Tick. This gives a ton of data.

Loop through the array and draw all the data at once. Do mind that if you attempt to draw 10000 dots at once, you’ll get a hitch. This is probably irrelevant if you just want to display it on a static screen. On the other hand, you can draw it in real time - just don’t show it to the player until you’re ready…

this is excatly what i want in my project…kindly is it possible for you to share the blueprint code for it.
I shall be very obliged.
thanks.

It’s been 2 years, I don’t have it. The tutorial in the 2nd post shows the general idea well.

Thanks a lot for the prompt response.

This is how I’m setting it up in the 3rdperson example map but nothing’s getting written to the render target.

I’ve used the render target in the UMG border as you mentioned.

Just wondering if you managed to solve the problem @aliuhad