Announcement

Collapse
No announcement yet.

Complex question(Data tables; reading milliseconds etc)

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

    Complex question(Data tables; reading milliseconds etc)

    Hey guys!
    So my question is a bit complex that's why I haven't asked over the AnswerHub.

    My idea is to create a rhythm game template for the marketplace.
    I've already seen that the UE4 visualizer plugin cannot be cooked into a game(so far), so I was thinking of other methods.

    I came up with the idea of using the "Feedback" program to create my own song notes(it's basically a program that let's you make songs into Guitar Hero 3).
    This program then exports the song note info into a .chart file, which when opened, is pretty easy to read.
    In the first column, it displays the milliseconds at which one note is played, and in the second column says which note is played(red,green,orange etc).
    So far so good. At this point, I was thinking of how can I possibly import this information inside UE4 without editing any C++ code(which I don't know).
    So I thought I add the milliseconds and notes column into a data table inside UE4.

    The research I've done was on 2 things.
    1. Data tables inside UE4
    2. Getting milliseconds inside the game

    1. I've read the official documentation on Data tables, but it's not really user friendly. The only thing I've seen inside blueprint are these nodes:
    -Get table row names(which I suppose, I need, but it outputs an array)
    -Evaluate curve table row(which outputs a coordinate which I don't need)

    2. The other thing I read(I'm not sure if I'm correct about it) is that there is no way to read the milliseconds past from the start of an event.

    So to recap to what I would like to achieve:
    -Start reading milliseconds from start of the game
    -Read the first column's row for the millisecond from data table
    -When the two matches, check the second column for a value(red, green or orange note)
    -Spawn the matching note

    It's not that hard to pull off, but I'm really unfamiliar with data tables and how they work, and how they are used in blueprints, so a bit help I would need with this.

    Thank you very much and have a wonderful day!

    #2
    Hey!

    First of all a question about the data tables: Where you able to correctly import your data table to begin with? Are you stuck trying to use the values you have imported? Having a quick glance at the documentation I think that they explain only the C++ solution. To access them through blueprints I think you need "Get Data Table Row" where you supply the row name (the node you found)! Then you break the struct and you get your miliseconds.

    Now about the miliseconds thing. You can actually access time that passes through the Tick event which supplies a delta second from the last tick. You can then just save the values to a float variable like this: "timePassed = timePassed + DeltaSeconds". Then use this variable to do the rest of the calculations! If you need to reset your timer just zero out the timePassed variable!
    Now you mentioned that you are planning to see if the note time and the run time of your program. Usually there won't be an equality in those values! Better use a "less than or equal" node since the Delta second might bring your program a bit after what you needed! Then you should just check which notes you spawned and remove them from your spawning queue!
    Check my User Interface Kit here: https://forums.unrealengine.com/show...-Interface-Kit
    A WIP Hex Planet Generation: https://forums.unrealengine.com/show...ral-Generation

    Comment


      #3
      You can get the data tables working correctly without needing an external CSV or C++ but yes documentation is rather poor. What you want to do is create a struct with the header names of all the columns that you have (don't have your name as a column since it's the first row, just leave it with now column header). For the data on each row you just break it out which you can do by right clicking on it when you do a "get row by name"

      Comment


        #4
        Originally posted by Semitable View Post
        Hey!

        First of all a question about the data tables: Where you able to correctly import your data table to begin with? Are you stuck trying to use the values you have imported? Having a quick glance at the documentation I think that they explain only the C++ solution. To access them through blueprints I think you need "Get Data Table Row" where you supply the row name (the node you found)! Then you break the struct and you get your miliseconds.

        Now about the miliseconds thing. You can actually access time that passes through the Tick event which supplies a delta second from the last tick. You can then just save the values to a float variable like this: "timePassed = timePassed + DeltaSeconds". Then use this variable to do the rest of the calculations! If you need to reset your timer just zero out the timePassed variable!
        Now you mentioned that you are planning to see if the note time and the run time of your program. Usually there won't be an equality in those values! Better use a "less than or equal" node since the Delta second might bring your program a bit after what you needed! Then you should just check which notes you spawned and remove them from your spawning queue!
        Well...
        I am able to import the CSV file correctly, but I don't know the actual usage of the node: Get table row names, and this returns an array.
        If you could demonstrate me with a blueprint screenshot by taking data row by row and doing something with them.

        Originally posted by ZoltanJr View Post
        You can get the data tables working correctly without needing an external CSV or C++ but yes documentation is rather poor. What you want to do is create a struct with the header names of all the columns that you have (don't have your name as a column since it's the first row, just leave it with now column header). For the data on each row you just break it out which you can do by right clicking on it when you do a "get row by name"
        EPIC should focus a bit on their documentation, instead of rushing these new releases of the engine imo...
        Again, could you please demonstrate this usage with a few screenshots?

        Thank you guys so much for replying

        Comment


          #5
          Sorry for bumping this thread, but I have tried to make this work since my last post(may 29), and I did not succeed
          Can any1 help me with a step by step guide for this please?

          Comment


            #6
            Regarding the milliseconds: think of everything that happens during one tick - which is the same as one frame that is being rendered, or one update of the main game loop if you will - as happening at the same time. The game update completes in a few milliseconds, then the renderer does its thing with the updated positions of all objects, and then the process starts over again. (I'm simplifying for ease of explanation, but you get the idea.) You can get the time since the last tick by using the Get World Delta Seconds function, or the Delta Time output of the Tick event.

            If you want accurate real time measurements, there are a bunch of blueprint nodes available for it as well. Just do a node search for "time" and you should find the bunch! You could for example store the real world time at the start of a song, and then track the current timestamp by comparing the current real world time to the stored start time. Or continuously add delta time to a variable in which you store elapsed time.
            Broad Strokes | Jan Kaluza | Marketplace Release: 'Over 9000 Swords' Modular Melee Weapon System
            Currently not available for freelance work
            Dev Blog & Tutorials | Twitter

            Comment


              #7
              Originally posted by SethPDA View Post
              Well...
              I am able to import the CSV file correctly, but I don't know the actual usage of the node: Get table row names, and this returns an array.
              If you could demonstrate me with a blueprint screenshot by taking data row by row and doing something with them.
              Well yes, it's an array of all your rows. Now you loop through the rows with a foreach and in each iteration of the loop you call GetDataTableRow from your array element and from there you just break your struct and like magic have all your values. Basically if you've ever written a program in any language and access any type of database you use this sort of pattern.. Maybe that's why the docs are a little skimpy on this :P

              To be honest there isn't really anything complex about your questions

              edit: Here is an example straight out of my project (I never even read in the documentation, i just right clicked on the graph, typed in 'data' and carefully examined the available methods, GetDataTableRow is all the way under struct instead of Data Tables which I find kind of odd, I suppose it returns a struct though):
              Attached Files
              Last edited by TheFoyer; 07-08-2015, 11:37 PM.
              Columbus Ohio Unreal Meetup
              @OCGameStudio | Sphere Complex | twitch.tv/WFMOz

              Comment

              Working...
              X