@antha/multiplayer-server
v0.29.1
Published
An multiplayer server that can be used with the Antha multiplayer mod.
Maintainers
Readme
@antha/multiplayer-server
This package provides the server that Antha multiplayer clients use for room discovery and WebRTC signaling. It is only used for listing and connecting to rooms. Actual game state transfer is expected to be p2p.
Install
npm i @antha/multiplayer-serverAPI
import {AnyOrigin} from '@rest-vir/api';
import {startMultiplayerServer} from '@antha/multiplayer-server';
await startMultiplayerServer({
backendOrigin: 'http://localhost:9348',
games: {
default: AnyOrigin,
},
host: 'localhost',
lockPort: true,
port: 9348,
});CLI
The start-mp-server command accepts a required path to a JavaScript, TypeScript, JSON, YAML, or TOML configuration file.
Create a configuration file:
export default {
games: {
byId: {
'example-game-id': 'https://electrovir.github.io',
},
},
host: '127.0.0.1',
lockPort: true,
port: 9348,
};Start the server with the configuration file path:
npx start-mp-server ./multiplayer-server.config.mjsThe ensure-service package is recommended for making sure the server stays up.
