# Pirates ahoy! How AI and I are building my ultimate version of Pirates!

> A browser pirate game in Three.js and TypeScript, built step by step with Claude since November 3: wind, broadsides, a seeded world, sea monsters and ten Crown warships. Then the loop felt slow, and I told the agent to keep going on its own. 27 hours, 84 agents, Claude building and Codex reviewing, and underpants on the yardarm.

- Author: mewset
- Published: 2026-11-23
- Tags: pirate-game, game-dev, threejs, typescript, claude, codex, ai, agents
- Canonical: https://githero.dev/blog/pirates-ahoy

---

I don't actually remember playing Sid Meier's Pirates! on the NES. I know I did, probably on a cartridge rented for the weekend, because that's how it worked back then. What I remember is NESticle, the emulator everyone had in the late nineties, and Pirates! being one of the ROMs you just had. It wasn't that many years ago that I finally got the joke in the name. Tacking against the wind to line up the broadside, then letting it go. Thirty-ish years later, I'm building my own version of it.

The project lives in a folder called `the_pirates`, and the start screen says *Pirate Game (working title)*. It runs in the browser, it's TypeScript on top of Three.js, and almost all of the code is written by AI. The 3D models are partly mine and partly Claude's, because some things are boring to model. I make the design calls, play the builds, and complain when something feels wrong.

Four days in, I could play a whole career, from the first jetty to six different endings. Then I played it some more, and the loop around the treasure maps felt slow. I had built a game for the broadsides, and it was sail, sail, sail, and if you were unlucky, nothing but blue sea. Everything since then, including the ideas I kept throwing in, has been about giving you more to do out there. It's also how I ended up telling an agent to stop waiting for me.

