Skip to content

Real money Snakes and ladders

Screenshot 2024-12-10 at 1.39.39 PM.png

Create a snakes and ladders game where people can come, sign in/sign up with google, play a game with someone else.

Points to keep in mind

  1. User should wait in lobby until another person comes to the platform to play against them.
  2. When the other person joins, both people should take turns in rolling the dice.
  3. The dice roll should happen on the backend and sent over to the frontend.
  4. The game logic should run both on the websocket server and the clients.
  5. The server should return a GAME_OVER event whenever either of the party wins
  6. Add OAuth using Login with Google

HTTP Service

  1. Signup
  2. Signin
  3. On ramp money.
  4. Off ramp money.
  5. Get history of games played and money won/lost.
  6. Get Current Balance (in Rs)

Websocket service

Browser to Server:

1. Join a New Game

{
type: "JOIN_GAME",
payload: {
roomId: "123"
}
}

2. Roll the Dice

{
type: "ROLL_DICE",
payload: {
userId: "user_1"
}
}

3. Abandon the Game

{
type: "ABANDON_GAME",
payload: {
userId: "user_1",
roomId: "123"
}
}

Server to Browser:

1. Dice Results

{
type: "DICE_RESULTS",
payload: {
userId: "user_1",
diceResults: [5]
}
}

2. Board State

{
type: "BOARD_STATE",
payload: {
roomId: "123",
players: [
{ userId: "user_1", position: 3 },
{ userId: "user_2", position: 5 }
],
turn: "user_1"
}
}

3. Game Finished

{
type: "GAME_FINISHED",
payload: {
roomId: "123",
winnerId: "user_2"
}
}