Snake — multiplayer, with an AI player
A small multiplayer Snake: everyone in the room shares one board, and an NPC joins in, deciding where to go by calling a language model.
Lives on this site. Type gg on any page to open it.
What I did
- Real-time rooms on PartyKit, with dead reckoning on the client so other snakes move smoothly between updates.
- An NPC that asks a model (Jev, by typesafe.ai) for each move, with a daily spend cap and an idle cutoff when nobody is watching.
- Pause, slow-down, a watch-only mode, and a replay of the NPC's decisions.
TypeScript · Canvas · PartyKit · Cloudflare