P2P chess built on PeerPigeon using decentralized WebRTC mesh networking.
- ๐ฎ Fully Decentralized P2P Chess - No central server required for gameplay
- ๐ End-to-End Encrypted - All moves are transmitted securely using PeerPigeon's encryption
- ๐ฒ Random Color Assignment - Fair color selection for each game
- โ๏ธ Full Chess Rules - Complete chess implementation with legal move validation
- ๐ Game History - Track your wins, losses, and draws locally
- โ๏ธ Configurable Signaling - Add custom PigeonHub URIs for peer discovery
- ๐ฑ Responsive Design - Chess board scales to fill viewport height
- ๐ WebRTC Mesh Network - Automatic peer discovery and connection management
- Node.js 18+
- Modern web browser with WebRTC support
npm installnpm run devThen open http://localhost:5173 in two different browser windows or tabs.
npm run build- Initialize: Click the "Initialize" button to set up your peer connection
- Connect: Click "Connect to Network" to join the PigeonChess network
- Find Opponent: When another player connects, they'll appear in your peer list
- Challenge: Click the "Challenge" button next to a peer to start a game
- Play: Colors are randomly assigned, and the board flips for the black player
- Resign: Use the resign button if you want to concede the game
PigeonChess uses PeerPigeon for decentralized peer-to-peer communication:
- Signaling: Initial peer discovery via PigeonHub (WebSocket signaling servers)
- Transport: Direct WebRTC DataChannels for move transmission
- Encryption: End-to-end encrypted messages using PeerPigeon's built-in crypto
- DHT: Distributed hash table for game state synchronization
- Vue 3 - Reactive UI framework
- TypeScript - Type-safe development
- PeerPigeon - WebRTC mesh networking library
- chess.js - Chess game logic and validation
- Vite - Fast build tool and dev server
src/
โโโ components/
โ โโโ ChessBoard.vue # Interactive chess board component
โ โโโ GameHistory.vue # Game history modal
โ โโโ SettingsModal.vue # Settings configuration
โโโ composables/
โ โโโ useChessGame.ts # Chess game state management
โ โโโ usePeerPigeon.ts # P2P networking wrapper
โ โโโ useSettings.ts # Persistent settings
โโโ types/
โ โโโ index.ts # TypeScript type definitions
โโโ utils/
โ โโโ helpers.ts # Utility functions
โโโ App.vue # Main application component
โโโ main.ts # Application entry point
โโโ style.css # Global styles
Default signaling servers:
wss://pigeonhub.fly.dev(Primary, global)wss://pigeonhub-server-3c044110c06f.herokuapp.com(Secondary, US region)
You can add custom signaling servers via the Settings menu (โ๏ธ button).
The default network name is pigeonchess. All peers on the same network can discover each other.
{
type: 'gameStart' // Initiate a new game
type: 'move' // Transmit a chess move
type: 'resign' // Forfeit the game
type: 'offerDraw' // Propose a draw
type: 'acceptDraw' // Accept draw offer
type: 'rejectDraw' // Reject draw offer
}Moves are transmitted using Standard Algebraic Notation (SAN) via encrypted P2P messages:
{
type: 'move',
gameId: 'game-1234567890',
data: { from: 'e2', to: 'e4' }
}- Peer ID: Stored in localStorage for session persistence
- Settings: Network configuration saved locally
- Game History: Last 50 games stored locally (wins, losses, draws)
Tested and working on:
- Chrome 89+
- Firefox 102+
- Safari 14.1+
- Edge 89+
- Brave
Requires:
- WebRTC support
- Web Cryptography API
- ES2020+
- LocalStorage
npm run devnpm run buildnpm run preview- Ensure firewall allows WebRTC connections
- Try a different signaling server
- Check browser console for errors
- Verify WebRTC support in your browser
- Both players must be connected to the same network
- Accept incoming challenge notifications
- Ensure JavaScript is enabled
- Check internet connection
- Verify peer connection status (green = connected)
- Try refreshing and reconnecting
Contributions are welcome! Please feel free to submit a Pull Request.
MIT ยฉ PeerPigeon Contributors
- PeerPigeon - P2P mesh networking library
- PigeonHub - Signaling server
- chess.js - Chess logic library
Built with โค๏ธ using PeerPigeon's decentralized mesh networking technology.