2.1 KiB
Development
Server
The dedicated server is a C#/.NET project at server/CommonwealthOnline.Server.csproj.
Core files:
AuthoritativeServer.cs: sessions, authoritative gameplay state, security, interest filteringProtocolCore.cs: JSON codec, transport policy, snapshot sequencing/envelopeProtocolValidation.cs: Protocol V2 packet validationDomain.cs: sessions, bans, NPC authority, world presetsTcpTransport.cs: newline-framed TCP compatibility transportGnsTransport.cs: C# wrapper over the native GameNetworkingSockets bridgeAdminDiscovery.cs: authenticated localhost admin channel and LAN discoveryProgram.cs: CLI, interactive server, management commands and synthetic load command
Build and test:
cd server
dotnet build CommonwealthOnline.Server.csproj -c Release
dotnet run --project tests/CommonwealthOnline.Server.Tests.csproj -c Release
The test harness uses in-memory connections for authoritative behavior and contains no external test-framework package dependency.
Native GNS bridge
server/native_transport remains C++. Keep it transport-only. Do not move validation, identity, interest filtering, NPC authority, combat, world state or caching into the bridge.
The C ABI is the boundary consumed from GnsTransport.cs.
Qt Host
The Qt host remains C++. ServerProcess launches the published C# server and communicates through the authenticated localhost admin channel. It must not invoke a scripting runtime.
CMake publishes a self-contained server as part of the Host GUI post-build step.
Protocol changes
Protocol behavior is intentionally independent from transport. If adding a packet type:
- Define validation and normalization in C#.
- Decide its delivery policy in
TransportPolicy. - Default new control/state traffic to reliable/ordered.
- Use unreliable/sequenced only for latest-wins snapshot families.
- Add tests before changing the client.
Never cache/replay discrete action events, accept stale NPC authority epochs, accept stale snapshot sequences, or bypass server-owned identity and interest validation.