Skip to content
CVL COREEngine

30Hz Orchestrator & Frame Pacing

[SPECIFICATION] Simulation Orchestrator Invariant

The CVL CORE Simulation Orchestrator is the authoritative, single-threaded execution core governing continuous 3D coordinate evaluation, broadphase spatial updates, and cadence-multiplexed egress scheduling. Operating at a baseline 30Hz simulation frequency within a strict 33.3 ms frame budget (reserving 1.5 ms for spin-sleep precision on Linux hosts), the orchestrator coordinates inter-thread queue draining and deterministic phase dispatch without lock contention or thread context thrashing. While 30Hz represents the primary spatial baseline profile ACTIVE FOCUS, the orchestration engine is architected to support a high-frequency 60Hz action profile PLANNED for low-latency competitive scenarios and autonomous drone interception.


[SEC 01.0] Executive Architecture & Subsystem Topology

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

CVL CORE processes high-density spatial coordinate simulation through an authoritative micro-kernel. Rather than distributing state updates across competing worker threads—which introduces locking overhead, race hazards, and non-deterministic jitter across the runtime—all simulation authority resides within a single synchronous orchestrator.

CVL CORE Task Orchestration & Queue Conduits
+--------------------------------------------------------------------------+
| CVL CORE NETWORK & IO DAEMONS |
| |
| +--------------------+ +--------------------+ |
| | Network Reactor | | Connection Intake | |
| | (Multiplexed I/O) | | Gate (TCP Listener)| |
| +---------+----------+ +---------+----------+ |
+-------------|--------------------------------------------|---------------+
| SPSC Ingress Conduits | TCP Admission
v v Conduit
+--------------------------------------------------------------------------+
| AUTHORITATIVE SIMULATION ORCHESTRATOR |
| |
| +--------------------------------------------------------------------+ |
| | PHASE 1: INGRESS DRAIN & SPATIAL EXECUTION | |
| | - Time-Boxed Kinematics Ingestion (Two-Stage De-Jitter Ring) | |
| | - 9-Cell Broadphase Evaluation & Collision Slide Resolution | |
| | - Discrete Action Processing & Event Propagation | |
| | - 15Hz Asymmetric Kinematics Conflation Egress | |
| | - 5Hz Secondary Vitals Cadence Multiplexing | |
| +----------------------------------+---------------------------------+ |
| | |
| +----------------------------------v---------------------------------+ |
| | PHASE 2: AMORTIZED TEARDOWN & RECLAMATION | |
| | - Bounded Teardown Eviction (Configurable Max Drops / Tick) | |
| | - Disconnect Packet Dispatch (Discrete Eviction Control Frames) | |
| +----------------------------------+---------------------------------+ |
| | |
| +----------------------------------v---------------------------------+ |
| | PHASE 3: ADMISSIONS, PERSISTENCE & CONSERVATION PARITY | |
| | - Session Admission Tick & Waiting Room Promotion | |
| | - Staggered Round-Robin Persistence (1 Entity / Tick) | |
| | - 1.0Hz Conservation Parity Sentinel Audit | |
| +----------------------------------+---------------------------------+ |
| | |
| +----------------------------------v---------------------------------+ |
| | PLATFORM-AWARE HYBRID SPIN-SLEEP PACER | |
| | - OS Dynamic Compensation (Coarse Sleep -> Sub-ms Spin Loop) | |
| +--------------------------------------------------------------------+ |
+--------------------------------------------------------------------------+
| Master Egress Queue (Net Commands & Payloads)
v
+--------------------------------------------------------------------------+
| OUTBOUND EGRESS REACTOR (Network Reactor) |
+--------------------------------------------------------------------------+

The orchestrator guarantees tick interval stability by enforcing fixed computational budgets:

  • 30Hz Baseline Pacing (ACTIVE FOCUS): Total tick budget of 33.333 ms (dt = 0.03333333333333333). On Linux production systems, a 1.5 ms spin-sleep reserve leaves an effective simulation window of 31.8 ms.
  • 60Hz High-Velocity Pacing (PLANNED): Total tick budget of 16.666 ms (dt = 0.016666666666666666). Reserved for high-frequency physics interactions and competitive shooter profiles, providing a 15.166 ms execution window alongside the 1.5 ms spin-sleep reserve.
