A turn-based game of hiding and hunting, where everything useful you do tells the others where you are.

Overview

Dark Forest is a solo web game made for a phone browser. You fly one ship across a hex map of stars against one, three or five bots, and nobody can see anybody. Ships have to feed on stars to stay alive. Feeding is loud, and anything loud sends out a ring that tells every other ship what happened and where. The last ship alive wins.

The name and the idea come from the "dark forest" hypothesis in The Three-Body Problem, where the universe is full of hunters and the safest thing a civilization can do is stay quiet.

Play Dark Forest. There is nothing to install and no account, and a game on the small map takes a few minutes.

The replay of a two-ship game on the small map

A whole game on the small map, one ship against one bot, replayed at twice normal speed. Blue fires first on turn 4 and misses, and Orange fires back on turn 5. They trade another pair of misses on turns 9 and 10, then Blue finds Orange on turn 16. Single lines are moves, double lines are jumps and dotted lines are shots. The burning hexes are where the Big Gun was aimed.

The small map is the quick one. It has 91 hexes and a single bot, and this game was over in 16 turns. The medium map has three bots and the large map has five.

The replay of a six-ship game on the large map

The end-of-game replay of a six-ship game on the large map, at two and a half times normal speed. Turn 4 is the first turn anyone is allowed to fire. Orange, Pink and Yellow all fire on it and all three die. Green gets Red on turn 11, which leaves Blue and Green hunting each other for 22 turns. Blue misses four times and lands the fifth shot with 7 energy left.

How it plays

You pick a map, then secretly pick a starting hex in the outer two rows while the bots do the same. The stars are laid out the same in each third of the map, with one bigger star in the middle, so no third of the map has more food than another.

Every turn you have to do one of four things, and you can't stand still:

  • Move one hex. It's the only silent action.
  • Jump two hexes. The others hear where you left from, not where you landed, and you can't jump two turns in a row.
  • Feed on the star you are standing on. The star comes back ten turns later at half its size.
  • Fire the Big Gun at any hex within six.

Every turn costs one energy whatever you do, and firing costs five more. Run out and you starve.

The start screen, with the legal starting hexes highlighted round the edge of the medium map A game in progress on the medium map, with clue markers, shaded zones and two destroyed hexes

Left: choosing a starting hex on the medium map. Right: turn 9 of a game. The lines at the top are what the other ships have given away, and the shaded hexes are where each of those ships could be by now.

Clues

A ring travels three hexes a turn and ships move one, so by the time you hear about something the ship that did it has moved. The game marks the hex with a letter and the age of the clue (F for fed, G for the gun, B for a blast, J for a jump), and shades every hex that ship could have reached since. The shaded zone grows by one hex a turn until the clue is too old to be worth anything.

Clues don't say who, so with five bots on the large map you also have to work out which clues belong to the same ship.

Ships also leave a trail. If you stand on a hex another ship stood on in the last five turns, you learn how many turns ago it was there.

The Big Gun

The gun destroys the hex you aim at and the two hexes behind it as seen from your ship. The hex you aimed at is gone for good and nothing can enter it again, so every shot changes the map, and a miss can still cut off the way someone was running.

Three ships destroying each other on turn 4

Turn 4 of the game in the animation. Three ships started close together at the top of the map, heard each other feeding, and all fired on the first turn they could.

A destroyed ship leaves a wreck, which is a star holding whatever energy the ship had. Everyone who hears the blast learns where the wreck is.

Nobody can fire for the first three turns, which gives every ship time to feed and leave a few clues first.

The bots

The bots play by the same rules and get exactly the same information you do. Each one keeps a list of hexes every other ship could be standing on, grows it by a hex a turn, and shrinks it when a clue arrives. It fires when enough of that list fits inside one blast.

The Show all button in the game draws the bots and what each one believes, which is the easiest way to see how a bot found you.

Tuning it with a simulator

The rules are one JavaScript module with no drawing in it, and the bots are another. A small script plays thousands of bot-against-bot games with no screen and prints what happened: how long games ran, how many shots landed, how many ships starved.

Most of the numbers in the game came out of that script.

Change What the simulator showed
Moving cost 1 energy on top of the turn 0.8 ships a game starved. Moving is now free and it dropped to 0.16
A probe that was its own action The bot that never used it won 48% of three-ship games
A gun that only fired along the six hex lines 33% of shots killed. With free aim it was 42%
Stars that grow back, with no probe Bot games on the small map ran 53 turns until the bots were made to fire at lower odds

The probe was a silent way to check a hex for ships. It went through three versions and I took it out in the end.

Replays and sharing

A whole game fits in a short piece of text: the map size, the seed, where each ship started and every action every ship took. Playing that text back through the rules rebuilds the game exactly. The longest one I have seen is about 900 characters.

That text is what makes the rest work:

  • The end screen has a Share button that copies a link with the game in it. Anyone who opens the link watches the same replay.
  • Every finished game is saved on your device and can be watched again from Past games.
  • During a game, Replay plays back the turns so far as you saw them, without showing the other ships.

The end screen for the six-ship game, showing the replay above the result and a list of each shot

The end screen for the game in the animation, opened from a share link. The list under the result says how close each of your shots came.

How it was built

The first version, from November 2025, was a React and three.js build. I threw it out and started again as one HTML file, a 2D canvas and a handful of JavaScript modules, with no build step. The whole game is static files on GitHub Pages.

The rewrite was done with Claude Code. I played each version, said what was wrong with it, and it changed the rules, ran the simulator and came back with the numbers.

Project status

Playable, at version 0.15. Bot games on the medium and large maps can run long, and the bots only land about one shot in four, so both of those need more work.

The code is on the Dark Forest GitHub repo.