Skip to content

macmorning/chess-hub

Repository files navigation

chess-hub

The goal of this project is to provide a set of web components for online chess play.

  • chess server (the hub)
  • JS client library for hub connection
  • JS client library for board & pieces creation & manipulation
  • HTML+CSS+JS client

The 1st version is "hit & run" style. The user provides a login name (no auth) and is directed to the main page, which includes a basic chat system and a form. The form allows the user to search for a game (level, and level span tolerancy). If no game is found, a new one is created. The user is then directed to the board. He "sits" in one of the free chairs (blacks or whites). The game starts when both chairs are occupied.

Head to http://www.chess-hub.net/ to try it.


Current state

server  : |==============================================================================================>     | 95%

client  : |==============================================================================================>     | 95%

Installation

  • install nodejs & npm
  • create a dir & run git clone
  • npm install (installs all gruntjs dependencies)
  • (sudo) npm install -g grunt-cli (if you wish to use grunt)
  • node server.js
  • open in browser

server - the Hub

Built with NodeJS. No framework. Using gruntjs with jslint & uglify.

1st version Goals :

  • do everything with nodejs : routing, serving static files, handling connections and messaging
  • simple login (no login/password database, IRC style) : give a login name, if it's free then you're in
  • use a simple dialog protocol based on json post requests, allowing the use of custom clients
  • messaging : 1 main lobby, 1 channel per game, direct messages, IRC style ("XX has joined #MyGame", "@YY Hey !", ...)
  • find a partner based on : self-estimated level (beginner, experienced, master, great master)
  • learning games : have a willing master+ and a willing beginner play together
  • must be playable through proxies => long polling instead of web sockets (will implement sockets later with polling as a fallback method)
  • limit the number of clients
  • user timeout

Nice to have :

  • save games to files
  • web sockets connection
  • allow a user to watch an ongoing game
  • allow a user to open multiple boards
  • should enforce chess rules (don't delegate all to clients)

TODO

  • handle the user key (to avoid user impersonnification)
  • handle user timeout
  • handle multiple channel polling for each client
  • receive array of moves (for composite moves like castling or promoting) instead of one service call per move
  • handle timed games

client - chessHubClient

Built in JS. Requires jQuery, mostly for asynchronous calls.

Library that handles connection and messaging with the Hub.

TODO

  • handle the user key (to avoid user impersonnification)
  • send an array of moves (for composite moves like castling or promoting) instead of one service call per move

client - chessHubBoard

Built in JS. Requires jQuery, mostly for DOM objects manipulation.

Library that handles board and pieces creation & manipulation.

TODO

  • generate the board
  • generated pieces objects
  • spawn the pieces and place them
  • handle the moves
  • enforce pieces move restrictions
    • rethink the _canMove and _isCheck functions; should not rely on the dom
    • maintain an array of squares with their pieces for fast search
  • finish the "sit" process
  • enforce other rules (check, check mate, castling, en passant)
  • display whose turn it is
  • allow to show last move
  • handle timed games

client

Built in HTML/CSS/JS and jQuery Mobile. Requires jQuery.

1st version Goals :

  • as simple as possible
  • 3 pages :
    • login screen (no auth, just give a username)
    • main page : preferences, search a game, chat lobby
    • board page : board, local chat, users list (black player, white player, spectators)
  • responsive design
  • save games into local storage and replay
  • export saved games
  • offline capable :
    • play a saved game
    • ...?

TODO

  • correctly place & render the board
  • add chat to games
  • add a "create" function
  • allow users to join a specific game
    • via an url
    • via a link in the main chat page
  • add a "invite" button
    • via Twitter,
    • email,
    • or other services
  • finish the main page design
  • work on the login page; describe the app, show the stats
  • save the context into local storage
  • handle reconnection (or page refresh)

About

Hub for online chess playing, server + client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published