- server/relay.mjs: WebSocket room (ws, 127.0.0.1:8433 behind a proxy).
Relays positions/edits/repairs/platter states; keeps the authoritative
world diff + quest state for late joiners; persists to booth-state.json.
Hardened: origin allowlist, 24-peer cap, 2KB frames, 40 msg/s budget,
bounds+type validation on every message, ping/terminate dead sockets.
- src/net/NetClient.ts: offline-tolerant client — mirrors bus events out,
applies remote events with an echo guard (quest.repair/platter setters
are idempotent/deduped so replication can't loop). 10Hz delta'd positions.
- src/net/Avatars.ts: voxel-person avatars with headphones + name tags,
lerped to network updates.
- Menu: DJ name setting (auto-generated default); help page multiplayer note.
- main.ts: wires avatars + status chip ('online - N other DJs in the booth').
Verified with two live tabs: mutual avatars, block edit + quest repair
replicate both ways, late-joiner gets full state replay, non-gameplay
setBlock correctly does NOT sync, zero console errors, relay log clean.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
37 lines
845 B
JSON
37 lines
845 B
JSON
{
|
|
"name": "turncraft-relay",
|
|
"version": "0.1.0",
|
|
"lockfileVersion": 3,
|
|
"requires": true,
|
|
"packages": {
|
|
"": {
|
|
"name": "turncraft-relay",
|
|
"version": "0.1.0",
|
|
"dependencies": {
|
|
"ws": "^8.18.0"
|
|
}
|
|
},
|
|
"node_modules/ws": {
|
|
"version": "8.21.0",
|
|
"resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz",
|
|
"integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==",
|
|
"license": "MIT",
|
|
"engines": {
|
|
"node": ">=10.0.0"
|
|
},
|
|
"peerDependencies": {
|
|
"bufferutil": "^4.0.1",
|
|
"utf-8-validate": ">=5.0.2"
|
|
},
|
|
"peerDependenciesMeta": {
|
|
"bufferutil": {
|
|
"optional": true
|
|
},
|
|
"utf-8-validate": {
|
|
"optional": true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|