@antha/multiplayer-server 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +54 -0
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1 +1,55 @@
1
1
  # @antha/multiplayer-server
2
+
3
+ This package provides the server that [Antha](https://www.npmjs.com/package/@antha/engine) 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.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm i @antha/multiplayer-server
9
+ ```
10
+
11
+ ## API
12
+
13
+ <!-- example-link: src/readme-examples/starting-server.example.ts -->
14
+
15
+ ```TypeScript
16
+ import {AnyOrigin} from '@rest-vir/api';
17
+ import {startMultiplayerServer} from '@antha/multiplayer-server';
18
+
19
+ await startMultiplayerServer({
20
+ backendOrigin: 'http://localhost:9348',
21
+ games: {
22
+ default: AnyOrigin,
23
+ },
24
+ host: 'localhost',
25
+ lockPort: true,
26
+ port: 9348,
27
+ });
28
+ ```
29
+
30
+ ## CLI
31
+
32
+ The `start-mp-server` command accepts a required path to a JavaScript, TypeScript, JSON, YAML, or TOML configuration file. The configuration uses the same options as `startMultiplayerServer`.
33
+
34
+ Create a configuration file:
35
+
36
+ <!-- example-link: src/readme-examples/multiplayer-server-config.example.ts -->
37
+
38
+ ```TypeScript
39
+ export default {
40
+ games: {
41
+ byId: {
42
+ 'example-game-id': 'https://electrovir.github.io',
43
+ },
44
+ },
45
+ host: '127.0.0.1',
46
+ lockPort: true,
47
+ port: 9348,
48
+ };
49
+ ```
50
+
51
+ Start the server with the configuration file path:
52
+
53
+ ```sh
54
+ npx start-mp-server ./multiplayer-server.config.mjs
55
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antha/multiplayer-server",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "An multiplayer server that can be used with the Antha multiplayer mod.",
5
5
  "keywords": [
6
6
  "vir",
@@ -38,8 +38,8 @@
38
38
  "test:docs": "virmator docs check"
39
39
  },
40
40
  "dependencies": {
41
- "@antha/multiplayer-core": "^0.1.0",
42
- "@antha/multiplayer-p2p-lock-step": "^0.1.0",
41
+ "@antha/multiplayer-core": "^0.1.1",
42
+ "@antha/multiplayer-p2p-lock-step": "^0.1.1",
43
43
  "@augment-vir/assert": "^32.2.2",
44
44
  "@augment-vir/common": "^32.2.2",
45
45
  "@augment-vir/node": "^32.2.2",
@@ -61,7 +61,7 @@
61
61
  "tsx": "^4.23.11"
62
62
  },
63
63
  "peerDependencies": {
64
- "@antha/engine": "^0.1.0"
64
+ "@antha/engine": "^0.1.1"
65
65
  },
66
66
  "engines": {
67
67
  "node": ">=22"