[DRIVERS] Core Architectural Efficiency Drivers
Section titled “[DRIVERS] Core Architectural Efficiency Drivers”
  1. Zero Socket Syscalls on the Simulation Loop: All operating system descriptor multiplexing, streaming socket reads, and TCP handshakes are completely segregated into background reactor threads. The orchestrator interacts exclusively via lock-free single-producer single-consumer (SPSC) queue conduits, eliminating blocking I/O latency on the tick loop.
  2. Asymmetric Egress Conflation: Simulation authority evaluates physical kinematics at the native 30Hz tick rate, while spatial broadcast egress is conflated down to 15Hz via a 2-frame broadcast divider. This cuts serialization overhead and outbound bandwidth by more than 50% while maintaining authoritative 30Hz trajectory and collision integrity.
  3. Deterministic Instruction Execution: Hot-path simulation routines enforce strict static type boundaries and pre-compiled data serialization structures, preventing runtime type-resolution overhead and guaranteeing deterministic instruction execution across ticks.
  4. Time-Boxed Ingress Protection: Telemetry ingestion from network lanes is strictly governed by a dynamic microsecond time-budget, preventing malicious or clustered packet floods from starving the simulation tick window.
  5. Native C++ Hot-Path Module Injection PLANNED: Targeted for phased integration across alpha and beta development milestones, critical calculation loops on the simulation hot path (including broadphase 9-cell hashing, continuous collision ray-box slab intersections, and transform stride serialization) will be injected as optimized C++ native extension modules. This architectural acceleration is engineered to compress tick execution down to < 2.0 ms for 500 base entities under adversarial load, securing substantial CPU headroom for expanded concurrency and high-frequency 60Hz tick profiles.

[SEC 02.0] Concurrency Boundaries & Phase Execution Lifecycle

Section titled “[SEC 02.0] Concurrency Boundaries & Phase Execution Lifecycle”

The simulation architecture maintains clean boundary isolation between background I/O workers and the simulation orchestrator. Background threads do not hold, mutate, or pass live domain objects. Communication across queues relies strictly on primitive identifiers or immutable byte buffers.

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

    subgraph IN ["Lock-Free SPSC Ingress"]
        direction TB
        R1["<b>Network Reactor</b><br/>Kinematics, Actions &<br/>Teardown Conduits"]:::ioNode
        G1["<b>Connection Intake Gate</b><br/>TCP Admission &<br/>Control Conduits"]:::ioNode
    end

    subgraph CORE ["Authoritative 30Hz Simulation Core (33.3 ms Budget)"]
        direction LR
        P1["<b>Phase 1: Hot Path</b><br/>De-Jitter Drain, 9-Cell<br/>Physics & 15Hz Egress"]:::phaseNode --> P2["<b>Phase 2: Teardown</b><br/>Bounded Eviction (50/Tick)<br/>& 64B Slot Zero-Fill"]:::phaseNode
        P2 --> P3["<b>Phase 3: Control & Audit</b><br/>Admissions, 1/Tick Drip<br/>& 1.0Hz Parity Sentinel"]:::phaseNode
    end

    PACER["<b>Hybrid Spin-Sleep Pacer</b><br/>Coarse OS Sleep Yield +<br/>1.5 ms High-Res Spin Loop"]:::pacerNode

    R1 --> P1
    R1 --> P2
    G1 --> P3
    P3 --> PACER

    style IN fill:#0f172a,stroke:#38bdf8,stroke-width:1.5px,color:#fff
    style CORE fill:#0f172a,stroke:#10b981,stroke-width:1.5px,color:#fff
    linkStyle default stroke:#94a3b8,stroke-width:1.5px;
[LIFECYCLE] Deterministic Three-Phase Tick Cycle
Section titled “[LIFECYCLE] Deterministic Three-Phase Tick Cycle”

