How I Built a Stroke Capture System for an AI Drawing Game
Source: Dev.to
Why Capture Strokes?
Most drawing apps only save the final image, but for Paint Your Partner I needed to record every single brush stroke—position, timing, pressure, colour, and order. The AI that commentates the drawing watches the process in real time, so it can react to the moment an eye appears, a user hesitates over hair, or they abandon a nose for an abstract scribble.
Stroke Data Structure
Each stroke is stored as an object containing:
- Path data – an array of x/y coordinates
- Colour
- Brush size
- Timestamp – when the stroke started
- Duration – how long the stroke took
- Order – the stroke’s sequence number
Capturing all of this information lets me replay any drawing as a video, speed it up, slow it down, or export it as a GIF or MP4.
Uses of Full Stroke Data
- Shareable content – watch someone draw their partner in 10 seconds.
- AI training data – useful if I ever want to fine‑tune the model.
- Debugging – see exactly what a user drew and when.
Real‑Time AI Commentary
The AI receives strokes as they arrive, without waiting for the drawing to finish. As features appear on the canvas (eyes, hair, smile), it fires off short, cheeky comments such as:
- “Ooh, those eyes are looking dreamy!”
- “Someone’s really capturing that smile!”
The timing information reveals hesitation, confidence, or chaos, giving the AI richer context for its remarks.
Reusing the Engine
Paint Your Partner runs on the same engine as Artbitrator, my multiplayer drawing game (similar to Quick Draw but with AI judging). Both share the stroke‑capture and replay system, while offering different game modes. Building the core engine once and layering multiple products on top has paid off.
Future Plans
- Camera capture – sync players’ webcam feeds with the stroke replay and export the whole thing as a single video, ready for TikTok.
- Additional game modes – the stroke system makes new experiences possible, even though they aren’t built yet.
Try It Out
paintyourdate.io – Draw your partner, let the AI commentate, and see how bad you really are at noses.