How INKPLAY works
Computer vision does the geometry. An AI model does the understanding. Your pen does everything else.
- 1
your browser
web worker
OpenCV.js finds the paper, flattens it, cleans the ink and numbers every mark.
- 2
the AI
cloud or local
Reads the clean drawing + the numbered copy. Labels each mark, turns margin words into rules, names the level.
- 3
the server
zod + BFS
Validates the JSON, clamps every number, then a fixer makes sure the level has a player, a goal and a path.
- 4
Phaser
arcade physics
Your drawing becomes the world. Bodies sit on your ink; your enemies and coins are cut out of the page and come alive.
- 5
the AI, again
the critic
Watches your stats and writes a two-line review. Canned lines step in if the model is busy.
And the arena
Ink Arena is the same sketchbook as a jetpack shooter for a whole room. Start a room, share the code, and everyone plays one map live.
- 1
the map maker
arena designer
Lays out platforms, hazards, spawns, crates and monsters from a theme, from your drawing, or on its own. Your options (bots, pickups, weapons, hazards) go in as constraints.
- 2
the server
zod + cleanup
Clamps every number, pulls overlapping pieces apart, keeps hazards reachable and spawns off them. If the model is slow, a seeded procedural map steps in, so a room never waits.
- 3
Supabase Realtime
broadcast + presence
One channel per room. Each player simulates themself and sends their state ten times a second; everyone else draws them 150 ms behind, smoothed. The player who gets hit decides the hit.
- 4
the host
no game server
The earliest joiner still playing runs the monsters and the AI bots. If they leave, the next player takes over. A watchdog rebuilds a dead connection.
And survival
An endless runner on the same sketchbook page, playable with a keyboard or with taps and swipes on a phone. It needs no AI and no network, so it works anywhere, even in airplane mode.
- 1
a seeded generator
no model needed
Lays out each chunk of track from the run seed: gaps, spikes, lava, crumbling floors, beams to slide under, ledges, mobs and pickups. It gets denser as the run speeds up.
- 2
the clamps
zod + cleanup
Chunks are data, checked like levels and maps: gaps and hazards stay within a jump at the current speed, there is room to land between dangers, and every seam is solid ground.
- 3
Phaser
arcade physics
Streams chunks in ahead of you and drops them behind, so the page never ends. HP, invulnerability flashes, stomps and power-ups run in the browser.
Open source
INKPLAY is MIT licensed. This site uses a hosted model; your own copy can use a local one through Ollama and run with no internet at all, which makes it handy for a classroom or a train with no signal. Get the code.
Honest answers
- Is it always right?
- No. A hatched trampoline sometimes reads as spikes. The numbered reveal shows exactly what the AI thought, so you can redraw.
- Can the model run code?
- Never. It picks from a fixed list of rule types; anything else is dropped and every number is clamped.
- How fast?
- About 10–30 s in the cloud (median ≈ 13 s). Offline speed depends on the laptop.
- Does it need an account or database?
- No. The gallery and online arena rooms use Supabase when it is configured; draw, play and review never touch it. Without it, the arena plays between tabs of one browser.
- Can I play the arena alone?
- Yes. Add up to 8 AI bots. They fly, dodge lava and shoot everyone, including each other.
Credits
OpenCV.js · Phaser 3 · Next.js · Rough.js · Ollama · Supabase (Postgres, Storage, Realtime) · open-weight models. Type: Bricolage Grotesque, Kalam, JetBrains Mono.
Start drawing