Make a timer from the beginning of the game to the end

Hi guys

Context: I made an app for company, where 5 teams in parallel should resolve 10 funny puzzles. They have time for each task and if they don’t complete task it skips to the next. After team have complete all tasks result of each team is recorded in the results table and they can see a leaderboard.

Now all in that game doing well, except for the timer.
My timer is created with help of custom state of a page. Every 0 seconds custom state of = date/time of current date/time and all values (like start game, finish game is depends from that)



Снимок экрана 2022-12-16 в 12.28.38

Problem: It overloads the app and sometimes timer start to slow down. For example, it can freeze and then proceed as if nothing had happened, what is confusing teams.

Queation: Guys, can you advice me a normal way to make a timer, that can start after game started, skip level after time on level is finished and add the result of a team in table after team have complete the game without grabbing current date/time from each user?

Every 0 seconds

Problem: It overloads the app and sometimes timer start to slow down. For example, it can freeze and then proceed as if nothing had happened, what is confusing teams.

Do every 0 seconds!!!??

you mean continuously, non-stop, without any interval between executions!!.. … and you’re trying to update the database?.. every 0 seconds?!..

no wonder it’s not working!!..

Queation: Guys, can you advice me a normal way to make a timer, that can start after game started, skip level after time on level is finished and add the result of a team in table after team have complete the game without grabbing current date/time from each user?

When you say ‘make a timer’ can you clarify exactly what you mean?..

Do you mean you want to display a visual timer on the screen for you users?

Or just that you want to record some time intervals in your database?

(it’s not clear from your post which it is)…

I’m thinking that setting something to trigger every 0 seconds would tax an app pretty quickly.

You may want to look into using something like the countdown plugin.

Assuming they get 10 seconds to answer, you could try something like this.

  • display the question
  • store the current time as your start time
  • set the countdown timer to current time + 10 seconds
  • if they answer correctly, calculate the diff between start time and current time and add this to a running total value
  • if timer plugin runs out, just add 10 to the running total value.

And just repeat this for each question.

I use that plugin myself and it seems to be pretty reliable.

Adam, every 0 seconds updates only custom state witch = current date/time of a user. Also every 0 seconds game start time is comparing with that custom state and that helps me to define time that remains for a level

To a database i send only game start time, start level time, finish game time of each team.

thanks! I will try your method

Even so… every 0 seconds is likely to overload the browser… (and evidently is)… (just check the performance tab in your browser dev tools)

Every 1 second is more than enough to update the time…

I need to display countdown of each level. After team resolve a task or task time is over — team sees the next level and countdown shows how much time remains before level will ends.

As @firstfifteensoftware suggests, you might want to look at this plugin:

Countdown Plugin | Bubble

I use it and it works well (you can of course do the same thing yourself using standard Bubble functionality, but it might be easier just to use the plugin)…

in my newbe “method” timer don’t update every seconds if I set 1 second. It skips seconds. Time counts right, but it cout like — 13:05, 13:02, 13:01, 12,58 and so on. Only when i set 0 seconds it works as expected (but overloads app)

that is why I asks experienced bubblers how to make more optimised timer )

thanks, i will try to deal with that plugin

This topic was automatically closed after 70 days. New replies are no longer allowed.