Every tick executed by the simulation orchestrator follows an immutable sequence:

  1. Phase 1: Ingress De-Jitter & Kinematic Simulation

    • Kinematics De-Jitter Ingestion: Drains primitive telemetry strides from the Kinematics Ingress Conduit into per-entity staging ring buffers bounded by a dynamic time-budget governor. Exactly one movement packet per active entity is popped per server tick to neutralize network arrival jitter.
    • Broadphase Collision & Kinematics: Delegates spatial movement checks to the Broadphase Spatial Computing Engine. Resolves 9-cell spatial hashing, checks velocity limits against role ceilings, and executes collision slide calculations.
    • Action Dispatch: Drains the Actions Ingress Conduit and executes validated interactions via the Gameplay Interaction Service.
    • Cadence Multiplexed Egress: Packs dirty entity states into master broadcast frames at 15Hz, pushing output buffers to the Master Egress Queue. Dispatches dirty vitals updates at a secondary 5Hz cadence.
  2. Phase 2: Amortized Fast Eviction

    • Drains drop tokens and disconnect signals from the Teardown Eviction Conduit.
    • Enforces a configurable per-tick eviction cap (50 evictions per tick) to prevent deallocation cascades from causing frame drop spikes. Surplus drops roll over into subsequent ticks.
    • Recycles entity handles, executes a 64-byte zero-fill reset in the memory substrate, and enqueues Discrete Eviction Control Frames to surviving peers.
  3. Phase 3: Admissions, Maintenance & Conservation Parity

    • Drains control envelopes and promotional handshakes from the Control Envelope Conduit.
    • Processes the connection waiting room and promotes staged entities via the Session Admission Controller. Intake per tick is configurable to eliminate admission-induced tick budget spikes.
    • Executes staggered round-robin persistence via the Asynchronous Persistence Engine, auditing one entity per tick to eliminate storage I/O stalls.
    • Runs the 1.0Hz Parity Sentinel Audit, verifying mathematical balance across active entities, matrix capacity, allocated offsets, and open descriptor references.

[SEC 03.0] Frame Pacing Mechanics & Dynamic Governors

Section titled “[SEC 03.0] Frame Pacing Mechanics & Dynamic Governors”
[PACER] Platform-Aware Hybrid Spin-Sleep Frame Pacer
Section titled “[PACER] Platform-Aware Hybrid Spin-Sleep Frame Pacer”

Standard operating system sleep primitives are vulnerable to timer coalescing and scheduler quantum variations. On Windows, default sleep resolution ranges between 10.0 ms and 15.6 ms. On Linux, standard kernel timers exhibit jitter between 0.5 ms and 2.0 ms.

To guarantee microsecond-accurate frame pacing without pegging a CPU core at 100% load during idle windows, the orchestrator implements a platform-aware hybrid spin-sleep algorithm:

  • Stage 1: Coarse Operating System Yield: At the completion of Phase 3, (Admissions, Maintenance & Conservation Parity) the orchestrator calculates the remaining time within the 33.333 ms frame budget. If the remaining margin exceeds the 1.5 ms precision reserve, the thread yields execution back to the OS kernel scheduler for the coarse duration (remaining_budget - 1.5 ms), keeping idle CPU utilization minimal and freeing physical host resources.
  • Stage 2: 1.5 ms High-Precision Spin-Wait: Once the coarse sleep wakes—or immediately if the remaining margin is already within the 1.5 ms threshold—the orchestrator transitions into a tight, non-yielding high-resolution hardware clock polling loop for the final 1.5 ms window. This absorbs operating system scheduler wakeup jitter and completely eliminates timer oversleeping, guaranteeing deterministic frame transitions at the exact 33.333 ms boundary.
Conceptual Platform-Aware Hybrid Pacing Algorithm
void PaceFrame(double tickStartTime, double frameBudget, bool isLinux)
{
double elapsed = GetHighResolutionTime() - tickStartTime;
double remaining = frameBudget - elapsed;
// Reserve safety window for sub-millisecond busy-wait spinning
double spinReserve = isLinux ? 0.0015 : 0.0030;
if (remaining > spinReserve)
{
CoarseKernelSleep(remaining - spinReserve);
}
// High-precision spin loop for sub-millisecond convergence
double targetTime = tickStartTime + frameBudget;
while (GetHighResolutionTime() < targetTime)
{
YieldCpuInstruction();
}
}
[GOVERNOR] Dynamic Time-Box Ingress Regulation
Section titled “[GOVERNOR] Dynamic Time-Box Ingress Regulation”

