Skip to content
2d multiplayer action game server for Node.js based on WebSocket communication.
TypeScript HTML Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
admin
cache
certs
data
docs
src
.dockerignore
.env.example
.env.production
.gitignore
CHANGES.md
Dockerfile
LICENSE
README.md
package-lock.json
package.json
tsconfig.json
tsconfig.prod.json

README.md

ab-server

Game server.

Features:

Installation

Requirements:

  • Node.js 12 (works on older versions too, but compatibility isn't guaranteed).
  • uWebSockets.js is C++ lib and distributed in binary files for the most popular operation systems, so it is unlikely, but you may have to compile it from source if you use an unpopular OS.

Development:

npm i
cp .env.example .env

Set SU_PASSWORD variable value.

Build

npm run build:dev

or watch

npm run watch

And start

npm run start

Settings

Available environment variables.

User accounts

The current implementation does not support accounts synchronization between server instances.

User accounts data are stored in ./data/user-stats.json and in memory during the server run. Set USER_ACCOUNTS to false to turn user accounts off.

Each user session is signed by the login server (Ed25519). Validation uses the public key, which is downloaded when the server starts. To change the default key server URL set AUTH_LOGIN_SERVER_KEY_URL variable value (only https is supported).

Moderation Panel

The server exports a /admin URL to allow privileged players to moderate the game, and a public log to allow everyone to see moderation actions.

Add passwords to admin/passwords.txt like so:

wight:somepasswordforwight

The username is only used to enter a name into the log.

Set MODERATION_PANEL to false to turn moderation panel off. To change panel URL set MODERATION_PANEL_URL_ROUTE variable value (admin by default).

"How to run" examples

Docker

.env.production is default .env file for docker image.

  1. Build an image. docker build -t airbattle-server .

  2. Run. Don't forget to pass envirounment variables and mount the volumes you need. Example:

    docker run -v /host/logs:/app/logs -v /host/data:/app/data -p 3501:3501 -e SERVER_TYPE=FFA -e SU_PASSWORD=mypass airbattle-server

    If you want to use TLS also mount /app/certs to the host directory with privkey.pem and fullchain.pem, and set ENDPOINTS_TLS=true.

Run directly or behind the proxy

cp .env.production .env
npm i
npm run build
npm prune --production
node ./dist/app.js

or use some kind of process managers.

If you run the server behind the proxy it is important to pass the real IP to the server (X-Real-IP or X-Forwarded-For header).

Contribution

  1. Server performance is important. Some bots (like https://github.com/airmash-refugees/airmash_bot) generate many packets espesially in -follow me mode, you can use them to test.
  2. There are eslint rules here, please don't forget about this.
You can’t perform that action at this time.