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?
@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.
try playing around with this timers
try “get time elapsed by time handle” node.
nice one and no need for fee
write your comment as answer (or simply convert it to answer) , it would be useful for many.
Thanks yet again for the help, I will have to start paying you tuition fee
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.
I did find a solution on my own, thanks anyway. I looked those up, but to no avail I thought I tell the idea behind giving a game true measurements based on frame rate, so others may find it useful.
actually feeling bad for accepting my answer, like when you tell a joke and only you laugh at it