All case studies
Connect 4 — a solved game that still has to be worth playing
Perfect play wins from move one, and that has been known since 1988. Everything that matters is the opponent and whether you can see why you lost.
- Client
- In-house title
- Platform
- WebGL / browser
- Engine
- Unity
- Genre
- Board
Unity WebGLC#gzip compressionApache
The challenge
Connect 4 is a solved game. With perfect play the first player wins, and that result has been known since 1988. Shipping it means accepting from the outset that there is no secret to protect and no cleverness to invent — the entire product is how the few hundred milliseconds around each move feel, and whether the opponent is worth playing.The opponent is the hard part, and it fails in the same way chess does but faster. An engine that searches deeply enough will never lose, and a game you cannot win is a game nobody opens twice. Cut the search to make it beatable and it stops seeing one-move threats: it ignores a three-in-a-row sitting in plain sight, lets you win on move seven, and the player learns nothing because the opponent was not really playing. Both extremes produce the same outcome — the player stops caring — and the gap between them is narrow.
What makes Connect 4 specifically unforgiving is gravity. You do not place a disc on a square; you choose a column and the disc falls. That means every move you make also decides what square your opponent gets next, because the slot directly above yours becomes available the instant you commit. A move that looks strong can hand over the winning square for free, and a beginner who does not see that will lose repeatedly without understanding why. The information needed to avoid it is on screen, but only if the board is readable enough to show it.
The second problem is the endgame moment. A win in Connect 4 is four discs in a line, and in a board already crowded with discs, four-in-a-row is surprisingly easy to miss. If the game simply announces a winner, the loser is left scanning for what happened — and a defeat you cannot see the shape of is a defeat you cannot learn from.
Third, this is a browser build, which removes the usual cushion. No install means no sunk cost: a visitor who finds the first thirty seconds unclear closes the tab. There is no room for a tutorial for a game most people already half-know, so the rules have to be obvious from the board itself.
And finally there is the two-player case. Connect 4 is most often played by two people in the same room, which a single-player-only build simply fails to serve.
Our approach
The AI was shaped rather than just weakened. It blocks an immediate three-in-a-row and builds its own, which is the floor below which an opponent stops being credible — a program that lets you complete a visible line is not playing the game. Above that floor it plays soundly without searching to the solved depth, so a careless move loses and a thought-out one wins. That distinction is the whole design: an opponent that loses to good play is satisfying, an opponent that loses to any play is pointless.The board is built to make gravity legible, because that is the rule beginners lose to. Columns read as columns, the landing slot for a disc is unambiguous, and the stack height of every column is visible at a glance. A player who looks can see what square they are about to open up. The game never blocks the move or warns against it — that would remove the decision — but the consequence is visible to anyone paying attention, which is what makes a loss traceable instead of mysterious.
The winning four are highlighted when the game ends. This is the single highest-value piece of feedback in the build. Without it a loss is an announcement; with it, the loser sees the exact shape that beat them, and the diagonal they failed to watch becomes the thing they watch next game. It turns the end screen from a result into a lesson, at almost no implementation cost.
Local two-player shares the same board with no mode-switching ceremony, because the most common way this game gets played is two people and one device. Building only the AI mode would have solved the less common half of the problem.
Teaching happens through the first few moves rather than a tutorial. The board is self-explanatory — discs fall, lines win — so a player learns by dropping one and watching. For a game this widely known, any instruction screen costs more attention than it returns.
The board is drawn with high contrast between the two players' discs and the empty slots, so the state of the game is readable at a glance on a phone as well as a monitor. In a game where the whole decision is reading a grid, two colours that look alike at small size is not a cosmetic issue but a broken mechanic.
On the technical side this build ships gzip-compressed, which is worth noting because every other WebGL title in our library is Brotli. Unity gives both the same .unityweb extension, so the file alone says nothing — the compression was identified by reading the magic bytes and the server rule written to match. Had it been assumed, the browser would have fallen back to decompressing in JavaScript: still working, several times slower, and silent about it. The canvas is responsive, fixed to the full stage with the game scaling its own UI, so it fills the player page at any window size without cropping or letterboxing.
The result
An opponent that is beatable without being broken. It blocks visible threats and builds its own, so winning means out-playing it rather than waiting for it to blunder — the difference between a game worth a second round and one that is not.Highlighting the winning four turns the end of a match into feedback. The loser sees the exact line that beat them, which is how a player learns to watch diagonals without ever being told to.
Gravity is made legible by the board rather than explained by a tutorial: column heights and landing slots are visible, so the square you are about to hand your opponent is something you can see before you commit.
Local two-player on the same screen is built in, because that is how this game is most often played.
The build was identified as gzip by reading its magic bytes rather than assuming Brotli like the rest of the library, so it decompresses natively instead of falling back to the slower JavaScript path. It fills the stage at any window size, on desktop and mobile.
Playable on this site right now, with no download and no account.
