Skip to content
CVL COREEngine

Distributed IPC Architecture

[SPECIFICATION] Distributed IPC Subsystem Invariant

The CVL CORE Distributed IPC Subsystem provides a high-throughput, crash-isolated inter-process communication (IPC) conduit that decouples real-time 30Hz spatial simulation from stateful, transactional, and auxiliary application workloads. By offloading persistence, relational databases, chat messaging, and external API requests to out-of-process sidecar daemons over an isolated loopback transport on port 55557, the kernel guarantees 0.00ms execution overhead on the authoritative simulation loop under maximum concurrency.


[SEC 01.0] Executive Architecture & Subsystem Topology

Section titled “[SEC 01.0] Executive Architecture & Subsystem Topology”

In traditional multiplayer and spatial simulation architectures, executing transactional database queries, third-party REST API calls, persistent inventory mutations, or complex pathfinding models directly on the primary server loop introduces severe latency spikes, frame budget overruns, and garbage collection stalls.

CVL CORE eliminates these bottlenecks by enforcing total process isolation: the core simulation micro-kernel executes strictly spatial mathematics and kinematic updates, while all non-kinematic domain workloads are delegated to independent, asynchronous Sidecar Microservices operating out-of-process.

CVL CORE Out-of-Process Sidecar Architecture & Process Boundaries
+---------------------------------------------------------------------------------------------------+
| HOST MACHINE / LINUX ENVIRONMENT |
+---------------------------------------------------------------------------------------------------+
| |
| [ AUTHORITATIVE SERVER PROCESS ] <────────────────────── Sub-55.0 MB TOTAL LINUX RSS (LOCKED) |
| +---------------------------------------------------------------------------------------------+ |
| | • 30Hz Authoritative Simulation Core (Kinematics, Broadphase Partitioning, Anti-Cheat) | |
| | • Multiplexed Network Reactor (Non-Blocking Client Descriptors) | |
| | • Sidecar Event Broker (Dedicated Loopback Selector on Port 55557) | |
| +---------------------------------------------------------------------------------------------+ |
| | |
| | Loopback TCP IPC Stream |
| | 127.0.0.1:55557 (0.00ms Simulation Impact) |
| v |
| [ CRASH-ISOLATED SIDECAR PROCESSES ] <────────────────── INDEPENDENT MEMORY SPACES |
| +---------------------------------------------------------------------------------------------+ |
| | Daemon A: Persistence Bridge - PostgreSQL / SQLite WAL Ledgers, Disk Flushes, Snapshots | |
| | Daemon B: Social & Chat Relay - Channel Fan-Out, Text Parsing, Word Filtering, Whispers | |
| | Daemon C: Industrial Broker - MQTT / Kafka Bridges, Warehouse Automation, Fleet Logging | |
| | Daemon D: Custom AI Model - Reinforcement Learning, Path Solvers, Auxiliary Logic | |
| +---------------------------------------------------------------------------------------------+ |
+---------------------------------------------------------------------------------------------------+

Every sidecar runs in an independent operating system process with an isolated memory space. If an auxiliary service encounters an unhandled exception, runs out of memory, or crashes entirely, the primary simulation kernel is unaffected. Active client sessions, spatial broadcasts, and 30Hz collision sweeps continue stepping deterministically without frame drops or process corruption.

[INVARIANT] Zero-Impact Simulation Guarantees
Section titled “[INVARIANT] Zero-Impact Simulation Guarantees”

Incoming remote procedure call (RPC) requests from clients route through the network reactor directly into dedicated lock-free ingress queues without touching the main simulation thread. An autonomous background broker manages loopback socket connections, validates service authenticity, and dispatches frames to target sidecars, guaranteeing 0.00ms execution overhead on active simulation ticks.

[INVARIANT] Dual-Domain Spatial Adaptability
Section titled “[INVARIANT] Dual-Domain Spatial Adaptability”

The IPC architecture is domain-agnostic. While it natively provides MMO worlds with crash-isolated banking and chat streaming, it simultaneously serves industrial environments by bridging live kinematics to enterprise message brokers, warehouse logistics databases, and external navigation controllers.


[SEC 02.0] Concurrency & State Ownership / Lifecycle

Section titled “[SEC 02.0] Concurrency & State Ownership / Lifecycle”

The engine coordinates RPC transactions between external clients, the central micro-kernel, and out-of-process sidecars using lock-free queue conduits and asynchronous loopback multiplexing.

