Headless Unity/Mirror dedicated game server for socketio-unity that supports both native clients (KCP/UDP) and WebGL clients (WebSocket) simultaneously, deployed to Edgegap edge compute via Docker.
This repo is the dedicated server component. Clients (WebGL + Windows/Mac) and the Socket.IO lobby are in the socketio-unity repo.
The lobby server on Render handles matchmaking and distributes the Edgegap server address to clients. This server handles Mirror game networking only — movement, state sync, player spawning. It does not do auth.
See documentation/architecture.md for the full topology and trust boundaries.
| Path | Purpose |
|---|---|
mirror-server-demo/ |
Unity 6.0 LTS project — build this to produce the server binary |
Dockerfile |
Wraps the Linux server binary into an Ubuntu 22.04 image |
.github/workflows/build-server.yml |
On release publish: downloads zip, builds Docker image, pushes to Edgegap registry |
documentation/ |
Architecture, flows, permissions, and variables docs |
SETUP.md |
Full end-to-end setup guide |
| Port | Protocol | Clients |
|---|---|---|
7777/UDP |
KCP | Windows / Mac native |
7778/TCP |
WebSocket (TLS terminated by Edgegap) | WebGL |
Both run simultaneously via MultiplexTransport. Clients pick one based on platform.
Full walkthrough in SETUP.md. The short version:
- Build — Unity → File → Build Profiles → Linux Server → Build
- Release —
zip -j server-linux.zip <build-dir>/*→ GitHub Release with zip attached - CI —
build-server.ymlautomatically builds and pushesregistry.edgegap.com/<org>/mirror-server:vX.X.X - Edgegap — create a version in the dashboard, add the two ports above, deploy
- Render — update three env vars so the lobby server hands the new address to clients:
| Variable | Value |
|---|---|
MIRROR_SERVER_ADDRESS |
<fqdn>.pr.edgegap.net |
MIRROR_KCP_PORT |
external UDP port from Edgegap dashboard |
MIRROR_WS_PORT |
external TCP/WS port from Edgegap dashboard |
Render auto-redeploys on save. No client changes needed.
In MirrorGameOrchestrator, set ServerMode before entering Play mode:
| Client type | ServerMode |
|---|---|
| Windows / Mac | DedicatedKCP |
| WebGL | DedicatedWebSocket |
| Local host (testing) | PeerToPeer |
| Secret | Purpose |
|---|---|
EDGEGAP_REGISTRY_USER |
Docker login to Edgegap registry |
EDGEGAP_REGISTRY_TOKEN |
Docker login to Edgegap registry |
EDGEGAP_ORG |
Org slug for image tag construction |
Four scripts are imported from com.magithar.socketio-unity as Package Manager samples and must be kept in sync with the client repo when updated:
LobbyStateStore · LobbyNetworkManager · LobbyUIController · MirrorGameOrchestrator
To update: copy changed files into Assets/Samples/Socket.IO Unity Client/1.4.0/, or remove and re-import the affected samples in Package Manager.
- No Mirror-level auth. Any client that knows the Edgegap FQDN and port can connect without going through the lobby. Access is gated only by the secrecy of those values, which the lobby distributes via
match_started. See documentation/permissions.md. - Free tier. Edgegap's Mirror-partner tier provides 1.5 vCPU per deployment. Stop deployments when not testing — idle deployments consume the allowance.
- No automated rollback. A bad image push requires manually creating a new Edgegap version pointing to the previous tag.
- architecture.md — system overview, stack, trust boundaries
- flows.md — match setup, Mirror connection, teardown, CI/CD
- permissions.md — who can do what, and what isn't enforced
- variables.md — all secrets and config with risk ratings
- Client repo: socketio-unity
- Mirror docs: https://mirror-networking.gitbook.io/docs
- Edgegap docs: https://docs.edgegap.com