V6 Game Server
raw JSON → 0.12.396 verified Fri May 01 auth: no javascript maintenance
A Node.js server for turn-based games (board games, card games, etc.), current version 0.12.396. Provides WebSocket-based multiplayer with configurable turn timers, reconnection handling, spectator mode, MongoDB/Redis integration for persistence and ranking, and admin controls. Differentiators include flexible timer modes (per-turn, per-switch, common time, addTime), penalty/timeout systems, and cheat detection via unfocused turns. Released under an unspecified cadence, likely maintenance mode as updates are infrequent. Primarily documented in Russian.
Common errors
error TypeError: Server is not a constructor ↓
cause Using destructuring import like const { Server } = require('v6-game-server') results in undefined
fix
Replace with const Server = require('v6-game-server')
error SyntaxError: Cannot use import statement outside a module ↓
cause Attempting to use ES import syntax with this CJS-only package
fix
Use require() instead, or convert your project to CommonJS
error Error: listen EADDRINUSE :::8080 ↓
cause Port already in use, or multiple instances trying to use same port
fix
Change conf.port to an available port or kill the process using the port
error MongoError: failed to connect to server [127.0.0.1:27017] ↓
cause MongoDB not running or not accessible
fix
Start MongoDB or update conf.mongo with correct host/port; or set mode:'develop' to bypass DB
Warnings
gotcha package is CJS-only; ESM imports will fail ↓
fix Use require() instead of import
gotcha require returns the Server constructor directly, not an object with a Server property ↓
fix Use const Server = require('v6-game-server') not const { Server } = require(...)
gotcha MongoDB and Redis are required for persistence even with mode:'develop'? ↓
fix Ensure MongoDB and Redis servers are running and accessible or set mode:'develop' to skip DB, but note this may disable some features.
deprecated The documentation shows require() with two arguments which is invalid in Node.js ↓
fix Use the correct pattern: const Server = require('v6-game-server'); const server = new Server(conf, engine);
Install
npm install v6-game-server yarn add v6-game-server pnpm add v6-game-server Imports
- default wrong
import Server from 'v6-game-server'correctconst Server = require('v6-game-server') - Server wrong
const { Server } = require('v6-game-server')correctconst Server = require('v6-game-server').default || require('v6-game-server') - Server wrong
const server = new require('v6-game-server')(conf, engine)correctconst Server = require('v6-game-server')
Quickstart
const Server = require('v6-game-server');
const conf = {
game: 'mygame',
port: 8080,
turnTime: 60,
timeMode: 'reset_every_turn',
timeStartMode: 'after_turn',
maxTimeouts: 2,
mongo: {
host: '127.0.0.1',
port: '27017'
},
redis: {
host: '127.0.0.1',
port: '6379'
}
};
const engine = {
// Your game logic here
};
const server = new Server(conf, engine);
server.start();