You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
User waits for another user to connect on play URL.
If a player disconnects, the other player and the spectators are notified and the room is closed.
If a player wins or the game draws, the other player and spectators are notified and the room is closed.
Users are tracked by Session IDs, so two tabs == two users.
Game is stored on room in server to prevent client manipulation.
First turn is randomly selected and players are referred to as 1 or 2 depending on join order.
Storage
Games are stored in a RDS PostgreSQL instance.
Connect4Game model stores the following:
Schema:
Field
Type
Info
id
string
board
array(int)
Flattened array representation of board. Use width and height to recover shape.
player_1
string
Player 1 Session ID
player_2
string
Player 2 Session ID
width
int
Board width
height
int
Board height
winner
int
1 or 2 indicating Player 1 or 2.
draw
boolean
True or False, indicating if game ended in draw.
createdAt
date
updatedAt
date
Game is only stored if at least 1 player joined the room.
Improvements if I were to spend more time on it
Make interface responsive/fix mobile experience.
Unit tests.
Configure SSL using Let's Encrypt.
Overall better UI (ex: more clear display of server updates).
Add chat (it would be fairly simple with the existing server capabilities).
Refactor both Node & React app structures to be more scalable.
Possibly host static files in an S3 bucket.
Refactor Connect4 & InfoPanel components.
Check that some values aren't being synced. I have not used Colyseus before so I would like to do more testing to ensure that clients cannot manipulate game state.