2
\$\begingroup\$

Im building a turn-based game using websockets and nodejs. At the end of each turn I want to show some scores before starting the next turn. Should that be controlled by the server using a timer? Or should the client start a timer and tell the server when it's ready for next turn? Just to keep the load of the server. What is the pros/cons?

\$\endgroup\$
  • \$\begingroup\$ Are turns timed? Or user-triggered? \$\endgroup\$ – John McDonald Aug 13 '13 at 16:42
  • \$\begingroup\$ Turns are timed and played simultaneously. When both players ends their turn next turn begins or if the max_round_time is reached. \$\endgroup\$ – vermin Aug 13 '13 at 16:49
3
\$\begingroup\$

You don't necessarily need a timer on the server but you do need the server to be checking time(1) That is, that game should keep track of when the turn started, so that it can compare against this timestamp when it receives moves from the client.

(1) Assuming the time limit for turns has any effect on the game results. The rule of thumb with these things is that anything that affects the game results must be handled by or verified on the server, or else players will cheat. Anything that doesn't affect the game results should be handled on the client in order to reduce load on the server and the game's bandwidth usage.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.