Skip to content
Cassette

How do I give players names in my AI game?

On Cassette, players bring their name with them. Each can have a @username on their Cassette account, and your game reads it in one line, for a scoreboard, a room or the HUD. No sign-up form and no database to build.

Tell your agent
Show each player’s cassette.gg username in my game, and let guests sign in.
In one line
cassette.player.username, or null while the player hasn’t picked one: show your own label then, such as “player” and the last four characters of their id.
Everywhere already
Leaderboard entries and players in a room carry the same id and username.
Guests
cassette.signIn() opens Cassette’s sign-in sheet, which offers a new player a username.
A name for the HUD:
const cassette = await Cassette.ready
const p = cassette.player
const name = p ? (p.username ?? `player ${p.id.slice(-4)}`) : 'guest'

Who is playing, for agents (§2)