Skip to content

devjain0924/Scribble

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

14 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽจ Scribble

Real-Time Multiplayer Drawing & Guessing Game

Draw. Guess. Compete. All in real time.

Scribble Banner

React Node.js Socket.IO MongoDB License


Features โ€ข Screenshots โ€ข Architecture โ€ข Installation โ€ข Socket Events โ€ข Roadmap


๐Ÿ“– About The Project

Scribble is a real-time multiplayer drawing and guessing game inspired by Scribbl.io, where one player draws a secret word while everyone else races to guess it before the clock runs out.

The project is built as a deep dive into real-time synchronization, multiplayer game-state management, and Socket.IO event architecture โ€” going beyond a simple CRUD app into the trickier territory of live, shared, ephemeral state.


โœจ Features

๐ŸŽจ Drawing

  • Real-time stroke sync
  • Brush tool
  • Fill / bucket tool
  • Eraser tool
  • Color palette
  • Adjustable brush size
  • Canvas clear
  • Undo / redo
  • Late-join canvas sync

๐ŸŽฎ Multiplayer

  • Multiplayer rooms
  • Unique room codes
  • Invite link sharing
  • Drawer & guesser roles
  • Automatic drawer rotation
  • Round management
  • Timer system
  • Score tracking & winner detection
  • Join / leave handling
  • Drawer disconnect recovery

๐Ÿ’ฌ Chat & Guessing

  • Real-time chat
  • Guess detection
  • Correct-guess announcements
  • No repeat guesses after success
  • Hidden answers from other players
  • System messages

โšก Performance

  • Stroke-based canvas synchronization
  • Snapshot sync for late joiners
  • WebSocket communication via Socket.IO
  • Optimized canvas rendering

๐Ÿ–ผ Screenshots

Home Screen Gameplay
Home Screen Gameplay
Word Selection Final Scoreboard
Word Selection Scoreboard

๐Ÿ— Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Frontend (React + Tailwind) โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
              โ”‚  Socket.IO
              โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Backend (Node.js + Express) โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
              โ”‚  In-Memory Room State
              โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚        Game Engine         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ›  Tech Stack

Layer Technologies
Frontend React ยท Vite ยท Tailwind CSS ยท Socket.IO Client
Backend Node.js ยท Express.js ยท Socket.IO ยท CORS
Deployment Netlify (frontend) ยท Render (backend)

๐Ÿ“‚ Project Structure

scribble-game/
โ”‚
โ”œโ”€โ”€ client/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ CanvasBoard.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ToolBar.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ChatBox.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ PlayerList.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ GameBar.jsx
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ WordChooser.jsx
โ”‚   โ”‚   โ”œโ”€โ”€ socket.js
โ”‚   โ”‚   โ”œโ”€โ”€ App.jsx
โ”‚   โ”‚   โ””โ”€โ”€ main.jsx
โ”‚   โ””โ”€โ”€ package.json
โ”‚
โ”œโ”€โ”€ server/
โ”‚   โ”œโ”€โ”€ index.js
โ”‚   โ””โ”€โ”€ package.json
โ”‚
โ””โ”€โ”€ README.md

๐Ÿš€ Installation

1. Clone the repository

git clone https://github.com/YOUR_USERNAME/scribble-game.git
cd scribble-game

2. Backend setup

cd server
npm install

Create a .env file:

PORT=3001

Run the server:

npm start

Server runs at http://localhost:3001

3. Frontend setup

Open a new terminal:

cd client
npm install

Create a .env file:

VITE_BACKEND_URL=http://localhost:3001

Run the client:

npm run dev

Frontend runs at http://localhost:5173


๐ŸŒ Production Environment Variables

FrontendBackend
VITE_BACKEND_URL=https://your-render-backend.onrender.com
PORT=3001

๐Ÿ”Œ Socket Events

Client โ†’ Server

join-room
draw-stroke
fill-canvas
clear-canvas
undo-action
redo-action
start-round
choose-word
send-message
canvas-sync

Server โ†’ Client

room-update
draw-stroke
fill-canvas
clear-canvas
word-choices
round-started
timer-update
round-ended
correct-guess
receive-message
canvas-sync
system-message
game-ended

๐ŸŽฏ Game Flow

 Create Room
     โ”‚
     โ–ผ
 Invite Players
     โ”‚
     โ–ผ
 Drawer Chooses Word
     โ”‚
     โ–ผ
 Drawing Starts โ”€โ”€โ”€โ”€โ”€โ”€โ–บ Players Guess
     โ”‚                        โ”‚
     โ–ผ                        โ”‚
 Timer Ends / Everyone Guesses โ—„
     โ”‚
     โ–ผ
 Drawer Rotates โ”€โ”€โ–บ Next Round
     โ”‚
     โ–ผ
 Game Ends โ”€โ”€โ–บ Winner Announced

๐Ÿง  Challenges Solved

  • โœ… Real-time multiplayer synchronization
  • โœ… Canvas state management
  • โœ… Undo/redo synchronization
  • โœ… Late-join synchronization
  • โœ… Drawer rotation logic
  • โœ… Role-based gameplay permissions
  • โœ… Socket event architecture
  • โœ… Room state management

๐Ÿ”ฎ Future Improvements

  • Avatar system
  • Spectator mode
  • AI word generation
  • Private rooms with passwords
  • Drawing replay system
  • Mobile responsive UI
  • Persistent leaderboard
  • Redis for horizontal scaling
  • Docker deployment
  • Kubernetes support

๐Ÿค Contributing

Contributions are welcome! To get started:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“œ License

This project is licensed under the MIT License.


๐Ÿ‘จโ€๐Ÿ’ป Author

Dev Jain

GitHub LinkedIn


โญ If you liked this project, consider giving it a star! โญ

About

๐ŸŽจ A real-time multiplayer drawing and guessing game built with React, Socket.IO, and Node.js.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages