Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Elapsed time between two functions

Hi all, I set up a system that takes FPS into account when measuring time, so 10 fps lads don't get an advantage over 600 fps lads. Now, I need to check if it works properly so I need to have a timer that starts counting after a certain function, and stops counting after a certain function then gives me the time in seconds. The two functions are Setters, they are to set the enum state of a mechanical gate in the game:They have a height from which they are open, they move and after a height they are closed. They player has to enter just the right time, and as I gave heights, and use the Tick event to move the gates, needless to say that the FPS plays a huge role in the game. So, these gates have a couple of states, but I care about two now: "CanEnter" and "TooLate". All the game logic is set, I just need to start a timer right after the state is changed to "CanEnter" and I need to stop it, and display the time right after the state is "TooLate". I saw timers on the net that count backwards. I need one to count forward and tell me the time. How to do this?

Product Version: UE 4.12
more ▼

asked Jul 12 '16 at 09:57 AM in Blueprint Scripting

avatar image

95 8 12 18

avatar image Prithvi Singh Jul 12 '16 at 11:10 AM

@agiro ,just saw this one , "get game time in seconds" node

it tells you for how long the game's currently opened level has been opened for.

avatar image Prithvi Singh Jul 12 '16 at 11:25 AM

try playing around with this timers
try "get time elapsed by time handle" node.

avatar image agiro Jul 12 '16 at 11:33 AM

I did find a solution on my own, thanks anyway. I looked those up, but to no avail :D I thought I tell the idea behind giving a game true measurements based on frame rate, so others may find it useful.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Thanks yet again for the help, I will have to start paying you tuition fee :D Now, In the meantime I got it solved myself. I wanted to measure the time that the game takes to switch the two states, not the whole gaming time. I got it by incrementing the delta seconds from tick event in a variable and setting it back to 0 after printing it just after the other state. The main goal is a success now: No matter the game's frame rate, the player's reaction time has to be exactly the same. So if I demand a 0.15, (it will be 0.150004 anyway, processor speed), so 0.15 both on 60 fps, 20 fps and 600 fps. I spent half a day setting this up because of the diversity of Android devices, and this system actually takes the FPS drops into account as well, as soon as they appear. Simple physics, really, wonder why it took me this long. I mentioned those gates. The gate's speed is got by this: I have a max distance that it has to travel. I calculate it, easy as ABC. Then I divide it by the time I want the gate to go from bottom to top. I multiply the answer with the frame's delta seconds (= i divide by the FPS) and I have the gate speed, measurement in units/frame. Then I have the distance, multiply it by the reaction time required (in secs), and divide by the secs needed to go from bottom to top (this last step to get a unit). and this will be the height difference that the gate can travel while it is open. I sent this post so I can check if it works, and yes, it does. After all, a reaction time based game has to be accurate.

more ▼

answered Jul 12 '16 at 11:28 AM

avatar image

95 8 12 18

avatar image Prithvi Singh Jul 12 '16 at 11:39 AM

nice one and no need for fee :P

write your comment as answer (or simply convert it to answer) , it would be useful for many.

avatar image agiro Jul 12 '16 at 11:45 AM

actually feeling bad for accepting my answer, like when you tell a joke and only you laugh at it :D

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question