# Chinese Chess

**A Chinese chess game made with HTML5.**

## Summary

It's a very simple game to demonstrate how the Chinese chess (Xiangqi) works. A single player can play both sides, or there is also a tiny server program to let two players play with each other. The game doesn't contain AI functionality.

Any modern web browser should be able to run this game. The game has been tested on the latest version of Mozilla Firefox and Google Chrome. Although the game itself doesn't rely on any external codes, but the menu (`menu.html`) does. The menu required [jQuery](https://jquery.com/) and [Bootstrap 4](https://getbootstrap.com/) to run, which is not included in the package.

The current implementation of the game server is built upon Node.js and WebSocket. In order to simplify the test deployment, I only made the insecure setup in my client/server implementation. But in the production environment, WebSocket connections should always be encrypted, much like HTTPS.

## How to run the game server
```
cd chinese_chess/server
npm install
npm start
```

The first joined player will always be the red side (move first), and the second joined player will be the black side. Note: each server instance is meant to service two players only. Clients reconnected or any more clients connected will force the server to start a new match and literally abandon the current match.

## ChangeLog

20230912:
- Bug fix for the images being reloaded repeatedly on Google Chrome.

20200423:
 - Online play: add a broadcast message from the server side to notify clients if there is a new move ready to sync. So the client side which is waiting for the other player's move is no longer asking the server every second.
 - Online play: explicitly disable the mouse functionality when waiting for the other player's move.

20200418:
 - The first public release.

#### Author: DarkRanger (https://darkranger.no-ip.org)
#### License: MIT License