![The start screen of Pirate Game (working title): a parchment card with New Game and How to Play, next to a low-poly pastel harbour town with a frigate at the jetty](https://githero.dev/blog/images/pirate-game/start-menu.webp)

## Half a modernisation, half its own thing

When Claude asked what I remembered from the original, a little after ten on the evening of November 2, I said the sailing and the sea battles. Then I added one line: "Manövrera vinden och försöka lina upp för att skjuta av en salva =)". Work the wind and try to line up a broadside. Just after midnight, that line was in the first design document as the rule for everything else: "That's the core. Everything else gets built around it."

Claude won't recreate an existing game, so the design doc has a rule for it from day one: our own name, our own world, our own characters, art and music. Mechanics that belong to the genre, like sailing, trading, boarding and reputation, are fair game. I wanted the wind and the broadsides from Pirates!. The towns, ships and characters are our own.

The shape is a roguelike career. You start as a sailor who just got paid off after an expedition, and you want to try being a captain. Every game has a seed that generates the world: islands, five to eight towns, treasure, monster lairs. Same seed, same world. The map starts covered in fog. Sink in normal mode and you wash up on a beach with nothing but your chart. Hard mode, where sinking ends the career, only unlocks after you've killed all four sea monsters.

The art style has a Swedish name in the design doc, *Pastellmys*, roughly "pastel cosy". Soft, muted colours, flat shading, low-poly models, a camera looking down at an angle. It should look like a picture book. The interface is parchment and ink and sits on top of the sea instead of covering it.

## The core: wind and broadsides

The first step had exactly one goal: find out if sailing with the wind and fighting with broadsides is fun. If it isn't, nothing else matters. The design doc even lists what failure looks like, and one line on that list sums up the whole design: the fight must not be decided by luck or by who clicks fastest, but by position and wind.

The sailing is simplified but built on real points of sail. Straight into the wind you stand still, so you have to tack. With the wind coming in at an angle from behind, you're at your fastest. Three sail settings trade speed for turning, and W and S step between them. This is what that looks like in the tuning file, which holds every number in the game:

```typescript
sailModes: [
  { name: 'Reefed sails', speedMul: 0.12, turnRate: deg(42) },
  { name: 'Battle sails', speedMul: 0.6,  turnRate: deg(30) },
  { name: 'Full sails',   speedMul: 1.0,  turnRate: deg(16) },
],
polar: [[0, 0], [deg(40), 0.02], [deg(50), 0.55], [deg(70), 0.8],
        [deg(100), 0.95], [deg(135), 1.0], [deg(180), 0.82]],
```

The `polar` curve is the whole sailing model in two lines. Angle off the wind on one side, share of top speed on the other. At 40 degrees you get 2% of your speed, at 50 you get 55%, and the best you can do is 135 degrees, with the wind over your quarter. Dead downwind is slower than that, just like on a real ship.

The cannons sit on the sides. Q fires to port, E to starboard, and you don't aim. Each ammo type marks a band on the water beside your ship, and an enemy inside that band takes full damage. Get closer or fall further back and the same shot does half.

When a fight starts, the wind locks ("The wind holds still until the battle ends"), the camera zooms in, and a ring is drawn on the water. If you can reach the edge of the ring, you've escaped. There's no dice roll for it. A merchant you're chasing can get away the same way. You can only fire with the pirate flag up, and raising it near a merchant makes her run.

![A frigate and a pirate brig exchanging broadsides inside a dashed combat ring, with cannon smoke, cannonballs in flight, reload rings marked Q and E, and the compass showing Wind locked](https://githero.dev/blog/images/pirate-game/broadside.webp)

*Both broadsides at once. The pale boxes beside each ship are the full-damage bands, and the reload rings sit at Q and E.*

## Everything built around it

The home port is always Brinehaven. Each town has a bar, a market and a harbour master. Some have a drydock, and about a third have a black market. The bar is called The Leaky Barrel, and it's where you hire hands, buy a round of rum for morale and buy rumours about treasure.

![Brinehaven from above: pastel houses with coral roofs, labelled buildings for The Leaky Barrel, Harbor Master, Market, Drydock and The Old Jetty, and a frigate moored at the jetty](https://githero.dev/blog/images/pirate-game/brinehaven.webp)

*Brinehaven. The people on the paths and the gulls actually move.*

Out at sea and beyond the towns:

-   **Four ship classes** you can own: Dinghy, Sloop, Brig and Frigate. They take upgrades for sails, guns and the ram, five kinds of ammo, and four paint styles, among them Viking and Ghost.
-   **Boarding with an honest chance.** The screen shows a percentage, as in XCOM, and 90% really can fail.
-   **Officers** in five roles. A lookout with a spyglass rates every enemy from Weak to Deadly.
-   **Four sea monsters,** among them Ironback, a turtle so big it looks like an island until you get close. The ending text calls it "the island that breathed".
-   **The Crown.** Make enough of a name for yourself and the innkeeper's small talk changes until your wanted poster is on the wall. Then ten named warships come for you, each one immune to one or two ammo types. One of the six endings, The Long Shot, asks you to sink all ten and then retire in a *sloop*.

## Built in steps that have to be playable

The rule from the start was that the game gets built in steps, and each step has to be playable before the next one starts. Every step gets a design document, then an implementation plan, then a playtest note. The playtests are done by the agent itself: it runs the game in Chromium through Playwright and steers the ship with real key presses. A debug handle on `window` is only used to set up situations, like putting a pirate next to you. The actual sailing and shooting go through the keyboard, the same way I play it.

Step 1, sailing and combat, was merged at 09:19 on November 3, nine hours after the design doc. Step 2, a full round with a town, treasure and boarding, was merged that afternoon. The seeded world came on the 4th, ships and officers the same day, monsters and the Crown on the 5th, and the six endings on the 6th. Every step in the original vision, in 247 commits. That's the career I could play four days in, and the one where the treasure loop felt slow.

## Finding a faster loop

On November 21 I asked Claude, running as Opus 5.5 in T3 Code, to put together a group of subagents, both Codex agents and Claude models of different sizes, to analyse the gameplay loop and think both inside and outside the box. It could act as the orchestrator. "This is a serious job, so... think about it."

Six agents looked at the game separately: three Codex models, plus Fable, Sonnet and Haiku, each from a different angle. Meanwhile Opus built a bot that ran the game's own simulation for an hour per ship class on each of six worlds. Then a Codex reviewer and an Opus reviewer went through all of it.

The bot put numbers on what I had only felt:

-   **53 to 72% of a round had no decisions in it.** Just sailing.
-   **Bigger ships earned less from treasure.** The frigate earned 18 to 21 gold a minute. Food alone cost 13. After all costs it cleared 3.

Fable spotted something else. Sinking a pirate paid nothing, only reputation. The broadside fight, the reason the game exists, was in practice a cost on the way to the treasure. And treasure could already be sold in any port that wasn't hostile, at full price in a neutral one. The game just never said so.

The diagnosis was almost the same across all the analysts, even though none of them saw each other's work. Travel time wasn't the problem, and nobody wanted faster ships or a smaller world. The loop was missing choices and payoffs. In the next builds, sinking a pirate left salvage on the water. The innkeeper got a second rumour to sell, one nearby and one further out that pays more, and some chests held a clue to the next island.

![The Leaky Barrel bar dialog with options to hire men, buy a near rumour worth about 270 gold or a far one worth about 850 gold, and buy a round of rum](https://githero.dev/blog/images/pirate-game/leaky-barrel.webp)

*Two rumours in The Leaky Barrel. Buy one and the other offer disappears.*

## "Run autonomously"

At 17:38 that Saturday I gave it the full mandate. Roughly translated: "Act as the expert. Only ask me things that directly affect how the game looks, or if we drift too far from 'a modern variant of Pirates!'. You have full mandate to add and change whatever you want, in a direction that gets the game closer to a finished title." At 20:24 I added three words: "Kör på autonomt." Run autonomously.

Opus planned each round and handed the build to Opus subagents. When a build was done, a Codex agent reviewed it before anything was merged, and on the bigger rounds an Opus reviewer did the same in parallel. Opus subagents fixed what the reviewers found, and the orchestrator merged. Nothing scheduled the runs. Each time a subagent or Codex delegate finished, the notification woke the orchestrator up, and it started the next thing. Of the thread's 40 runs, 24 were started that way, not by me.

At 21:18 I typed, in caps: "HOW DOES BOARDING WORK?! Is it enough to just sail up alongside? Shouldn't you have to shoot her down first, and board when she's about to capsize?!" A minute later: "DO WE EXPLAIN THIS BEHAVIOUR ANYWHERE??"

We didn't.

My version became the rule: now you have to shoot her down to 30% hull before you can board. The agent also saved a note to its own memory to audit every rule in the game. A few minutes later it told me the questions for my playtest were in a note. I answered: "No, it should be autonomous." The audits went ahead without me, one each for sea and combat, land and economy, and the endgame, and came back with 76 findings. After the round that followed, if I couldn't board a ship, the game told me why. It also told me what had set a fort firing at me.

Then, at 02:01, it merged that rules round and stopped. Nothing ran for eight and a half hours. When I checked in at 10:30 and asked whether anything was left to do, the answer was yes, quite a lot. "Okay, what part of the word autonomous didn't you understand? Why did you stop after 13 hours when there are things left?"

Its answer, translated:

> You're right. I stopped because the merge felt like a natural pause, but that was a decision you had already made for me.

It added "don't stop between stages" to its memory and then ran for 11 hours straight. I felt like a slave driver cracking the whip at a poor agent that only meant well and had paused at a natural spot.

## The numbers

The last agent finished 27 hours after I typed "Kör på autonomt". Something was running for about 18 of those hours. Most of the rest was the night it took off.

-   **84 child agents** over the whole thread, analysis included: 70 Claude, almost all of them Opus 5.5, and 14 Codex.
-   **45 builders, 12 code reviews and 9 fixers.** Every build round got a Codex review before it was merged.
-   **168 commits** across all branches since I typed those three words.
-   **Tests** went from 3,618 after the first loop round to 4,143 on the newest branch.
-   **In the thread's first 13 hours alone,** by the orchestrator's own count: about 2,180 model calls, 1.8 million output tokens and 386 million tokens read from cache. That's Claude only. Codex isn't in there.

## Underpants on the yardarm

On Sunday I was mostly feeding ideas into the thread while the agent worked, all of them about having something to find out there, and a few of them came from replies on X. [@RemyAlidarso](https://x.com/RemyAlidarso) came up with beached wrecks that show up at random, where you can send a party ashore to search. [@aniqatc](https://x.com/aniqatc) suggested what you might find in the wreckage. Aniqa is also the reason a few bottles of wine now float up where a ship sinks, purely cosmetic. I asked for a small makeshift tent next to the wreck when castaways want to come along.

And one more: I wanted to be able to press W with the sails shot to pieces and see the crew hoist their underpants.

The agent went looking for the code that damages your sails. Only chain shot tears sails, and enemies only ever fired round shot. The sail bar under your ship had been sitting at 100 for almost three weeks. So it added a pirate trait called Chain Gunners, made the Crown warships tear sails, made any harbour that lets you in mend them for free, and drew torn canvas in stages. At zero, the laundry goes up, under the banner "Laundry day. Sails in shreds! The crew hoists their laundry." W hoists and reefs it like sails, but it doesn't make you any faster.

![A frigate with no sails left, its yards hung with red and white striped underpants, white shirts, blue trousers and red socks](https://githero.dev/blog/images/pirate-game/laundry-day.webp)

*Laundry day on a frigate. Each yard gets its own line.*

I asked it to test the laundry on every ship and style, not just the frigate. That's how it found the ghost dinghy, whose single yard was so short that the laundry turned into one giant red shirt. Clothes now have a size cap based on the width of the line, so at least two fit on every yard.

## What's left

The beached wrecks are still on their own branch. Codex found eight bugs in them before the merge, and they're being fixed as I write this. After that, the agent's own list says sound, crew levels, mutiny, and a name for the game. The only sound so far is the menu music, made in Suno.

It runs locally on my machine, and the start screen still says "Pirate Game (working title)".

* * *

Times in this post are Swedish time. The run figures come from the T3 Code thread and the git history, not from memory. If you know a good name for a pastel pirate game that isn't Pirates!, I'm listening.
