-1
\$\begingroup\$

I am developing a multiplayer tic tac toe game. The issue I'm facing at the moment is knowing whether the other player is in the game or not. Each player is running their own session, and should a player's session not exist, the game should end. How can I know whether the other player session exists or not?

\$\endgroup\$
2
  • \$\begingroup\$ could you just implement a call response system: player1 sends state to player2. player2 sends state to player1. both send a received message to the other with differences if needed. for 9 points this is relatively trivial as a game state can be summarized as 9 enums (unused, player1, player2). then if a response is not received by either then start a timer if no response is received by the end that player is no longer connected. I say timer because their connection just might be slow. \$\endgroup\$
    – gardian06
    May 6, 2012 at 17:04
  • \$\begingroup\$ More information is required here. Is this a P2P game, client/server-based, or what? Your options depend on your implementation. \$\endgroup\$
    – SomeGuy
    Jun 4, 2012 at 23:09

1 Answer 1

1
\$\begingroup\$

Simply have a timer. For example if a player gets 5 seconds then show a countdown for that 5 seconds and if the player hasn't made their turn by then I would say there is a 90% chance that the player has disconnected - so they automatically 'lose'.

In multiplayer games you must have some sort of timer or some players simply disconnect instead of losing.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .