@quake2ts/server 0.0.1 → 0.0.739
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.
- package/dist/cjs/index.cjs +1537 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/esm/index.js +1505 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/client.d.ts +52 -0
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/dedicated.d.ts +73 -0
- package/dist/types/dedicated.d.ts.map +1 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/net/nodeWsDriver.d.ts +17 -0
- package/dist/types/net/nodeWsDriver.d.ts.map +1 -0
- package/dist/types/protocol/player.d.ts +3 -0
- package/dist/types/protocol/player.d.ts.map +1 -0
- package/dist/types/protocol/write.d.ts +8 -0
- package/dist/types/protocol/write.d.ts.map +1 -0
- package/dist/types/protocol.d.ts +18 -0
- package/dist/types/protocol.d.ts.map +1 -0
- package/dist/types/server.d.ts +51 -0
- package/dist/types/server.d.ts.map +1 -0
- package/dist/types/transport.d.ts +8 -0
- package/dist/types/transport.d.ts.map +1 -0
- package/dist/types/transports/websocket.d.ts +12 -0
- package/dist/types/transports/websocket.d.ts.map +1 -0
- package/package.json +26 -14
- package/test-results/junit.xml +111 -0
- package/tsconfig.json +11 -5
- package/tsup.config.ts +10 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NetDriver } from '@quake2ts/shared';
|
|
2
|
+
import WebSocket from 'ws';
|
|
3
|
+
export declare class WebSocketNetDriver implements NetDriver {
|
|
4
|
+
private socket;
|
|
5
|
+
private messageCallback;
|
|
6
|
+
private closeCallback;
|
|
7
|
+
private errorCallback;
|
|
8
|
+
connect(url: string): Promise<void>;
|
|
9
|
+
attach(socket: WebSocket): void;
|
|
10
|
+
disconnect(): void;
|
|
11
|
+
send(data: Uint8Array): void;
|
|
12
|
+
onMessage(callback: (data: Uint8Array) => void): void;
|
|
13
|
+
onClose(callback: () => void): void;
|
|
14
|
+
onError(callback: (error: Error) => void): void;
|
|
15
|
+
isConnected(): boolean;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=nodeWsDriver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeWsDriver.d.ts","sourceRoot":"","sources":["../../../src/net/nodeWsDriver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,SAAS,MAAM,IAAI,CAAC;AAE3B,qBAAa,kBAAmB,YAAW,SAAS;IAClD,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,eAAe,CAA6C;IACpE,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,aAAa,CAAyC;IAExD,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuDzC,MAAM,CAAC,MAAM,EAAE,SAAS;IAkCxB,UAAU,IAAI,IAAI;IAOlB,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAQ5B,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI;IAIrD,OAAO,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI;IAInC,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI;IAI/C,WAAW,IAAI,OAAO;CAGvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"player.d.ts","sourceRoot":"","sources":["../../../src/protocol/player.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BinaryWriter, ServerCommand } from '@quake2ts/shared';
|
|
2
|
+
/**
|
|
3
|
+
* Writes a server command and its arguments to a BinaryWriter.
|
|
4
|
+
* This handles the serialization of generic arguments passed to multicast/unicast
|
|
5
|
+
* into the specific binary format expected by the protocol.
|
|
6
|
+
*/
|
|
7
|
+
export declare function writeServerCommand(writer: BinaryWriter, event: ServerCommand, ...args: any[]): void;
|
|
8
|
+
//# sourceMappingURL=write.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../../src/protocol/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAoB,MAAM,kBAAkB,CAAC;AAGjF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAmFnG"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BinaryStream, UserCommand } from '@quake2ts/shared';
|
|
2
|
+
export interface ClientMessageHandler {
|
|
3
|
+
onMove(checksum: number, lastFrame: number, userCmd: UserCommand): void;
|
|
4
|
+
onUserInfo(info: string): void;
|
|
5
|
+
onStringCmd(cmd: string): void;
|
|
6
|
+
onNop(): void;
|
|
7
|
+
onBad(): void;
|
|
8
|
+
}
|
|
9
|
+
export declare class ClientMessageParser {
|
|
10
|
+
private stream;
|
|
11
|
+
private handler;
|
|
12
|
+
constructor(stream: BinaryStream, handler: ClientMessageHandler);
|
|
13
|
+
parseMessage(): void;
|
|
14
|
+
private parseMove;
|
|
15
|
+
private parseUserInfo;
|
|
16
|
+
private parseStringCmd;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAiB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE5E,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IACxE,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,KAAK,IAAI,IAAI,CAAC;IACd,KAAK,IAAI,IAAI,CAAC;CACf;AAED,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,OAAO,CAAuB;gBAE1B,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,oBAAoB;IAKxD,YAAY,IAAI,IAAI;IA0B3B,OAAO,CAAC,SAAS;IAoCjB,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,cAAc;CAIvB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { CollisionModel } from "@quake2ts/shared";
|
|
2
|
+
import { EntityState } from "@quake2ts/shared";
|
|
3
|
+
import { Client } from "./client.js";
|
|
4
|
+
/**
|
|
5
|
+
* ServerState corresponds to server_state_t in the original source.
|
|
6
|
+
*/
|
|
7
|
+
export declare enum ServerState {
|
|
8
|
+
Dead = 0,// no map loaded
|
|
9
|
+
Loading = 1,// spawning level edicts
|
|
10
|
+
Game = 2,// actively running
|
|
11
|
+
Cinematic = 3,
|
|
12
|
+
Demo = 4,
|
|
13
|
+
Pic = 5
|
|
14
|
+
}
|
|
15
|
+
export interface Challenge {
|
|
16
|
+
adr: string;
|
|
17
|
+
challenge: number;
|
|
18
|
+
time: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* ServerStatic holds the state that is constant across server restarts.
|
|
22
|
+
* Corresponds to server_static_t in the original source.
|
|
23
|
+
*/
|
|
24
|
+
export interface ServerStatic {
|
|
25
|
+
initialized: boolean;
|
|
26
|
+
realTime: number;
|
|
27
|
+
mapCmd: string;
|
|
28
|
+
spawnCount: number;
|
|
29
|
+
clients: (Client | null)[];
|
|
30
|
+
lastHeartbeat: number;
|
|
31
|
+
challenges: Challenge[];
|
|
32
|
+
demoFile?: any;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Server holds the state for the current running server instance.
|
|
36
|
+
* Corresponds to server_t in the original source.
|
|
37
|
+
*/
|
|
38
|
+
export interface Server {
|
|
39
|
+
state: ServerState;
|
|
40
|
+
attractLoop: boolean;
|
|
41
|
+
loadGame: boolean;
|
|
42
|
+
startTime: number;
|
|
43
|
+
time: number;
|
|
44
|
+
frame: number;
|
|
45
|
+
name: string;
|
|
46
|
+
collisionModel: CollisionModel | null;
|
|
47
|
+
configStrings: string[];
|
|
48
|
+
baselines: (EntityState | null)[];
|
|
49
|
+
multicastBuf: Uint8Array;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAiD,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;GAEG;AACH,oBAAY,WAAW;IACnB,IAAI,IAAA,CAAY,gBAAgB;IAChC,OAAO,IAAA,CAAS,wBAAwB;IACxC,IAAI,IAAA,CAAY,mBAAmB;IACnC,SAAS,IAAA;IACT,IAAI,IAAA;IACJ,GAAG,IAAA;CACN;AAED,MAAM,WAAW,SAAS;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IAEjB,MAAM,EAAE,MAAM,CAAC;IAEf,UAAU,EAAE,MAAM,CAAC;IAEnB,OAAO,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IAQ3B,aAAa,EAAE,MAAM,CAAC;IAEtB,UAAU,EAAE,SAAS,EAAE,CAAC;IAGxB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,MAAM;IACnB,KAAK,EAAE,WAAW,CAAC;IAEnB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAElB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,EAAE,MAAM,CAAC;IAIb,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IAEtC,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,EAAE,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC;IAGlC,YAAY,EAAE,UAAU,CAAC;CAC5B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NetDriver } from '@quake2ts/shared';
|
|
2
|
+
export interface NetworkTransport {
|
|
3
|
+
listen(port: number): Promise<void>;
|
|
4
|
+
close(): void;
|
|
5
|
+
onConnection(callback: (driver: NetDriver, info?: any) => void): void;
|
|
6
|
+
onError(callback: (error: Error) => void): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,MAAM,WAAW,gBAAgB;IAC7B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,KAAK,IAAI,IAAI,CAAC;IACd,YAAY,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI,CAAC;IACtE,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,IAAI,CAAC;CACnD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NetworkTransport } from '../transport.js';
|
|
2
|
+
import { NetDriver } from '@quake2ts/shared';
|
|
3
|
+
export declare class WebSocketTransport implements NetworkTransport {
|
|
4
|
+
private wss;
|
|
5
|
+
private connectionCallback;
|
|
6
|
+
private errorCallback;
|
|
7
|
+
listen(port: number): Promise<void>;
|
|
8
|
+
close(): void;
|
|
9
|
+
onConnection(callback: (driver: NetDriver, info?: any) => void): void;
|
|
10
|
+
onError(callback: (error: Error) => void): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=websocket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"websocket.d.ts","sourceRoot":"","sources":["../../../src/transports/websocket.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBAAa,kBAAmB,YAAW,gBAAgB;IACvD,OAAO,CAAC,GAAG,CAAgC;IAC3C,OAAO,CAAC,kBAAkB,CAA0D;IACpF,OAAO,CAAC,aAAa,CAAyC;IAExD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBzC,KAAK;IAOL,YAAY,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI;IAI9D,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI;CAG3C"}
|
package/package.json
CHANGED
|
@@ -1,33 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quake2ts/server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.739",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "./dist/index.cjs",
|
|
6
|
-
"module": "./dist/index.js",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
5
|
+
"main": "./dist/cjs/index.cjs",
|
|
6
|
+
"module": "./dist/esm/index.js",
|
|
7
|
+
"types": "./dist/types/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"import": "./dist/index.js",
|
|
12
|
-
"require": "./dist/index.cjs"
|
|
10
|
+
"types": "./dist/types/index.d.ts",
|
|
11
|
+
"import": "./dist/esm/index.js",
|
|
12
|
+
"require": "./dist/cjs/index.cjs"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/jburnhams/quake2.git",
|
|
18
|
+
"directory": "quake2ts/packages/server"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"@quake2ts/engine": "0.0.739",
|
|
22
|
+
"@quake2ts/game": "0.0.739",
|
|
23
|
+
"@quake2ts/shared": "0.0.739"
|
|
24
|
+
},
|
|
15
25
|
"dependencies": {
|
|
16
|
-
"ws": "^8.18.0"
|
|
17
|
-
"@quake2ts/engine": "0.0.1",
|
|
18
|
-
"@quake2ts/game": "0.0.1",
|
|
19
|
-
"@quake2ts/shared": "0.0.1"
|
|
26
|
+
"ws": "^8.18.0"
|
|
20
27
|
},
|
|
21
28
|
"devDependencies": {
|
|
22
29
|
"@types/ws": "^8.5.12",
|
|
23
30
|
"tsup": "^8.0.2",
|
|
24
31
|
"typescript": "^5.4.5",
|
|
25
32
|
"vitest": "^1.6.0",
|
|
26
|
-
"@quake2ts/
|
|
33
|
+
"@quake2ts/engine": "0.0.739",
|
|
34
|
+
"@quake2ts/game": "0.0.739",
|
|
35
|
+
"@quake2ts/test-utils": "0.0.739",
|
|
36
|
+
"@quake2ts/shared": "0.0.739"
|
|
27
37
|
},
|
|
28
38
|
"scripts": {
|
|
29
|
-
"build": "
|
|
30
|
-
"
|
|
39
|
+
"build": "pnpm run build:types && pnpm run build:bundles",
|
|
40
|
+
"build:types": "tsc -b",
|
|
41
|
+
"build:bundles": "tsup",
|
|
42
|
+
"dev": "tsup --watch",
|
|
31
43
|
"test": "pnpm run test:unit",
|
|
32
44
|
"test:unit": "TEST_TYPE=unit vitest run",
|
|
33
45
|
"test:integration": "TEST_TYPE=integration vitest run"
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
|
2
|
+
<testsuites name="vitest tests" tests="35" failures="0" errors="0" time="20.527">
|
|
3
|
+
<testsuite name="tests/client.test.ts" timestamp="2025-12-25T14:59:08.975Z" hostname="Jonathans-MacBook-Pro.local" tests="1" failures="0" errors="0" skipped="0" time="0.001">
|
|
4
|
+
<testcase classname="tests/client.test.ts" name="Server Client > should initialize with NetChan" time="0.001">
|
|
5
|
+
</testcase>
|
|
6
|
+
</testsuite>
|
|
7
|
+
<testsuite name="tests/connection_flow.test.ts" timestamp="2025-12-25T14:59:08.977Z" hostname="Jonathans-MacBook-Pro.local" tests="1" failures="0" errors="0" skipped="0" time="0.009">
|
|
8
|
+
<testcase classname="tests/connection_flow.test.ts" name="DedicatedServer Connection Flow > should handle "connect" command" time="0.008">
|
|
9
|
+
</testcase>
|
|
10
|
+
</testsuite>
|
|
11
|
+
<testsuite name="tests/dedicated.test.ts" timestamp="2025-12-25T14:59:08.977Z" hostname="Jonathans-MacBook-Pro.local" tests="4" failures="0" errors="0" skipped="0" time="0.103">
|
|
12
|
+
<testcase classname="tests/dedicated.test.ts" name="DedicatedServer > should initialize the game and start the frame loop" time="0.005">
|
|
13
|
+
</testcase>
|
|
14
|
+
<testcase classname="tests/dedicated.test.ts" name="DedicatedServer > should run the main game loop and process client commands" time="0.006">
|
|
15
|
+
</testcase>
|
|
16
|
+
<testcase classname="tests/dedicated.test.ts" name="DedicatedServer > should not process commands for clients that are not active" time="0.004">
|
|
17
|
+
</testcase>
|
|
18
|
+
<testcase classname="tests/dedicated.test.ts" name="DedicatedServer > should compensate for slow frames (drift compensation)" time="0.088">
|
|
19
|
+
</testcase>
|
|
20
|
+
</testsuite>
|
|
21
|
+
<testsuite name="tests/dedicated_trace.test.ts" timestamp="2025-12-25T14:59:08.978Z" hostname="Jonathans-MacBook-Pro.local" tests="2" failures="0" errors="0" skipped="0" time="0.13">
|
|
22
|
+
<testcase classname="tests/dedicated_trace.test.ts" name="DedicatedServer Trace Integration > should invoke CollisionEntityIndex.trace and resolve entity" time="0.074">
|
|
23
|
+
<system-out>
|
|
24
|
+
Starting Dedicated Server on port 27998...
|
|
25
|
+
Loading map test.bsp...
|
|
26
|
+
|
|
27
|
+
Map loaded successfully.
|
|
28
|
+
Server started.
|
|
29
|
+
|
|
30
|
+
</system-out>
|
|
31
|
+
</testcase>
|
|
32
|
+
<testcase classname="tests/dedicated_trace.test.ts" name="DedicatedServer Trace Integration > should fallback to world trace (via entityIndex) if entity trace is further" time="0.056">
|
|
33
|
+
<system-out>
|
|
34
|
+
Starting Dedicated Server on port 27999...
|
|
35
|
+
Loading map test.bsp...
|
|
36
|
+
|
|
37
|
+
Map loaded successfully.
|
|
38
|
+
Server started.
|
|
39
|
+
|
|
40
|
+
</system-out>
|
|
41
|
+
</testcase>
|
|
42
|
+
</testsuite>
|
|
43
|
+
<testsuite name="tests/lag.test.ts" timestamp="2025-12-25T14:59:08.979Z" hostname="Jonathans-MacBook-Pro.local" tests="4" failures="0" errors="0" skipped="0" time="0.043">
|
|
44
|
+
<testcase classname="tests/lag.test.ts" name="Lag Compensation > should record entity history" time="0.035">
|
|
45
|
+
</testcase>
|
|
46
|
+
<testcase classname="tests/lag.test.ts" name="Lag Compensation > should interpolate entity position based on lag" time="0.002">
|
|
47
|
+
</testcase>
|
|
48
|
+
<testcase classname="tests/lag.test.ts" name="Lag Compensation > should handle lag larger than history" time="0.001">
|
|
49
|
+
</testcase>
|
|
50
|
+
<testcase classname="tests/lag.test.ts" name="Lag Compensation > should handle negative lag (extrapolation not supported, clamps to newest)" time="0.004">
|
|
51
|
+
</testcase>
|
|
52
|
+
</testsuite>
|
|
53
|
+
<testsuite name="tests/protocol.test.ts" timestamp="2025-12-25T14:59:08.980Z" hostname="Jonathans-MacBook-Pro.local" tests="4" failures="0" errors="0" skipped="0" time="0.003">
|
|
54
|
+
<testcase classname="tests/protocol.test.ts" name="ClientMessageParser > should parse NOP command" time="0.002">
|
|
55
|
+
</testcase>
|
|
56
|
+
<testcase classname="tests/protocol.test.ts" name="ClientMessageParser > should parse StringCmd" time="0">
|
|
57
|
+
</testcase>
|
|
58
|
+
<testcase classname="tests/protocol.test.ts" name="ClientMessageParser > should parse UserInfo" time="0.001">
|
|
59
|
+
</testcase>
|
|
60
|
+
<testcase classname="tests/protocol.test.ts" name="ClientMessageParser > should parse Move command (UserCmd)" time="0">
|
|
61
|
+
</testcase>
|
|
62
|
+
</testsuite>
|
|
63
|
+
<testsuite name="tests/server-state.test.ts" timestamp="2025-12-25T14:59:08.981Z" hostname="Jonathans-MacBook-Pro.local" tests="1" failures="0" errors="0" skipped="0" time="0.002">
|
|
64
|
+
<testcase classname="tests/server-state.test.ts" name="Server State Structures > Client initialization should set default values correctly" time="0">
|
|
65
|
+
</testcase>
|
|
66
|
+
</testsuite>
|
|
67
|
+
<testsuite name="tests/server.test.ts" timestamp="2025-12-25T14:59:08.981Z" hostname="Jonathans-MacBook-Pro.local" tests="6" failures="0" errors="0" skipped="0" time="0.014">
|
|
68
|
+
<testcase classname="tests/server.test.ts" name="DedicatedServer > should create a server with default options" time="0.001">
|
|
69
|
+
</testcase>
|
|
70
|
+
<testcase classname="tests/server.test.ts" name="DedicatedServer > should initialize WebSocketServer on start" time="0.006">
|
|
71
|
+
</testcase>
|
|
72
|
+
<testcase classname="tests/server.test.ts" name="DedicatedServer > should be able to stop" time="0.002">
|
|
73
|
+
</testcase>
|
|
74
|
+
<testcase classname="tests/server.test.ts" name="DedicatedServer > should fail to start without map" time="0.001">
|
|
75
|
+
</testcase>
|
|
76
|
+
<testcase classname="tests/server.test.ts" name="DedicatedServer > should kick player" time="0">
|
|
77
|
+
</testcase>
|
|
78
|
+
<testcase classname="tests/server.test.ts" name="DedicatedServer > should change map" time="0.004">
|
|
79
|
+
</testcase>
|
|
80
|
+
</testsuite>
|
|
81
|
+
<testsuite name="tests/unit/dedicated_timeout.test.ts" timestamp="2025-12-25T14:59:08.982Z" hostname="Jonathans-MacBook-Pro.local" tests="2" failures="0" errors="0" skipped="0" time="0.01">
|
|
82
|
+
<testcase classname="tests/unit/dedicated_timeout.test.ts" name="DedicatedServer Timeout > should disconnect a client after timeout" time="0.005">
|
|
83
|
+
</testcase>
|
|
84
|
+
<testcase classname="tests/unit/dedicated_timeout.test.ts" name="DedicatedServer Timeout > should NOT disconnect a client if they send messages" time="0.004">
|
|
85
|
+
</testcase>
|
|
86
|
+
</testsuite>
|
|
87
|
+
<testsuite name="tests/protocol/player.test.ts" timestamp="2025-12-25T14:59:08.982Z" hostname="Jonathans-MacBook-Pro.local" tests="3" failures="0" errors="0" skipped="0" time="0.003">
|
|
88
|
+
<testcase classname="tests/protocol/player.test.ts" name="writePlayerState > should write an empty state as just flags (plus statbits)" time="0.002">
|
|
89
|
+
</testcase>
|
|
90
|
+
<testcase classname="tests/protocol/player.test.ts" name="writePlayerState > should correctly round-trip all fields" time="0.001">
|
|
91
|
+
</testcase>
|
|
92
|
+
<testcase classname="tests/protocol/player.test.ts" name="writePlayerState > should ignore stats > 31" time="0">
|
|
93
|
+
</testcase>
|
|
94
|
+
</testsuite>
|
|
95
|
+
<testsuite name="tests/protocol/write.test.ts" timestamp="2025-12-25T14:59:08.983Z" hostname="Jonathans-MacBook-Pro.local" tests="7" failures="0" errors="0" skipped="0" time="0.003">
|
|
96
|
+
<testcase classname="tests/protocol/write.test.ts" name="writeServerCommand > writes ServerCommand.print" time="0.002">
|
|
97
|
+
</testcase>
|
|
98
|
+
<testcase classname="tests/protocol/write.test.ts" name="writeServerCommand > writes ServerCommand.muzzleflash" time="0">
|
|
99
|
+
</testcase>
|
|
100
|
+
<testcase classname="tests/protocol/write.test.ts" name="writeServerCommand > writes TempEntity.ROCKET_EXPLOSION" time="0">
|
|
101
|
+
</testcase>
|
|
102
|
+
<testcase classname="tests/protocol/write.test.ts" name="writeServerCommand > writes TempEntity.PARASITE_ATTACK" time="0">
|
|
103
|
+
</testcase>
|
|
104
|
+
<testcase classname="tests/protocol/write.test.ts" name="writeServerCommand > writes ServerCommand.centerprint" time="0">
|
|
105
|
+
</testcase>
|
|
106
|
+
<testcase classname="tests/protocol/write.test.ts" name="writeServerCommand > writes ServerCommand.stufftext" time="0">
|
|
107
|
+
</testcase>
|
|
108
|
+
<testcase classname="tests/protocol/write.test.ts" name="writeServerCommand > writes ServerCommand.sound" time="0">
|
|
109
|
+
</testcase>
|
|
110
|
+
</testsuite>
|
|
111
|
+
</testsuites>
|
package/tsconfig.json
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"include": ["src/**/*"],
|
|
4
3
|
"compilerOptions": {
|
|
5
|
-
"outDir": "dist",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
4
|
+
"outDir": "dist/types",
|
|
5
|
+
"rootDir": "src",
|
|
6
|
+
"emitDeclarationOnly": true,
|
|
7
|
+
"declarationMap": true
|
|
8
|
+
},
|
|
9
|
+
"include": ["src/**/*"],
|
|
10
|
+
"references": [
|
|
11
|
+
{ "path": "../shared" },
|
|
12
|
+
{ "path": "../engine" },
|
|
13
|
+
{ "path": "../game" }
|
|
14
|
+
]
|
|
9
15
|
}
|
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { defineConfig } from 'tsup';
|
|
2
|
+
import { createLibraryConfig } from '../../build-config/tsup.factory';
|
|
3
|
+
|
|
4
|
+
export default defineConfig(
|
|
5
|
+
createLibraryConfig({
|
|
6
|
+
globalName: 'Quake2Server',
|
|
7
|
+
browserBundle: false, // Server package doesn't need browser bundle
|
|
8
|
+
external: [/@quake2ts\/.*/, 'gl-matrix', 'ws'],
|
|
9
|
+
})
|
|
10
|
+
);
|