This application is a real-time turn management system for board games. It allows users to join rooms, track connected players, and manage turns. Admin users have additional control over the turn order.
Ensure you have Node.js installed on your system. npm (Node Package Manager) comes bundled with Node.js.
- Download and install Node.js from https://nodejs.org/.
- Verify installation by running the following commands in your terminal:
node -v npm -v
The server requires your machine's local IP address to allow other devices on the same network to connect.
-
On Windows:
Open the Command Prompt and run:ipconfig
Look for the
IPv4 Address
under your active network connection. Example:192.168.1.105
. -
On Linux:
Open a terminal and run:ifconfig
Look for the
inet
address under your active network connection. Example:192.168.1.105
.
Download the project files to your local machine.
Open a terminal in the project directory and run:
npm install
Edit the config.js
file to set up the application parameters:
- IP: Replace the
IP
field with your machine's local IP address (e.g.,192.168.1.105
). - PORT: Set the port number for the server (default is
3000
). - ROOMS: Customize the list of available rooms (e.g.,
['HEROQUEST', 'OTHER']
). - DEFAULT_COLOR: The default highlight color for users when
USE_COLORS
is set tofalse
. - USE_COLORS: Set to
true
to allow users to choose their own colors from theCOLORS
list. - COLORS: Define the available colors for users to choose from.
- GRACE_PERIOD: The time (in milliseconds) a disconnected user remains in the system before being removed (default is
30 minutes
).
Example config.js
:
const config = {
IP: '192.168.1.105',
PORT: 3000,
ROOMS: ['HEROQUEST', 'OTHER'],
GRACE_PERIOD: 30 * 60 * 1000,
DEFAULT_COLOR: '#FFDC95',
USE_COLORS: true,
COLORS: ['#999999', '#D72638', '#F57C00']
};
module.exports = config;
Run the following command in the terminal:
node server.js
The server will start and listen on the configured IP and port.
Users can join predefined rooms. You can customize the room names in the config.js
file.
- Admins:
- Admin users can generate the turn order for a room.
- Admins can control all turns, including advancing, going back to the previous turn, or regenerating the turn order.
- Regular Users:
- Users can only advance the turn when it is their turn.
- The turn order is always generated randomly.
- Admins can regenerate the turn order at any time.
- When a user disconnects, they remain in the system for the duration of the grace period (default: 30 minutes).
- During this time, their status is marked as inactive. After the grace period, they are removed from the system.
- If
USE_COLORS
is set totrue
, users can select their own color from theCOLORS
list. - If
USE_COLORS
is set tofalse
, all users will use theDEFAULT_COLOR
.
- The application is designed for use on a local network. Devices must be connected to the same network as the server.
- If you are unable to connect to the server, ensure that your device is on the same network as the server.
- If the issue persists, try disabling any active VPN or firewall that might be blocking the connection.
- Ensure there is at least one admin in a room to generate the turn order.
- The
config.js
file is the only file you need to modify to customize the application settings. If the config.js file is modified, the server must be restarted (with command: node server.js). - You can create "ghost" players (fake players) by extending the grace period and joining the application using an incognito browser session.