Use sign-in and result sharing
Let the host handle identity and sharing without exposing player details.
Display a player name safely
After init, call player.isSignedIn() or player.name(). Treat the name as display text: it can change, may not be unique and may be null. Put it in text content, not HTML, identifiers, analytics or saves.
Subscribe to signedInChange and re-read the display name. Do not infer age, email or a persistent player id.
Offer sign-in
- Persist the progress you need before requesting sign-in.
- Call
player.requestSignIn()from a suitable game action. - Handle
signedIn: falsewithout blocking the free gameplay path. - Expect that following the host’s login flow can replace the current frame rather than resolve the original promise.
Do not render your own password form inside the game.
Offer a result to share
import llvls from '@llvls/sdk';
async function offerResult(): Promise<void> {
llvls.gameplayStop();
const result = await llvls.share.result('I finished the maze');
if (!result.shown) console.info('Result sharing is not available here');
}
void offerResult;
Call after initialisation and after a run has started. Integrate this with your actual break, not as a way to fake lifecycle.
The host adds the game URL and draws the Share control. shown: true means the control appeared, not that the player shared. Use 1 to 80 characters of plain text, with no links, addresses or control characters. Kids games and previews do not offer this result-sharing control.
Resume gameplay with gameplayStart() when the next run actually begins.