During sudden network packet bursts, completely draining inbound telemetry in an unbounded loop could monopolize the entire 33.3 ms frame budget. The orchestrator enforces dynamic time-boxing based on active entity saturation, scaling execution limits to ensure network intake never starves physical simulation.

Engine tick limits, frame budgets, and admission thresholds are managed declaratively via configuration:

config/cvlcore_engine_config.json
{
"SIMULATION_TICK_RATE": 30,
"FRAME_BUDGET_MS": 33.333,
"MAX_ADMISSIONS_PER_TICK": 10,
"ADMISSIONS_FRAME_SKIP": 2,
"MAX_TEARDOWNS_PER_TICK": 50,
"INGRESS_TIME_BOX_MAX_MS": 12.0
}
[INVARIANT] Monotonic Client Sequence Clamping
Section titled “[INVARIANT] Monotonic Client Sequence Clamping”

Client telemetry frames are validated against server elapsed time to prevent sequence spoofing or timing acceleration. If an arriving packet sequence attempts to jump forward faster than physically possible within the elapsed server timeframe, the orchestrator clamps the sequence advance inline, eliminating speedhack burst exploits.

On the client side, the presentation SDK synchronizes its local fixed-step accumulator to match the authoritative 30Hz pulse:

Assets/CVL_CORE_SDK/Entities/CVLPlayerController.cs
// Fixed-step 30Hz client telemetry accumulator
while (telemetryAccumulator >= tickInterval)
{
StepMovementTick(tickInterval);
telemetryAccumulator -= tickInterval;
CVLNetworkManager.Instance.TransmitTelemetryFrame(
currentPosition, currentYaw, currentPitch, currentSpeed, actionFlags, zoneEpoch
);
}

[SEC 04.0] Architectural Invariants & Guardrails

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

The orchestrator enforces strict operational constraints to guarantee deterministic frame intervals and prevent runtime degradation during prolonged simulation uptime.

[GUARDRAIL] Fail-Fast Error Propagation & Loop Integrity
Section titled “[GUARDRAIL] Fail-Fast Error Propagation & Loop Integrity”

Background worker threads and the primary orchestration loop must never swallow exceptions using generic catch-all blocks or log repeated errors in unbounded iterations. Unhandled runtime errors must fail fast and terminate execution immediately to prevent silent state desynchronization and disk saturation from runaway logging.

[GUARDRAIL] Hot-Path Monomorphism & Zero-Reflection Discipline
Section titled “[GUARDRAIL] Hot-Path Monomorphism & Zero-Reflection Discipline”

All simulation routines executed within the 30Hz loop enforce strict static memory and type invariants to eliminate runtime execution jitter:

  • Deterministic Instruction Execution: Hot-path mathematical pipelines enforce strict static type boundaries and pre-compiled memory strides, guaranteeing consistent sub-4ms CPU cycle execution without runtime type-resolution overhead.
  • No Dynamic Attribute Introspection: Dynamic reflection and unmapped attribute inspection are strictly prohibited across hot simulation paths. All core data structures enforce fixed, slotted memory layouts, and attributes must be accessed directly.

The simulation thread executes zero operating system socket system calls. All descriptor polling, stream reads, and transmission writes belong exclusively to isolated background reactors. Cross-thread communication is restricted to non-blocking, lock-free C-level FIFO queues, guaranteeing that operating system I/O latency never impacts the 33.3 ms frame budget.

[GUARDRAIL] Zero-Allocation Stream Processing
Section titled “[GUARDRAIL] Zero-Allocation Stream Processing”

Inbound network streams are processed zero-copy through pre-allocated buffers with in-place frame realignment, completely eliminating temporary byte allocations and heap fragmentation during multi-frame packet reassembly.