Skip to content

RohanJha17/knight-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Knight Sync

A real-time multiplayer chess game with voice chat, built using Node.js, Express, Socket.io, and chess.js. Play chess with friends or spectate games, all in your browser.


Features

  • Real-time Multiplayer Chess: Play chess with anyone by sharing a room ID.
  • Spectator Mode: Join any room as a spectator if both player slots are filled.
  • Live Board Updates: All moves are instantly reflected for all players and spectators.
  • Drag-and-Drop Interface: Move pieces with intuitive drag-and-drop controls.
  • Game State Sync: Join an ongoing game and instantly see the current board.
  • Restart Game: Players can restart the game at any time.
  • Voice Chat: Built-in peer-to-peer voice chat for players in the same room.
  • Responsive UI: Works on desktop and mobile browsers.

Getting Started

Prerequisites

Installation

  1. Clone the repository:

    git clone <your-repo-url>
    cd Chess
  2. Install dependencies:

    npm install
  3. Build Tailwind CSS (if needed):

    npx tailwindcss -i ./public/css/tailwind.css -o ./public/css/output.css --watch

    You can skip this step if output.css is already present.

  4. Start the server:

    npm start
  5. Open your browser and go to: http://localhost:3000


How to Play

  1. Enter a Room ID:
    • On page load, enter a unique Room ID to create or join a game room.
  2. Share the Room ID:
    • Share the Room ID with your friend to play together.
  3. Player Roles:
    • The first to join is White, the second is Black. Others join as spectators.
  4. Move Pieces:
    • Drag and drop pieces to make moves. Legal moves are enforced.
  5. Restart Game:
    • Players can restart the game using the Restart button.
  6. Voice Chat:
    • Click 'Start Voice' to enable voice chat. Allow microphone access when prompted.
    • Use 'Mute' to toggle your microphone.

Project Structure

  • app.js — Main server file (Express + Socket.io)
  • public/ — Static assets (CSS, JS)
    • js/chessgame.js — Frontend logic for chess and voice chat
    • css/ — Tailwind CSS files
  • views/index.ejs — Main HTML template
  • package.json — Project dependencies and scripts

Technologies Used

  • Node.js
  • Express
  • Socket.io
  • chess.js
  • EJS
  • Tailwind CSS
  • WebRTC (for voice chat)

Live Demo

Live Link:


Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.


Acknowledgements

About

A real-time multiplayer chess game with voice chat, built using Node.js, Express, Socket.io, and chess.js. Play chess with friends or spectate games, all in your browser.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors