Skip to content
CVL COREUnity SDK : Zero-Allocation Client

Client RPCs, Inventory & Player Persistence

[SPECIFICATION] Non-Blocking Client RPC & Persistence Bridge Invariant

The CVL CORE Unity C# Client SDK separates high-frequency spatial transform streaming from stateful gameplay and persistence transactions. By multiplexing custom RPCs, inventory mutations, and player state requests over the existing non-blocking TCP socket into out-of-process server sidecars, Unity clients execute complex backend transactions with zero main-thread socket stalls and zero impact on the server's 30Hz physics loop.

[STATUS // POST-DEMO PIPELINE — SDK TEMPLATES IN PROGRESS] CLIENT PERSISTENCE & CONTRACT GENERATOR

Binary RPC Transport Verified — Turnkey Persistence Prefabs Coming Next: The underlying C# binary event dispatcher and asynchronous callback router are built into Protocol v3.4.0. Drop-in Unity inventory/persistence prefabs and automated C# contract generation (via the SDK Setup Wizard) will be finalized alongside post-demo database adapter selection.


[SEC 01.0] Wire Multiplexing: Spatial Telemetry vs. Sidecar RPCs

Section titled “[SEC 01.0] Wire Multiplexing: Spatial Telemetry vs. Sidecar RPCs”

Rather than opening secondary HTTP/REST connections or stalling the Unity render thread with external database SDKs, the Unity client multiplexes all gameplay and persistence RPCs over its single persistent TCP_NODELAY connection (Port 55555):

Traffic Class Wire Framing Server Routing Path Client Execution Model
Spatial Transforms Fixed-Stride Quantized Binary Enters 30Hz 64-byte C-memory physics matrix. Unpacked into 65,536-slot SPSC ring buffer (133ms smoothing).
Sidecar RPC & Persistence Fixed Header + Binary Payload Bypasses physics thread (0.00ms tax) straight to 127.0.0.1:55557. Dispatched asynchronously via correlation token callbacks.
sequenceDiagram
  autonumber
  participant UI as Unity Main Thread (C# UI / Inventory)
  participant Net as SDK Background Socket Worker
  participant Reactor as CVL CORE Ingress Reactor (Port 55555)
  participant Sidecar as Persistence / RPG Sidecar (127.0.0.1:55557)

  UI->>Net: Enqueue Binary RPC (Route Slot, Action Code, Correlation ID)
  Net->>Reactor: Multiplexed Sidecar Event Frame
  Note over Reactor: 0.00ms Physics Bypass (30Hz Loop Untouched)
  Reactor->>Sidecar: Forward Frame over Loopback IPC
  Sidecar-->>Reactor: Commit State & Return Result Frame
  Reactor-->>Net: Sidecar Response Frame (Matched Correlation ID)
  Net-->>UI: Resolve Main-Thread Callback on Next Update()

[SEC 02.0] The Binary Sidecar Event Client Contract

Section titled “[SEC 02.0] The Binary Sidecar Event Client Contract”

Every client-initiated persistence request, inventory action, or custom gameplay RPC is framed inside a deterministic binary header followed by a variable-length payload:

  • Constant-Time Target Routing: Directs the packet in O(1) time to one of 256 registered sidecar slots (e.g., Inventory Ledger, Character Persistence, Guild Bank, or Zone Chat) and specifies the target operation code.
  • Asynchronous Correlation Tracking: Allows the Unity client to fire multiple non-blocking persistence requests concurrently and match server responses back to the originating C# UI promise or callback without blocking frames.
  • Built-In Fault Resilience (Circuit-Breaker Bounce): If a target persistence sidecar is offline or restarting during maintenance, the micro-kernel immediately replies with a deterministic service-unavailable status flag so the Unity UI can gracefully retry or notify the player without hanging the client.

[SEC 03.0] Post-Demo Roadmap: SDK Setup Wizard Contract Auto-Generator

Section titled “[SEC 03.0] Post-Demo Roadmap: SDK Setup Wizard Contract Auto-Generator”

Once turnkey database adapter selection is finalized following the initial demo release, the Unity SDK will expand with two developer workflow upgrades:

  1. Automated C# RPC Stub Generation: Define custom persistence actions and data fields inside a single JSON schema, and trigger Generate Contracts inside the Unity Editor Setup Wizard to automatically emit zero-allocation MemoryMarshal C# client structs and matching server sidecar stubs.
  2. Reference Inventory & Character Hydration Templates: Out-of-the-box example scenes demonstrating authoritative login state hydration, atomic item transfers, and periodic world-state checkpointing against the selected shipping database adapters.
[CHECKLIST // CLIENT SDK INVARIANTS] CLIENT RPC & PERSISTENCE BOUNDARY MANDATES

1. Zero Client Authority Over Persistent State: Unity clients never write directly to databases or mutate authoritative inventory counts locally; all state transitions must be validated and committed by an authoritative Sidecar.
2. Zero Main-Thread Socket Blocking: All RPC serialization and socket dispatch must execute through the SDK's background egress worker.
3. Deterministic Timeout Handling: Client UI layers must handle sidecar circuit-breaker bounce codes gracefully so storage maintenance never freezes gameplay rendering.