flowchart LR
    classDef ingressNode fill:#0c1322,stroke:#00a8ff,stroke-width:2px,color:#ffffff;
    classDef brokerNode fill:#071912,stroke:#10b981,stroke-width:2px,color:#ffffff;
    classDef egressNode fill:#150d24,stroke:#a855f7,stroke-width:2px,color:#ffffff;

    subgraph R1 ["Stage 1: Ingress Bypass (0.00ms Loop Impact)"]
        direction TB
        A1["Remote Client<br/>Dispatches 0x0D Service RPC"]:::ingressNode --> A2["Network Reactor<br/>4,096B Bounds Check & Slice"]:::ingressNode
        A2 --> A3["Sidecar Ingress Conduit<br/>Lock-Free SPSC Queue Bypass"]:::ingressNode
    end

    subgraph R2 ["Stage 2: Loopback IPC Broker (Port 55557)"]
        direction TB
        B1["Sidecar Event Broker<br/>O(1) 256-Slot Route Lookup"]:::brokerNode --> B2["Target Sidecar Daemon<br/>Out-of-Process Execution"]:::brokerNode
    end

    subgraph R3 ["Stage 3: Identity-Safe Egress Bridge"]
        direction TB
        C1["Response Assembly<br/>Keyed to 16-Byte Canonical EID"]:::egressNode --> C2["Master Egress Queue<br/>Stale/Recycled NetID Immunity"]:::egressNode
        C2 --> C3["Remote Client<br/>Receives Status Code + Payload"]:::egressNode
    end

    R1 --> R2 --> R3

    linkStyle default stroke:#94a3b8,stroke-width:1.5px;
[PIPELINE] Autonomous Background Routing Pipeline
Section titled “[PIPELINE] Autonomous Background Routing Pipeline”
  1. Reactor Ingress Bypass (0.00ms Orchestrator Impact): When an authenticated client transmits a sidecar event envelope, the Asymmetric Network Reactor validates the payload boundary (up to 4,096 bytes) and slices the frame directly at the socket boundary. The reactor pushes an immutable transaction token straight into the lock-free Sidecar Ingress Conduit, completely bypassing the Authoritative Simulation Orchestrator and guaranteeing 0.00ms execution impact on the 30Hz physics loop.
  2. O(1) Service Routing & Fast-Fail Offline Bounce: The Sidecar Event Broker drains the Sidecar Ingress Conduit on an isolated background thread and indexes its pre-allocated 256-slot service routing table in constant O(1) time. If the target microservice slot is unpopulated or the sidecar daemon is restarting, the broker immediately synthesizes a non-blocking Service Offline response envelope and routes it back to the client via the Master Egress Queue. This fast-fail circuit breaker prevents queue backpressure and provides instant UI feedback without stalling network conduits.
  3. Egress Response Bridge & Identity Recycling Immunity: When an active sidecar completes its transactional workload, it returns a response frame over loopback (127.0.0.1:55557) to the Sidecar Event Broker. Rather than addressing responses via ephemeral 16-bit Network Identifiers (NetIDs)—which are dynamically recycled upon entity teardown—the broker keys all in-flight IPC transactions strictly to canonical 16-byte Entity Identifier (EID) handles. When routing the response through the Master Egress Queue, if the target EID has disconnected while the asynchronous operation was in flight, the broker resolves the stale handle to null and silently discards the frame, guaranteeing complete immunity against cross-session data leakage.
[SPEC] Deterministic Comparison: Micro-Kernel vs. Distributed Sidecars
Section titled “[SPEC] Deterministic Comparison: Micro-Kernel vs. Distributed Sidecars”
Architectural Dimension Authoritative Spatial Micro-Kernel Distributed Sidecar Services
Execution Domain Authoritative single-threaded 30Hz loop Discrete asynchronous background processes
Primary Workload Kinematics, static collisions, spatial indexing Persistence, messaging, third-party APIs, ledgers
Memory Isolation Sub-55.0 MB locked Resident Set Size (RSS) Isolated process memory (zero shared pointers)
Failure Scope Authoritative core runtime Isolated process crash with zero kernel impact
Transport Medium Raw socket descriptors & memory substrate Non-blocking loopback IPC event bus (55557)

[SEC 03.0] Bidirectional RPC Routing & Sidecar Protocol

Section titled “[SEC 03.0] Bidirectional RPC Routing & Sidecar Protocol”

The IPC subsystem utilizes structured binary envelopes to route commands between clients and auxiliary daemons while preserving protocol safety.

[SPEC] Protocol Envelope Anatomy & Size Constraints
Section titled “[SPEC] Protocol Envelope Anatomy & Size Constraints”

All sidecar RPC traffic is encapsulated inside structured binary frames:

  • Payload Boundary Bounds: Individual sidecar payloads are strictly constrained to a maximum ceiling of 4,096 bytes, preventing rogue external services or malformed client frames from inducing memory bloat.
  • Header Categorization: Frames carry explicit service identifiers, sub-opcodes, and correlation request handles, enabling asynchronous response mapping on client applications.

The IPC router reports transmission health and transaction outcomes using standardized status flags exposed in ProtocolConstants.cs (SidecarStatusCode):

Status Code Symbolic Identifier Operational Meaning
0x00 SidecarStatusCode.Success Request processed successfully; valid response payload attached.
0x01 SidecarStatusCode.GenericError Unspecified execution fault reported by the target sidecar daemon.
0x06 SidecarStatusCode.RateLimited Request rejected due to sidecar throughput or buffer quota throttling.
0x07 SidecarStatusCode.ServiceOffline Fast-fail bounce: the requested service ID is not registered or currently offline.

