HostMessage
HostMessage = {
type:"init";v:number;locale:Locale;mode:"tv"|"solo";players:number[];muted:boolean;ageRange:AgeRange;backdrop:Backdrop;view?:BackdropView;stats?:boolean;device?:DeviceHint;input?:GameInput;turns?:number[];pointer?:boolean;pictures?:boolean;orientation?:Orientation;safeArea?:SafeArea;localPoses?:boolean; } | {type:"backdrop";backdrop:Backdrop;view?:BackdropView; } | {type:"frame";t:number;players:PlayerFrame[]; } | {type:"gesture";t:number;player:number;gesture:Gesture; } | {type:"pause";reason?:PauseReason; } | {type:"resume"; } | {type:"break-start"; } | {type:"break-done";shown:boolean; } | {type:"turn";players:number[]; } | {type:"capabilities";pictures:boolean; } | {type:"picture-result";id?:number;result:PictureResult; } | {type:"cursor";x:number;y:number;down:boolean; }
What the screen (the host) sends to the game. The SDK checks it and hands it out as events.
Union Members
Section titled “Union Members”Type Literal
Section titled “Type Literal”{ type: "init"; v: number; locale: Locale; mode: "tv" | "solo"; players: number[]; muted: boolean; ageRange: AgeRange; backdrop: Backdrop; view?: BackdropView; stats?: boolean; device?: DeviceHint; input?: GameInput; turns?: number[]; pointer?: boolean; pictures?: boolean; orientation?: Orientation; safeArea?: SafeArea; localPoses?: boolean; }
localPoses: true when the bodies in the frames come from a camera on the same device as the screen (a phone or a tablet playing alone), not from a phone over the network: they arrive with little jitter, so the SDK draws the avatars with lighter smoothing and interpolation (LOCAL_SMOOTHING, LOCAL_INTERPOLATION in @fabiplay/avatars), unless the game asks for an amount of its own. Absent (older hosts, a phone sending to a TV) = false.
Type Literal
Section titled “Type Literal”{ type: "backdrop"; backdrop: Backdrop; view?: BackdropView; }
The backdrop or the view changed mid-game (video switched on or off, the camera image’s fit or framing changed).
Type Literal
Section titled “Type Literal”{ type: "frame"; t: number; players: PlayerFrame[]; }
Every camera frame (about 30 a second): t, when it was taken (ms), and each player seen.
Type Literal
Section titled “Type Literal”{ type: "gesture"; t: number; player: number; gesture: Gesture; }
A player made a movement (see Gesture).
Type Literal
Section titled “Type Literal”{ type: "pause"; reason?: PauseReason; }
The game is paused: stop the clock until resume. reason: ‘user’, a grown-up (phone, remote) or a child’s crossed arms; ‘distance’, a child stood too close to the screen for 2 s (it resumes by itself once they are back in the green zone). Absent from hosts before it: take it as ‘user’. Either way Fabi Play draws the pause itself.
Type Literal
Section titled “Type Literal”{ type: "resume"; }
Type Literal
Section titled “Type Literal”{ type: "break-start"; }
A break starts: mute, stop timers, wait for break-done.
Type Literal
Section titled “Type Literal”{ type: "break-done"; shown: boolean; }
The answer to break: true if a break was shown; either way the game goes on now.
Type Literal
Section titled “Type Literal”{ type: "turn"; players: number[]; }
Turns (input ‘remote’ only): from now on this child plays, in place of the one before. One remote is one child, so with several children the screen plays one at a time: the same game goes on with the next child in init’s turns (players [2] after [1], …), exactly one id. Sent only inside the break of a break(‘turn’) the game asked for (after break-start, before break-done); never at other breaks, so a round never changes hands midway. The new child’s puppet starts recentred, in the middle lane (lane 0), with no lane gesture. Ids keep their meaning (slots, avatars): keep each player’s score by id across turns, and end with the scores of every child who played. Never sent with input ‘body’, where init’s players stay for the whole game.
Type Literal
Section titled “Type Literal”{ type: "capabilities"; pictures: boolean; }
What the screen can do for the game changed mid-game: pictures, whether a phone that can save pictures is linked now (one joined, or the last one left). init carries the first value.
Type Literal
Section titled “Type Literal”{ type: "picture-result"; id?: number; result: PictureResult; }
The answer to a picture message, with its id (absent if the picture had none): ‘sent’, the phone has it (saved, or saved once the parent allows it); ‘unavailable’, no phone that saves pictures is linked; ‘too-big’, over MAX_PICTURE_BYTES; ‘error’, anything else (the link dropped, the phone failed, no answer in time).
Type Literal
Section titled “Type Literal”{ type: "cursor"; x: number; y: number; down: boolean; }
Remote mode with “remoteCursor”: true: the cursor the arrows move (see KeyCursor), x and y in fractions of the game’s frame (0–1), down while OK is held. Sent when it moves and when OK goes down or up; the SDK turns it into pointer and mouse events in the game’s page (pointermove, pointerdown, pointerup, click, …), as a Magic Remote’s. The screen draws the cursor itself, above the game.