Skip to main content

GameBridgeHost

@zylem/game-lib


@zylem/game-lib / bridge / GameBridgeHost

Interface: GameBridgeHost

Defined in: packages/game-lib/src/lib/bridge/game-bridge.ts:221

Host context supplied by the running game so bridge commands can act on live stage state without the bridge importing game internals.

Properties​

cutscene?​

optional cutscene?: object

Defined in: packages/game-lib/src/lib/bridge/game-bridge.ts:246

Cutscene preview hooks (cutscene:*); publish progress via publishCutsceneStatus.

load()​

load(payload): void

Parameters​
payload​

CutsceneLoadPayload

Returns​

void

pause()​

pause(): void

Returns​

void

play()​

play(from?): void

Parameters​
from?​

number

Returns​

void

seek()​

seek(time): void

Parameters​
time​

number

Returns​

void

stop()​

stop(): void

Returns​

void

unload()​

unload(): void

Returns​

void

Methods​

applySceneOperation()?​

optional applySceneOperation(op, direction): void

Defined in: packages/game-lib/src/lib/bridge/game-bridge.ts:233

Undo or redo a committed scene operation (scene:operation:apply).

Parameters​

op​

SceneOperationPayload

direction​

"undo" | "redo"

Returns​

void


applySwatches()?​

optional applySwatches(payload): SwatchApplyOutcome

Defined in: packages/game-lib/src/lib/bridge/game-bridge.ts:244

Apply every swatch to every uuid (entity:apply-swatch). Must report one result per uuid × swatch pair and return a scene:operation entry for each success so the batch is undoable as a single step.

Parameters​

payload​

EntityApplySwatchPayload & object

Returns​

SwatchApplyOutcome


cameraPose()?​

optional cameraPose(): Omit<CameraPosePayload, "requestId"> | null

Defined in: packages/game-lib/src/lib/bridge/game-bridge.ts:255

Describe the live camera (camera:pose:get), for capturing framing into a cutscene.

Returns​

Omit<CameraPosePayload, "requestId"> | null


createEntity()?​

optional createEntity(typeId, props, pose): void

Defined in: packages/game-lib/src/lib/bridge/game-bridge.ts:227

Spawn a catalog entity into the current stage (editor entity:create).

Parameters​

typeId​

string

props​

Record<string, unknown> | undefined

pose​

BridgePose | undefined

Returns​

void


pickEntity()?​

optional pickEntity(ndc): EntitySummaryPayload | null

Defined in: packages/game-lib/src/lib/bridge/game-bridge.ts:238

Raycast at normalized device coordinates and describe the entity hit (entity:pick). Hover should follow the pick only while pick mode is on.

Parameters​

ndc​

BridgeNdc

Returns​

EntitySummaryPayload | null


resolveEntity()​

resolveEntity(uuid): GameEntity<any> | null

Defined in: packages/game-lib/src/lib/bridge/game-bridge.ts:223

Resolve a live entity by UUID from the current stage.

Parameters​

uuid​

string

Returns​

GameEntity<any> | null


setStageVariable()?​

optional setStageVariable(key, value): void

Defined in: packages/game-lib/src/lib/bridge/game-bridge.ts:225

Write a stage variable (editor stage:variable:set).

Parameters​

key​

string

value​

unknown

Returns​

void