Skip to content

Game Session RPC

Once a controller and game host establish a direct connection (via registry.relay), they communicate using RPC methods sent over the direct TCP link.

These methods manage the gameplay session: delivering control layouts, configuring sensors, handling virtual buttons, cookies, and trial/purchase flows.

Session Flow

sequenceDiagram
    participant Host as Game Host
    participant Controller

    Host->>Controller: AckPacket
    Controller->>Host: GetPortalId
    Host-->>Controller: onPortalId(id)
    Controller->>Host: setCapabilities(mask)
    Controller->>Host: RequestXML(w, h, deviceId)
    Host-->>Controller: onControlSchemeParsed (XML chunks)
    Host->>Controller: SetControlMode(MODE_GAMEPAD)

    note over Host,Controller: Gameplay Loop
    Controller->>Host: Touch / Acceleration / Gyro / DPad
    Host->>Controller: vibrate / getCookie / setCookie

RPC Methods

Host to Controller

Method Description
SetControlMode Switch the controller to a specific input mode.
enableAccelerometer Enable/disable accelerometer, optionally set sample interval.
setTouchInterval Set the touch input sample interval.
enableTouch Enable or disable touch input.
enableGyro Enable or disable gyroscope input.
setGyroInterval Set the gyroscope sample interval.
enableOrientation Enable or disable orientation input.
setOrientationInterval Set the orientation sample interval.
setReliabilityForTouch Set touch/sensor reliability.
getCookie Request a persistent value from the controller's storage.
setCookie Write a persistent value to the controller's storage.
vibrate Trigger the controller's vibration motor.
promptTrialUpsell Prompt the controller to show the trial upsell UI.
updateWallet Tell the controller to refresh its in-app currency wallet.
WaitForNewHost Instruct the controller to wait for a new host connection.

Controller to Host

Method Description
GetPortalId Request the host's portal identifier.
setCapabilities Report the controller's hardware capabilities as a bitmask.
RequestXML Request the control layout schema for the controller's screen dimensions.
onNavigationString Deliver a system navigation event (e.g., back button).
onKeyString Deliver a hardware keyboard key press.
startTrial Signal the start of a trial session.
endTrial Signal the end of a trial session.

Notes

  • All session RPCs use the BMInvoke object format on channel 3 (Message).
  • Unlike registry traffic, session RPC occurs directly between peers. The registry server is not involved during gameplay.
  • The control scheme XML is delivered via BMByteChunk chunked transfer. See RequestXML & Delivery.