This is a game called Bughouse Chess - a special variant of chess for 4 players. This project includes both server and client (web interface written in mighty React). This is still an alpha version / experiment / proof of concept. Tests, server persistence and more features coming soon.
👉 LIVE DEMO - https://chessb.com 👈
-
communication based on Socket.io
-
Redux used on both sides (client and server), both sides can easily dispatch actions locally or remotely, thanks to socketMiddleware.js and action flags:
room
= server -> player(s)remote
= player -> serverbroadcast
= server -> all players
-
every game has an unique ID and URL that is generated and refreshed/synced by the server
-
all game rules are checked/enforced on both client and server - significant chunks of code are shared between client and server
-
very precise time control (in ms), clients are running their own counters but also getting array of move timestamps from the server, which is used for synchronization
-
the server is pretty minimalistic (750 lines of code)
-
there is one (mostly) immutable state for client and server, everything is definied as
(state, action) => state
-
stylish drag&droping using react-dnd
-
babel, webpack and all other goodies...
- Node.js 5+
- Npm 3+
- MongoDB 3+
- recommended: React Developer Tools and Redux DevTools
Make sure this works:
node --version
npm --version
On some systems, node is installed as nodejs
, you need to create alias node
.
git clone git@github.com:tajo/chessb.git
cd chessb
npm install
npm start
open http://localhost:8000
npm run build
NODE_ENV=production node src/server
open http://localhost:8000
or
npm run build
npm install -g forever
npm run server // using https://www.npmjs.com/package/forever
open http://localhost:8000
npm run lint
npm test