This document is about: QUANTUM 2
SWITCH TO

Overview

The framework uses the new Unity Input System and supports PC, Mobile and VR.

In the following diagram the execution order of the engine and framework parts are shown, as well as when the device input is captured and polled from the Quantum simulation.

fps template input polling and execution order
FPS Template Input Polling and Execution Order

Following structure is the definition of Input structure:

C#

input
{
    Byte         LookVersion;
    Byte         Flags;
    FPVector3    MoveDirection;
    FPQuaternion LookRotation;
    FPVector3    PrimaryControllerPosition;
    FPQuaternion PrimaryControllerRotation;
    FPVector3    SecondaryControllerPosition;
    FPQuaternion SecondaryControllerRotation;
}

Notice the structure is unoptimized and supports all platforms. The final composition is dependent on your game design and input requirements.

An example of optimized input structure would be this:

  1. Single shared byte-array with variable content
  2. LookVersion can be reduced (at least 3 bits recommended - depends on frequency of authoritative look direction switching from simulation)
  3. Reduce MoveDirection and LookRotation precision and mix with actions - 1 bit to identify if the content is a full-precision movement/look or reduced-precision movement/look + embedded actions (fire/jump/run/...)
  4. Optionally some metadata can be embedded (1-2 bits) to identify input composition and strategy (ignore move/look, use values from last frame, adjust by velocity, ...) and use reserved move/look bytes to embed more actions at once
  5. Apply actions queue with priorities on Unity side (only one action can be embedded in the input structure - for example favoring Interact action over Fire)
Back to top