Terminal 1 — WebSocket server:
cd server && npm install && npm run dev
# Runs on ws://localhost:8080 with auto-restart on file changesTerminal 2 — Game client:
# Option A: open directly (no install needed)
open index.html
# Option B: Vite dev server (HMR, recommended for active client dev)
npx viteTest multiplayer locally: open two browser tabs to index.html. Both should connect to the local server and see each other in-world.
At the top of index.html, set:
const WS_URL = 'ws://localhost:8080'; // local dev
// const WS_URL = 'wss://your-domain/ws'; // production- Client opens page → establishes WebSocket to WS_URL
- Client sends:
{ type: "join", username: "Doug" } - Server replies:
{ type: "welcome", playerId, sessionId, dungeonSeed, spawnPoint, players: [...] } - Client builds dungeon from
dungeonSeed, places camera atspawnPoint - Client sends
{ type: "move", x, y, z, yaw, pitch }at 20hz - Client sends
{ type: "spell_cast", spellType, x, y, z, dirX, dirY, dirZ }on cast
# On the Hetzner box
git clone https://github.com/dschonholtz/MultiMagicDungeonWeb.git
cd MultiMagicDungeonWeb/server && npm install
pm2 start index.js --name mmd-server
pm2 saveThen configure nginx to proxy wss://your-domain/ws → ws://localhost:8080.