Link to home
Start Free TrialLog in
Avatar of Chelsey Rigg
Chelsey Rigg

asked on

How to Implement Ludo Game like timer - React Native

We are building an android app with react native.

We are stuck with something. We have a feature, where 4 users will play a game.

Player A, Player B, Player C, Player D.

Each player will have 60 seconds to "Press a Button"

If a player, didn't do any action [or if he is offline] - after 60 seconds, his trun will be passed. and next player will get the chance.

or if a player, took a action with in 20-30 seconds. next player will get get chance.

we are confused how to implement this.

[you can consider this like Ludo game, but we don't kick people out of game, if they stoped responding.]

we are using firebase realtime database.

i'm just confused   -  i'm looking for someone to give me a nice approach :) to achieve this

WE ARE READY TO USE A SERVER TO ACHIEVE THIS.
Avatar of noci
noci

I guess you need a server to do this....
Anyone waiting for a turn is connected and waiting for their turn.

The player receives the turn when the call completes. Then there are (according to your rules) 60 seconds to provide an answer/next turn request.
If the player "returns" then the next is release (answered) or if the player doesn't return, the next is released.

Any returning player is inserted at the tail of the game queue, anyone released is from the front. It is the server that maintains the queue.
(hard to do in a database ...)
Avatar of Chelsey Rigg

ASKER

Yes, we are ready to use a additional server
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.