If a client issues an RPC request directed at an unregistered or disconnected sidecar daemon, the broker intercepts the request immediately. Instead of buffering the request or allowing queues to stall, the broker synthesizes an instant SidecarStatusCode.ServiceOffline (0x07) response and returns it to the client. Queue backpressure cannot build, and client UI layers receive instant failure notifications.


[SEC 04.0] Architectural Invariants & Guardrails

Section titled “[SEC 04.0] Architectural Invariants & Guardrails”

The distributed IPC architecture enforces strict design boundaries to ensure total system stability and protect simulation determinism.

[GUARDRAIL] Zero Memory Sharing & Address Isolation
Section titled “[GUARDRAIL] Zero Memory Sharing & Address Isolation”

The authoritative simulation core shares zero memory, heap references, or raw pointers with external sidecars. Communication across process boundaries is strictly confined to loopback socket byte streams. Even in single-host deployments, sidecar daemons are treated as untrusted remote endpoints.

[GUARDRAIL] Cryptographic Handshake Authentication
Section titled “[GUARDRAIL] Cryptographic Handshake Authentication”

When an external sidecar connects to the loopback broker on port 55557, it must complete a cryptographically validated authentication handshake within a strict 3.0-second timeout window. Connections failing validation or presenting invalid credentials are disconnected immediately, preventing rogue local processes from intercepting event streams.

[GUARDRAIL] Single-Producer Single-Consumer Conduit Discipline
Section titled “[GUARDRAIL] Single-Producer Single-Consumer Conduit Discipline”

Communication between the network reactor, simulation core, and the IPC broker relies strictly on dedicated lock-free FIFO queue conduits. Mutex locks and synchronized blocks are prohibited, preventing thread starvation and ensuring that high-volume sidecar traffic cannot degrade primary frame pacing.

[GUARDRAIL] Canonical Entity Handle Validation
Section titled “[GUARDRAIL] Canonical Entity Handle Validation”

All IPC payloads directed to individual entities must reference valid 16-byte canonical entity handles. If an entity disconnects while a request is in flight, the broker drops the returning payload silently upon discovering that the target handle is no longer bound to an active session, ensuring complete identity isolation.

[SPEC] Microservice Conformance & Implementation Reference
Section titled “[SPEC] Microservice Conformance & Implementation Reference”

All external sidecars must strictly adhere to the loopback protocol contracts, dispatch decorators, and connection backoff semantics provided by the standalone Sidecar SDK. For step-by-step implementation procedures, binary envelope definitions, and production daemon blueprints (including the transactional SQLite WAL Banking Ledger and multi-channel Chat Relay), refer to the Sidecar Microservices & IPC Integration Guide specification.


Section titled “[SEC 05.0] Client IPC Bridge & Related Specifications”

Client visualizers built in Unity or Unreal Engine interact with out-of-process Sidecar daemons exclusively through the CVLEngineAPI static broker, providing non-blocking frame slicing and event delegation for game actions and industrial RPCs alike:

[IMPLEMENTATION] Client Presentation Bridge (CVLEngineAPI)
Section titled “[IMPLEMENTATION] Client Presentation Bridge (CVLEngineAPI)”
Assets/CVL_CORE_SDK/API/CVLEngineAPI.cs
using System;
using System.Text;
using UnityEngine;
using CVLCore.SDK;
public class SidecarServiceConsumer : MonoBehaviour
{
private void OnEnable()
{
// Subscribe to asynchronous sidecar responses
CVLEngineAPI.OnGameEventReceived += HandleGameEventReceived;
}
private void OnDisable()
{
// Enforce strict subscription hygiene
CVLEngineAPI.OnGameEventReceived -= HandleGameEventReceived;
}
public void DispatchChatBroadcast(string message)
{
byte serviceId = 0x01; // Target Sidecar Service ID
byte subOpcode = 0x01; // Service Action Sub-Opcode
ushort requestId = 1042;
ReadOnlySpan<byte> payload = Encoding.UTF8.GetBytes(message);
// Non-blocking dispatch to the server's Sidecar Ingress Conduit
CVLEngineAPI.SendGameEvent(serviceId, subOpcode, requestId, payload);
}
private void HandleGameEventReceived(
byte serviceId,
byte subOpcode,
ushort requestId,
byte statusCode,
ReadOnlySpan<byte> payload)
{
if (statusCode == (byte)SidecarStatusCode.Success) // 0x00
{
string responseText = Encoding.UTF8.GetString(payload);
Debug.Log($"[Sidecar {serviceId}] Request {requestId} OK: {responseText}");
}
else if (statusCode == (byte)SidecarStatusCode.ServiceOffline) // 0x07
{
Debug.LogWarning($"[Sidecar {serviceId}] Fast-fail bounce: Service currently offline.");
}
}
}