Courses

Build a drawing game

Build a drawing game where an AI model guesses what players draw: your theme, your word list, your rules. You'll draw on a canvas, ask a decision model on Workers AI for a guess, turn it into a game, and put it online for others to play.

Build a drawing game

Clef Pictionary, by Jilles Soeters. Used with permission. Original post · Source code · Play it

In this five-minute video, Jilles draws shapes, animals, and Cloudflare icons on a canvas, and a model guesses each one in under half a second. The bars beside the drawing are the model’s answer: a probability for every word on his list. The model is Clef, a decision model on Workers AI. It doesn’t write a reply, it scores the options you give it. Changing the game means changing the list: no training, no new model.

This is a project course. You’ll build your own version, and it doesn’t have to look like his. So, before you start: what would you make yours about? Farm animals for your kids, inside jokes for a party, things in your kitchen, your team’s tools?

What you’ll build

A drawing game, as a React app on one Worker:

  • a canvas that works with a mouse, a finger, or a pen;
  • a Worker endpoint that sends each drawing to Clef, with your word list, and returns a probability for every word;
  • rounds, a win rule you choose, and a game that copes with slow or failed guesses;
  • limits on what each guess costs and how many guesses a minute it allows, so you can share it without worrying.

There’s no database, no accounts, and no multiplayer: a drawing goes in, probabilities come out.

Exercises

  1. 00.Interview: Tell your agent who your game is for, what players will draw, and how they'll play it.
  2. 01.Build a canvas: Start a React app on a Worker and build a canvas that works with a mouse, a finger, or a pen.
  3. 02.Add a decision model: Write your word list, send each drawing to Clef on Workers AI, and show a probability for every word.
  4. 03.Draw and guess: Turn guesses into a game: rounds, a win rule you choose, and a page that copes with slow or failed guesses.
  5. 04.Launch your game: Decide when the game guesses, check every request on the server, cap how many guesses it allows, and put it online for others to play.