Game SDK

↓ Download SDK 1.8.1

Internal VORIVOX development. Candidate package: remaining gates are listed under compatibility.

API reference

This page provides a structured overview of the main SDK class, its states, events, methods and data models.

Main class

VorivoxGameSdk is the MonoBehaviour that connects your game to Launcher.

Typical flow

In most games you call ConnectAsync() and then ReadyAsync().

Event stream

Hits, pause, stop and state changes are delivered through SDK events.

VorivoxGameSdk class

public sealed class VorivoxGameSdk : MonoBehaviour

Attach it to a scene object. It loads the manifest, connects to Launcher over the loopback WebSocket and dispatches game events on Unity's main thread.

Core properties and states

MemberDescription
ManifestThe loaded launch manifest with session, display, target profile and path data.
CapabilitiesThe confirmed Launcher capabilities: LED trigger, LED override, pause/resume and raw events.
ConnectionStateTransport state: Disconnected, Connecting, Authenticating, Connected, Ready, Failed.
DeviceStateHardware state: Unknown, Ready, Degraded, ControllerLost, Busy.
SessionStateSession lifecycle state: Idle, Starting, Running, Paused, Stopping, Completed.
LastErrorThe last connection or transport error as text.
IsMocktrue when the SDK runs in mock mode without a real manifest.
IsConnectedConvenience flag for an active connection.
IsReadytrue after a successful ReadyAsync().
IsSessionRunningtrue while an actual game session is running.
IsPausedtrue when the session is paused.

Events

EventWhen it fires
ConnectionStateChangedOn every connection state transition.
SessionStateChangedWhen the session lifecycle changes.
ServerAcceptedAfter a successful server.hello with Launcher capabilities.
SessionStartedWhen session.start arrives.
SessionPausedWhen session.pause arrives.
SessionResumedWhen a paused session is resumed.
SessionStoppedWhen the operator or system stops the session.
HitReceivedOn a physical hit from the acoustic target.
DeviceStateChangedWhen Launcher reports a new hardware state.
MessageIgnoredWhen an inbound message is invalid or unknown.
ErrorWhen the SDK reports a transport or logic error.

Methods

Connect

Task ConnectAsync(CancellationToken cancellationToken = default)

Loads the manifest, opens the WebSocket, sends client.hello and waits for Launcher acceptance.

Ready

Task ReadyAsync(string scene = "Game", CancellationToken cancellationToken = default)

Tells Launcher that the game has finished loading and is ready for the session.

Wait for session start

Task<VorivoxSessionStart> WaitForSessionStartAsync(CancellationToken cancellationToken = default)

Asynchronously waits for session.start and returns the session parameters.

Update score

Task UpdateScoreAsync(VorivoxScore score, CancellationToken cancellationToken = default)

Sends the current score, shots, hits and remaining time.

Complete session

Task CompleteAsync(VorivoxResult result, CancellationToken cancellationToken = default)

Sends the final result. Repeated calls for the same session are ignored.

LED trigger

Task TriggerLedAsync(string trigger = "HIT", CancellationToken cancellationToken = default)

Sends a system LED trigger request. Check Capabilities.LedTrigger before calling it.

LED override

Task SetLedOverrideAsync(string mode, int r, int g, int b, int w = 0, int durationMs = 0, CancellationToken cancellationToken = default)

Requests temporary LED control. Check Capabilities.LedOverride before calling it.

Clear LED override

Task ClearLedOverrideAsync(CancellationToken cancellationToken = default)

Returns LED control to the default system behavior.

Service log

Task LogAsync(string level, string text, CancellationToken cancellationToken = default)

Sends a diagnostic message to Launcher.

Disconnect

Task DisconnectAsync()

Stops background tasks, closes the WebSocket and returns the SDK to Disconnected.

Mock: session start

void InjectMockSessionStart(int playerCount = 0, string mode = null, int countdownMs = 0)

Simulates session.start during local development.

Mock: pause and resume

void InjectMockPause(string reason = "operator_requested")
void InjectMockResume()

Simulates pausing and resuming a session.

Mock: stop and device state

void InjectMockStop(string reason = "operator_abort")
void InjectMockDeviceState(VorivoxDeviceState state)

Simulates session stop or a hardware state change.

Mock: hit

void InjectMockHit(float normalizedX, float normalizedY, string shotId = null)

Creates a test hit using normalized coordinates from 0 to 1.

Key data models

ModelPurpose
VorivoxHitOne hit event: ShotId, millimeter coordinates, normalized coordinates, source and demo flag. Important helpers: ToScreenPixels(), ToCanvasLocal().
VorivoxScoreIntermediate score data: Score, Shots, Hits, TimeLeftMs.
VorivoxResultFinal session result: Status, Score, Shots, Hits, DurationMs, PlayerCount.
VorivoxSessionStartSession start parameters: PlayerCount, Mode, CountdownMs.
VorivoxLaunchManifestThe full game manifest: bridge, display, target profile, paths, session and game metadata.

Minimal usage flow

private async Task StartGameAsync()
{
    await sdk.ConnectAsync();
    await sdk.ReadyAsync("Boot");

    VorivoxSessionStart session = await sdk.WaitForSessionStartAsync();
    StartRound(session);
}

1.8 changes and guarantee boundaries

CompleteAsync validates PlayerCount against the current manifest. ToTopLeftPixels(width,height) retains ToScreenPixels behaviour; ToUnityScreenPixels(width,height) does not invert Y. Automatic mock is Editor-only with no manifest path. Pause/Resume cannot revive a stopped session. Result sending is not a persistence ACK.