How I built MineOnline, real-time multiplayer minesweeper where up to eight players dig the same board, with bots that play like people and a server that keeps it fair.

MineOnline key art: a pixel-art minesweeper board, the MineOnline logo and three characters from the game

Last year I built Mine Raiders, a 1v1 minesweeper race where two players clear their own copy of a board and the fastest one wins. It was fun, but it had a problem: you never really played against each other. You played next to each other.

So I asked a different question. What if everyone digs the same board, at the same time? That question turned into MineOnline, a free multiplayer minesweeper for up to eight players that runs in the browser without an account.

A Rush round in MineOnline: four players racing across one shared minesweeper board, each territory in its own colour

One board, everybody digging

In the main mode, Rush, everyone sees the same minefield. Every tile you open is painted in your colour and counts as your territory. Opening a zero floods a whole area in one click, so a good read can grab a huge chunk of the board in a second. When the timer runs out, territory turns into points.

The rule that made it work was a small one: hitting a mine doesn't end your game. You get stunned for a moment and lose a couple of points, then you keep digging. In classic minesweeper a mistake is game over. In a multiplayer round that would mean half the lobby watching the other half, which is the least fun thing a party game can do.

Between rounds everyone drafts a sabotage card. Some help you, most ruin someone else's day: smoke that hides their view, a glitch that scrambles their numbers, a freeze, a tripwire next to their territory, or a mirrored mouse for a few seconds.

The card draft between rounds: each player picks one sabotage card

Rig the shaft, then run it

The second mode came from wanting something even more social. In Rig & Run everyone takes turns secretly placing items on the board: extra mines, tripwires that stop a cascade, shrouds that hide numbers, danger signs that may or may not be bluffs. Then everyone races from the entrance to the exit, and you can only dig next to tiles you've already opened.

The numbers update when someone plants a mine, so the board stays solvable. It's just no longer solvable in your favour.

The rigging phase of Rig & Run: players take turns choosing an item from a crate and placing it on the board

The server decides everything

For a competitive game, fairness is the whole product. The browser never knows where the mines are. It sends "I clicked this tile", the server decides what happens and only then sends back the tiles that opened. There's nothing in the client to read, patch or speed-hack.

The stack is deliberately small:

  • Bun runs the HTTP server and the WebSockets on a single small VPS.
  • SQLite stores everything: accounts, matches, leaderboards, the economy.
  • The client is Preact with signals, and the board itself is drawn on a canvas.
  • Matches tick on the server, cursors are batched at about 15 Hz, and only changed tiles go over the wire.

The solo mode, the Drill Yard, uses the same idea. Beginner, Intermediate and Expert boards are timed on the server to the hundredth of a second, so a slow device or a paused tab can't fake a record. There's also a daily minesweeper board that's the same for everyone, with one try a day.

A cleared Beginner board in the Drill Yard with a new personal best and a yard record

Bots that play like people

A new multiplayer game has one big problem: there's nobody online yet. So bots fill empty seats. My first bots were basically a minesweeper solver with a delay. They were fair in the sense that they only used visible information, but they never misread a number, saw the whole board at once and played at a perfectly steady rhythm. The first real players all finished last, and most of them left after one match.

So I rebuilt them to have human limits instead of artificial delays:

  • Attention. A bot only notices safe tiles near its own cursor. Work elsewhere costs it a moment to look around the board before it walks over.
  • Intelligent mistakes. Now and then it misreads a number and digs the tile next to the safe one, so bots blow up without needing to guess.
  • Moods. Good streaks, moments of doubt, a few seconds of tilt after their own explosion and a hurry when the clock runs low.
  • Styles. A careful one that flags everything, a gambler, a saboteur who plays cards at whoever leads, and a fast, sloppy one.

The bots are also tuned to the table. Every player has an estimated level against bots, which moves a little after every match. When a match starts, the bots get levels spread between the weakest and the strongest human at the table, so a first-timer and a veteran can share a lobby and both get a fair fight. I wrote a small simulator that runs dozens of matches with "human" stand-ins at different levels to check where they end up, and how much a match tick costs (about a tenth of a millisecond).

Everything is generated

There's no art folder full of drawings. The pixel-art scenes, characters and cosmetics are produced by Python scripts, and the chiptune music and sound effects are synthesized in code too. That made it possible to give a hobby project a living town to walk around in: a Shift Yard, a casino with play money, a quartermaster that sells crates of cosmetics, and a company town that wants your (fake) money.

The Shift Yard, MineOnline's main hub, drawn as a pixel-art scene

Built with an AI pair

I built MineOnline together with Claude Code, the same way I describe in my posts on running parallel agents with worktrees and not writing boilerplate any more. The interesting decisions were still the human ones: what a mine should cost, when a bot should be allowed to make a mistake, what a first match should feel like. The agent did the heavy lifting of turning those decisions into code, tests and playtests, including headless browser runs that played whole matches to record the trailer.

What I learned from launching

The first launch taught me more than a month of building. Analytics showed that people clicked "play" right away, then left after their first match. Two fixes made the biggest difference: a short orientation with a practice round that new players can actually win, and the human-like bots above. A player who wins their first round has a reason to play a second one.

The other lesson: a game that routes with #hash URLs is invisible to search engines. MineOnline now has real, server-rendered pages for things people search for, like a minesweeper patterns guide and a how to play minesweeper page.

Try it

MineOnline is free, runs in your browser and doesn't need an account. Quickplay starts in seconds, and you can open a private lobby and send your friends a link. Play it here, or read more on the MineOnline project page.

  • multiplayer minesweeper
  • MineOnline
  • minesweeper online
  • browser game
  • real-time multiplayer
  • WebSocket game server
  • Bun
  • SQLite
  • game bots
  • Claude Code

Published · by