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.
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:
- Single shared byte-array with variable content
- LookVersion can be reduced (at least 3 bits recommended - depends on frequency of authoritative look direction switching from simulation)
- 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/...)
- 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
- 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)