Skip to content

player

Synchronous. Throws before init() resolves; after it, always answers.

Read the player

const player = sdk.player.get();
// { id: string, nickname: string, guest: boolean, host: HostName }
drawName(player.guest ? 'Guest' : player.nickname);

id is stable per host. On filudi.com it is the player id of the API: the same for a guest and for the account that guest later creates. On portals it is the portal’s user id when the portal exposes one, else a random id kept in localStorage. nickname is the hub’s or the portal’s display name; a guest on filudi.com gets a generated one like Guest-Fox. Do not key saves on id: the SDK does that for you.

Fires when the nickname changes or the player links an account while the game runs. The listener gets the new Player. Returns a function that removes the listener.

Follow the player

const off = sdk.player.on('change', (player) => drawName(player.nickname));
// off() when the scene goes away

None: every host has a player. On Poki and on the standalone mock the player is always a guest. features.account from init() says whether the host lets a guest become an account; the hub owns that flow, the game only reads the result through change.