barrybecker4 / OnlineTTT

Attempt to create a massively multiplayer Tic-Tac-Toe game where any number of online players are automatically paired.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overall Design notes

barrybecker4 opened this issue · comments

status values:

  • pending
  • active
  • X-win
  • O-win
  • X-by-resign
  • O-by-resign

Games table

ID PlayerX PlayerO Status Board
1. barrybecker4. brianjames. X-win. XXXOXO_O_O
2 brianjames. pending
3 p2 p3 active ___OX_____
  • If only one player is in a new row, and they leave, then remove the row in the games table.
  • When a new player enters, remove any rows for which they are player1 and there is no player 2
    (this handles the case where they may have entered previously, but then closed the page before another player joined them).
  • Once 2 players are registered in a row, the game is official. If either leaves now, then the other wins by resignation.
  • If a player takes more than N seconds to move, then they pass (or maybe lose).
  • If a player leaves (onPageUnload) then they resign.

TTT

From Player X's point of view:
You are X. Waiting for player...
has joined
Your move. Click to play in 10, 9, 8... seconds.
Waiting for O to make their move...
You lose! You did not play fast enough
You win!
You lose!

From Player O's point of view:
You are O. Waiting for to play.
Your move. Click to play in 10, 9, 8... seconds.
Waiting for X to make their move...

Notes:
make 300 by 300 div and determine position clicked using div 300 in each coord direction.

Initial implementation based on this design is done now.