How do I track time spent by user in each screen?

0 favourites
  • 11 posts
From the Asset Store
Simple and easily editable template for a dynamic camera that zooms in and out based on how far apart the players are.
  • Hi,

    I want to record the time taken by user to complete the task in each screen. how can I do that ?

    Thanks,

    Sarthak

  • Hi!

    I didn't understand exactly what you mean, I made this, tell me if can help you

    [attachment=0:apx69efa][/attachment:apx69efa]

  • Make a variable called "timeOnScreen"

    (system) every 1 seconds -> add 1 to "timeOnScreen"

  • Yes. Thanks a lot .

  • Hi If you want a little more accuracy you could get the time at the START of each layout and calculate the difference. That way you'll avoid the rounding down gap inherent in the solution proposed by justifun - although if you're not too bothered about partial seconds that solution will serve just fine.

  • You could even do "every 0.1 seconds, add 0.1" for a more accurate time. The project also has an internal timer that starts as soon as you launch the game, but that cannot be reset between layouts.

    I also found that using a very low number like "every 0.01, add 0.01" would not work as intended and tracks time slower than the project's own clock. I'm not sure if this is a bug, 0.02 still worked fine.

    I made an example to test it, the 0.01 shows time slower than the rest on my end:

    https://dl.dropboxusercontent.com/u/191 ... index.html

    Does it happen for you too? I'm not sure it's supposed to be this way.

  • I also found that using a very low number like "every 0.01, add 0.01" would not work as intended and tracks time slower than the project's own clock. I'm not sure if this is a bug, 0.02 still worked fine.

    I'm not absolutely sure, but I believe this is because 0.01 seconds means it happens faster than the framerate ( more than 60 times a second (0.02 is less than 60 times a second)).

  • spacedoubt is right, every X seconds cannot go faster than every tick, I recommand hundredfold 's method if you need accuracy (save the reference time, and retrieve the current time by substracting the reference time to the current time when needing it, it being in seconds does not mean it is of a precision of 1 second, just that the unit is the second (1.05 seconds for exemple)).

    Xavier

  • Thanks for the recommendation Aphrodite - I think there's also a performance issue here. For example, clocking something every second (or ten times per second for slightly more accuracy) is using a lot more resource than doing it just once per layout.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for the recommendation Aphrodite - I think there's also a performance issue here. For example, clocking something every second (or ten times per second for slightly more accuracy) is using a lot more resource than doing it just once per layout.

    Performances would not be that much hurt I would think, but well, if we can prevent doing a redondant thing by using something the engine actually handle itself, why not do it.(I am more thinking of tool usage rather than performances, as using the tools we are given wisely is actually, from my experience, giving good performances).

    You also have the advantage of putting the calcul in a function if you want to, that would return the spent time in second relative to the initial time for exemple, which may make the code clearer to an extend.

  • Very true.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)