← Back to Blog

Dev Blog · Jun 4, 2026

Paint Race: Designing a Fair Computer Opponent

Paint Race

Paint Race pits you against a computer that covers the canvas in red while you cover it in blue. The final territory split determines the winner. The design question that occupied most of the build time was not the painting mechanic — that was straightforward. It was the computer opponent. How do you build an AI that feels like a worthy rival without feeling unbeatable or trivially easy?

The problem with optimal play

The theoretically best strategy in a coverage game is to move in tight, systematic sweeps — row by row or column by column — maximizing painted area per unit of movement. A computer running this strategy would be almost impossible to beat because humans do not naturally move in perfect grids under time pressure. They chase open space, double back, and leave gaps.

An optimal AI is not a fun opponent. It wins too reliably and in a way that feels mechanical and inevitable. Players do not feel challenged by it — they feel cheated. The first version of the AI used a near-optimal grid sweep and was abandoned after one afternoon of testing in which nobody won.

Intentional imperfection

The breakthrough was treating imperfection not as a difficulty slider but as a design property. I gave the AI a set of target behaviors — prefer the largest unpainted region nearby, avoid backtracking over painted cells, maintain roughly even canvas distribution — but interrupted each one with probabilistic noise. Every few hundred milliseconds, the AI has a small chance to deviate from its current best move and wander somewhere suboptimal.

This noise accomplishes three things. It creates openings for the player to exploit. It makes the AI feel organic rather than robotic. And it means no two games play exactly the same way, since the random deviations accumulate differently each time.

Reading the board, not just the opponent

The more important competitive element turned out to be territory awareness. When the AI performs well, it is because it prioritizes large unpainted regions over small ones — a bias that mirrors how strong human players think. Players who beat the AI regularly report noticing when large patches are about to be cut off and racing to claim them first.

This creates genuine strategic tension without any explicit strategy UI. You are not reading a tooltip explaining that claiming large quadrants is good — you are just playing the game and gradually learning that racing to the open corner before the computer gets there is worth the risk of leaving your existing territory exposed. That kind of implicit teaching is what makes Paint Race feel competitive rather than just chaotic.

Play Paint Race