Skip to main content

Roku And Web Host Integration

Game scenes should not own platform setup. The host shell creates the screen, runtime services, input adapters, audio manager, asset bundle states, and controller pairing manager, then passes a context into the selected game.

Host Responsibilities

Host responsibilityWhy it stays outside scenes
Create GameRuntimeOwns tick, present/swap, input drain, audio tick, debug overlays.
Create platform screen/compositorPlatform-specific rendering setup.
Register input adaptersRoku remote, web, keyboard/gamepad, paired controls.
Load asset bundle statesScenes consume ready states; host owns downloads/cache lifecycle.
Register audio resourcesPlatform-specific Roku/web audio resource setup.
Start paired-control serverPairing manager is shared by scenes and adapters.
Drive TimerService._tick(deltaMs)Required for HsPromise, port promises, fetch, and bundle work.

Runtime Setup Shape

The Roku game sample host creates:

  • BaseGameApp
  • platform screen and compositor
  • GameInputAdapterManager
  • RokuGameInputAdapter
  • Hs2dControlInputManager
  • PairedControlsInputAdapter
  • AudioManager
  • GameRuntime
  • selected Hs2d game controller

Scenes receive a game/example context rather than constructing host services themselves.

Asset Bundle States

The host loads bundle states before examples resolve assets. A game scene should resolve bundle keys through the context helper and keep package fallbacks for local runs.

resolveGameAssetBundleUri(context, 'my-game', 'my-game.images.player', fallbackUri);

Do not make scenes fetch bundle manifests directly.

Audio Registration

Register platform audio resources from ready bundle manifests in the host layer. Then pass the shared AudioManager into scenes that need music or SFX.

Input Registration

Input adapters feed the runtime. Scenes consume normalized GameInput[] from update(deltaMs, inputs).

The pairing server and paired-controls adapter should be attached once at host setup. Pause menus then push pairing scenes that operate on the same Hs2dControlInputManager.

Source References

SourceWhat it shows
../hosanna-ui-game-samples-public/src/sample-platform/roku-game/hs-game-main.tsFull Roku game host setup.
GameRuntime.tsRuntime tick and controller handoff.
RokuGameAudioManager.tsRoku audio resource registration.
WebGameAudioManager.tsWeb audio resource registration.
PairedControlsInputAdapter.tsControl manager integration into game input.
Talk to us