trialEndTime = this.time.now;
let duration = (trialEndTime - trialStartTime)/1000;
console.log(duration);
Apparently, the first trial duration was 45 sec, and 12 sec for 2nd, 3rd, and the last. This is not an extremely time sensitive task, but would still prefer to have consistency across trials. Regardless, none of the trial duration was close to 10 secs which I set up in the time.delayedCall() function.
I am not sure whether this difference is due to not using time.delayedCall() properly, or more with my line of codes (when exactly I am calling to register time.now).
Here is a link to the task, and thank you for any useful feedback.
I changed the scene to autoStart = false, and that gets me closer to a more precise timing. However, the first one is always kinda off compare to the rest.
What i do is that i have a variable with the start time (date.now), and then in update i check if date.now-startTime is above the time limit, and if it is then i stop the current game
I am following up with this issue. After collecting some pilot data, I made a histogram of the trial duration of 216 trials. As you can see, the problem remained, that the duration for the first trial tends to cluster around 200 seconds (since game start)?
Although not all trials perfectly landed on a 30 seconds duration. Most trials are around that range.
I am not sure how to solve this problem. The subjective experience of user time doesn’t seem to feel different, but the computation outcomes varies. Here is the link to the task.
In earlier Phaser v3 I think this.time.now is not properly set during scene create() and would be 0. The timer event duration would still be correct though. Only trialStartTime would be wrong.
You are right that the timer event is working properly (I timed it myself for the first trial), and I think the duration problem is due to people switching window during the game which can lead to pausing the game.