I am trying to create a simple online card game with multiple players. Basically, there's a dealer and multiple players. I have have already implemented most of the game and it's working fine. now I want to implement a universal timer for a single game. For example, when the dealer starts a new game the timer starts and the players will be notified that the game started, and then there will be a countdown which will be seen by the players and the dealer.
Any strategy on how I can implement this?
Additional info about my system:
- I am using spring and jms and the system is divided into 3 applications.
- 2 web applications, 1 for players and 1 for dealers. the web applications do not do any processing, they just receive request and delegate processing to the server.
- 1 console application as my server.
- Im currently using javascipt to update info in the clients. for example in the dealer client side, i have a js script that makes a query every 3 seconds to identify whether each of the players wants to make a "hit" or "deal".
Now there's a possibility that a player may become idle so I want to implement a timer so that when the timer expires the server can do some processing on that idle player.