A modern, multiplayer web-based implementation of AshtaPashaka (अष्टपाशक), an 8-player variant of the classic board game Ludo. Play with friends in real-time using WebSockets!
- Overview
- Game Rules
- Features
- Technology Stack
- Setup & Installation
- Running the Game
- Game Controls
- Architecture
AshtaPashaka (अष्टपाशक) means "Eight Players" in Sanskrit. This is a digital adaptation of the classic Ludo board game designed for 8 concurrent players. The game features:
- 🌐 Real-time multiplayer gameplay
- 🎲 Dice-based turn-based mechanics
- 🏠 Home bases and home stretches for each player
- 👥 Support for 2-8 players (with spectator mode for extra players)
- ⏱️ Turn time limit system (10 seconds per turn)
- 🎨 Distinct color-coded pieces for each player
- 8-Player Board: A circular board with 8 home bases positioned at cardinal and diagonal directions
- 104 Total Track Cells: 13 cells per player (8 players × 13 = 104 cells)
- Home Stretch: 4 cells in the home stretch leading to the center (finish position)
- Players: 2-8 players (each with a unique color)
- Pieces: Each player has 4 tokens/pieces
- Starting Position: All pieces begin in the home base
- Turn Limit: 10 seconds per turn
- Players roll a virtual dice showing values 1-6
- Players must roll in their turn (if you don't move within 10 seconds, turn passes to the next player)
- A piece can only exit the home base with a roll of 6
- When you roll a 6, one of your pieces enters the track
- Rolling a 6 gives you another turn (standard Ludo rule)
- After rolling, you move one of your pieces by the number shown on the dice
- Each piece moves along the circular track
- The track is divided into 8 sections (one per player, 13 cells each)
- After traveling around the main track, a piece enters the home stretch
- Once a piece reaches the home stretch (4 cells before center), it moves along the home stretch
- Important: You must roll the exact number to reach the finish (center)
- You cannot "overshoot" the finish - the move is only valid if it lands exactly on the finish position
- If your piece lands on the same cell as an opponent's piece, the opponent's piece is captured
- Captured pieces return to their home base
- Safe Zones: Pieces in their own home base cannot be captured
- First player to get all 4 pieces to the center wins
- The other players continue if desired
- Exact Roll Required to Finish: Unlike standard Ludo, you must roll the exact number to land on the finish cell. For example, if you're 3 cells away from finish, you must roll a 3.
- Turn Timer: If a player doesn't make a move within 10 seconds, their turn automatically passes to the next player
- Spectator Mode: When a room is full (8 players), additional players can join as spectators
- Real-Time Multiplayer: Play with friends using WebSocket connections
- Room-Based Gameplay: Create or join rooms with unique room codes
- Persistent Connection: Reconnect to your game if your connection drops
- Turn Timer: Automatic turn progression with a 10-second countdown
- Spectator Mode: Watch active games as a spectator
- Responsive UI: Modern, intuitive interface with smooth animations
- IP-Based Tracking: Server tracks players by IP for reconnection support
- Toast Notifications: Real-time feedback for game events
- React 19.2+: UI framework
- Vite 7.2+: Build tool and dev server
- JavaScript ES6+: Core language
- CSS3: Styling with CSS variables and Flexbox/Grid
- Node.js: Runtime environment
- WebSocket (ws): Real-time bidirectional communication
- UUID: Unique identifier generation
- ES6 Modules: Modern JavaScript modules
- Client-Server Model: Real-time bidirectional communication via WebSockets
- Room-Based State Management: Each game room has its own state
- Server-Side Game Logic: All game rules enforced on the server
- Node.js (v16 or higher)
- npm or yarn package manager
git clone https://github.com/BKarthik7/AshtaPashaka.git
cd AshtaPashakacd client
npm installcd server
npm installcd server
npm start
# or for development with auto-reload:
npm run devThe server will start on http://localhost:3001 by default.
In a new terminal:
cd client
npm run devThe client will start on http://localhost:5173 by default and automatically open in your browser.
PORT=3001 # WebSocket server port (default: 3001)
The client is configured to connect to localhost:3001 by default. Modify if your server is on a different host/port.
- Enter Your Name: Type your player name
- Create Room: Host a new game (generates a unique room code)
- Join Room: Join an existing game with a room code
- Wait for Players: Other players join using your room code
- Start Game: When at least 2 players are ready, the host can start the game
- Leave Room: Exit the lobby and return to landing page
- Roll Dice: Click the dice area when it's your turn (turn timer shows how much time is left)
- Select Piece: After rolling, click on one of your valid pieces to move it
- Watch Others: View other players' moves and piece positions in real-time
- Game Over: When you win, click "Back to Lobby" to return to the lobby
- 🎲 Turn Timer: Shows remaining seconds for the current player
- Valid Moves: Highlighted pieces that can be moved based on the current dice roll
- Player Colors: Each player has a distinct color badge
- Piece Positions: Visual representation of all pieces on the board
AshtaPashaka/
├── client/ # React frontend
│ ├── src/
│ │ ├── pages/ # Page components
│ │ │ ├── LandingPage.jsx # Start screen
│ │ │ ├── Lobby.jsx # Room lobby
│ │ │ └── Game.jsx # Main game board
│ │ ├── components/ # Reusable components
│ │ │ ├── GameBoard.jsx # Board visualization
│ │ │ ├── Dice.jsx # Dice component
│ │ │ └── PlayerList.jsx # Player list sidebar
│ │ ├── context/ # React context
│ │ │ └── GameContext.jsx # Global game state
│ │ ├── hooks/ # Custom hooks
│ │ │ └── useWebSocket.js # WebSocket management
│ │ └── styles/ # Global styles
│ ├── vite.config.js # Vite configuration
│ └── package.json
│
└── server/ # Node.js backend
├── lib/
│ ├── GameManager.js # Game logic & rules
│ ├── RoomManager.js # Room management
│ └── IPTracker.js # Player IP tracking
├── index.js # WebSocket server & routing
└── package.json
- Connection: Player connects to server via WebSocket
- Room Creation/Joining: Player creates new room or joins existing with code
- Lobby State: Players wait in lobby until game is started
- Game Start: All players moved to game board, game state initialized
- Turn Cycle:
- Player rolls dice
- Valid moves calculated based on dice value
- Player selects piece to move
- Piece moves, captures checked
- Turn passes to next player
- Win Condition: First player to get all 4 pieces to center wins
- Game Over: Game ends, players can return to lobby
CREATE_ROOM: Create a new game roomJOIN_ROOM: Join an existing room by codeSTART_GAME: Start the game (host only)ROLL_DICE: Roll the diceMOVE_PIECE: Move a specific pieceLEAVE_ROOM: Leave the current room
CONNECTED: Initial connection confirmationRECONNECTED: Reconnection to existing sessionROOM_STATE: Current state of the roomGAME_STATE: Current state of the gameGAME_STARTED: Game has begunTURN_UPDATE: Turn changed to new playerPIECE_MOVED: A piece has moved (with new state)GAME_OVER: Game has ended with winner
The game uses 8 distinct colors for players:
- 🔵 Blue - Player 1
- 🔴 Red - Player 2
- 🟣 Purple - Player 3
- 🟢 Green - Player 4
- 🟡 Yellow - Player 5
- ⚫ Black - Player 6
- 🟠 Orange - Player 7
- 🩷 Pink - Player 8
- Circular board with 8 home bases at cardinal and diagonal positions
- Wavy track pattern representing movement sections
- Clear visual distinction between main track and home stretch
- Animated piece movements and dice rolls
- IP-Based Player Tracking: Server tracks players by IP to prevent multi-accounting
- Server-Side Validation: All game moves validated on the server
- Connection Recovery: Players can reconnect and resume their game
- Room Isolation: Games in separate rooms don't interfere with each other
- Exact Roll to Finish: Remember that you need an exact roll to reach the center. Plan ahead!
- Time Management: Keep an eye on the 10-second turn timer
- Capture Strategy: Try to capture opponent pieces to send them back home
- Multiple Pieces: Having multiple pieces on the track increases your movement flexibility
The backend includes a comprehensive test suite using Jest.
To run the backend tests:
cd server
npm testThe test suite covers:
- GameManager: Rules, turns, movement, and capturing logic
- RoomManager: Room lifecycle, spectator handling, and broadcasting
- IPTracker: Player session tracking and reconnection logic
Current Status: 51 tests passing with high code coverage (~80-98%).
- Maximum 8 players per room (by design)
- Spectators cannot participate in the game
- Turn timer is fixed at 10 seconds
- Local IP-based player tracking (may not work across different networks)
This project is open-source and available for learning and non-commercial use.
Feel free to fork, improve, and submit pull requests! Some ideas for enhancement:
- Power-ups and special moves
- Different difficulty levels
- Game statistics and leaderboards
- Mobile app version
- Chat system for players
For questions or suggestions, please open an issue on GitHub.
Happy Gaming! 🎲🏆
Enjoy playing AshtaPashaka with your friends!