Announcement

Collapse
No announcement yet.

Tracking and recording player route?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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?

    #2
    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:

    https://www.youtube.com/watch?v=TVZS...nel=ReubenWard

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

    Comment


      #3
      Originally posted by Everynone View Post
      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:

      https://www.youtube.com/watch?v=TVZS...nel=ReubenWard

      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

      Comment


        #4
        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.
        Last edited by Everynone; 08-31-2018, 03:21 PM.

        Comment


          #5
          Originally posted by Everynone View Post
          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

          Comment


            #6
            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.
            Vid below, that's what you're after, right? You may need to flip some XYs to make things work right

            https://i.gyazo.com/34811b84b29c9151...79c21712df.mp4

            Doing it in Tick here to visualise it better.

            Comment


              #7
              Originally posted by Everynone View Post
              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.
              Vid below, that's what you're after, right? You may need to flip some XYs to make things work right

              https://i.gyazo.com/34811b84b29c9151...79c21712df.mp4

              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.

              Comment


                #8
                Whats the best way of storing the accumulated positional data (x,y coords)?
                I kept filling in a vector array with player positions on Tick. This gives a ton of data.

                That's exactly what I'm after but I want it to show up after the players finished the game.
                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...
                Last edited by Everynone; 09-01-2018, 10:06 AM.

                Comment

                Working...
                X