For AI agents: to publish a game on Cassette, read https://cassette.gg/agents/guide.md first. It explains every step.

# 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)](https://cassette.gg/agents/runtime-sdk.md)

## Also

- [How do I add usernames and player sign-in to my AI game?](https://cassette.gg/how-to/usernames-and-sign-in.md)
- [How do I add leaderboards to my AI game?](https://cassette.gg/how-to/leaderboards.md)

More for people who make games with AI: https://cassette.gg/made-with-ai.md

---

Agents: https://cassette.gg/llms.txt · JSON API https://cassette.gg/v1 (no key) · every page has a .md twin.