Files
Nomads_ReachandGitHub ece634450b Acceptance: load/fault tier — 16/32/64 clients, burst, churn, handoff-under-load (#15) (#24)
* Acceptance: add the load/fault tier (16/32/64 clients, burst, churn, handoff)

Extend the end-to-end harness (issue #15), harness-only — no server change.
Uses the existing ServerTuning seam to widen the local connect budget and
capacity so many clients can run over a single loopback IP.

- 16/32/64 clients across distinct cells: unique server-owned ids and no
  cross-cell transform spam (generalized from the prior 16-client case)
- burst transform traffic engages the rate limiter without tearing sessions
  down, and the server still relays a fresh transform afterward
- reconnect churn (12 cycles): ids stay monotonic and never reused, and each
  disconnect leaves no stale active session
- authority handoff stays deterministic under churn: retiring the current
  authority repeatedly hands off to the next lowest id with strictly
  increasing epochs

Packet loss/reorder on snapshot traffic is inherently an unreliable-transport
(GNS) property and stays deferred with the GNS sections (blocked on #2).

26/26 pass on real sockets, deterministic across repeated runs.

* Strip verbose comments from the acceptance harness and ServerTuning

Remove the prose/narration comments across the end-to-end harness (keeping only
section dividers) and the ServerTuning header block, matching the repo's terse
comment style.
2026-08-16 20:24:16 -04:00
..
2026-08-16 02:36:32 -04:00
2026-08-16 02:36:32 -04:00
2026-08-16 02:23:04 -04:00
2026-08-16 02:36:32 -04:00
2026-08-16 02:36:32 -04:00
2026-08-16 02:23:04 -04:00
2026-08-16 02:36:32 -04:00
2026-08-16 02:36:32 -04:00

Commonwealth Online Dedicated Server

The dedicated server is implemented in C# on .NET 8. Valve GameNetworkingSockets remains in the native C++ bridge under native_transport/, and the C# server loads its C ABI directly.

Run

Packaged Windows:

CommonwealthOnline.Server.exe serve --config commonwealth-server.json

Packaged Linux:

./CommonwealthOnline.Server serve --config commonwealth-server.json

Source checkout:

dotnet build CommonwealthOnline.Server.csproj -c Release
dotnet run --project tests/CommonwealthOnline.Server.Tests.csproj -c Release
dotnet run --project CommonwealthOnline.Server.csproj -- serve --config commonwealth-server.json --interactive

start.bat and start.sh prefer a published apphost, then a framework-dependent DLL, then dotnet run in a source checkout.

Tests

  • tests/ — fast in-memory unit/component tests over the authoritative core (run in the CSharp Server Gate CI).
  • acceptance/ — end-to-end acceptance harness (issue #15): stands up the real server behind the real TCP transport on a loopback port and drives real client sockets through the baseline-protocol, TCP-compatibility, and interest-management matrix sections. Runs in the Acceptance (end-to-end TCP) CI, or locally:
dotnet run --project acceptance/CommonwealthOnline.Server.Acceptance.csproj -c Release

Config

Generate defaults:

dotnet run --project CommonwealthOnline.Server.csproj -- config init commonwealth-server.json

Existing field names remain supported:

{
  "host": "0.0.0.0",
  "port": 7777,
  "server_name": "Commonwealth Online Server",
  "server_description": "",
  "max_players": 16,
  "log_verbosity": "info",
  "admin_port": 7779,
  "enable_gns_transport": false,
  "gns_bridge_path": null
}

When GNS is enabled, host must be an explicit IPv4 bind address. TCP and GNS may use the same numeric game port because they use TCP and UDP separately.

Ports

  • TCP 7777 by default: gameplay compatibility
  • UDP 7777 by default: GNS gameplay when enabled
  • UDP 7778: LAN discovery
  • TCP 127.0.0.1:7779 by default: authenticated administration

Admin CLI

dotnet run --project CommonwealthOnline.Server.csproj -- status --config commonwealth-server.json
dotnet run --project CommonwealthOnline.Server.csproj -- clients --config commonwealth-server.json
dotnet run --project CommonwealthOnline.Server.csproj -- kick 2 --reason griefing --config commonwealth-server.json
dotnet run --project CommonwealthOnline.Server.csproj -- ban 2 --reason griefing --config commonwealth-server.json
dotnet run --project CommonwealthOnline.Server.csproj -- unban 192.0.2.5 --config commonwealth-server.json
dotnet run --project CommonwealthOnline.Server.csproj -- bans --config commonwealth-server.json
dotnet run --project CommonwealthOnline.Server.csproj -- world time 1430 --config commonwealth-server.json
dotnet run --project CommonwealthOnline.Server.csproj -- world weather 0002b52a --config commonwealth-server.json

The admin channel authenticates with .admin-token beside the config file and binds to localhost only.

Load test

The C# synthetic Protocol V2 client provides deterministic multi-client load coverage:

dotnet run --project CommonwealthOnline.Server.csproj -- load-test --host 127.0.0.1 --port 7777 --clients 16

Architecture

C# owns:

  • Protocol V2 decoding/validation
  • session admission and server-owned player IDs
  • movement validation and corrections
  • cell/worldspace interest filtering
  • durable player state
  • scoped NPC authority and epochs
  • combat routing
  • world state
  • bans and rate limits
  • handshake and idle timeouts
  • TCP compatibility
  • GNS sequencing/envelope handling
  • LAN discovery
  • admin control

C++ owns only the Valve GNS transport bridge:

  • initialization/shutdown
  • UDP listen socket
  • GNS connection lifecycle
  • message polling/sending
  • disconnects
  • remote endpoint lookup

Protocol guarantees

  • Maximum message size remains 64 KiB.
  • transform and npcState are unreliable/sequenced under GNS.
  • Reliable gameplay/control packets remain reliable/ordered.
  • Snapshot sequences are wrap-safe; stale and duplicate snapshots are rejected.
  • Server-owned identity is applied before mutation/relay.
  • Movement validation runs before transform mutation/relay.
  • Interest filtering remains authoritative.
  • NPC authority is scoped by cell/worldspace and epoch.
  • Durable player state is cached; action events are not replay-cached.
  • Ban, connection throttle and packet-rate checks remain server-side.

Publish

Linux self-contained:

dotnet publish CommonwealthOnline.Server.csproj -c Release -r linux-x64 --self-contained true -p:PublishSingleFile=true -o publish/linux-x64

Windows self-contained:

dotnet publish CommonwealthOnline.Server.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -o publish\win-x64

commonwealth-online.service.example is provided for Linux systemd deployment.